我有下表:
CREATE TABLE TASK_2
(
ROLE_NAME VARCHAR2(50 BYTE),
MIN_CNT NUMBER,
MAX_CNT NUMBER
)
使用以下数据:
INSERT INTO TASK_2 VALUES ( 'SE', 3, 5);
INSERT INTO TASK_2 VALUES ( 'SSE', 2, 6);
INSERT INTO TASK_2 VALUES ( 'MGR', 3, 5);
INSERT INTO TASK_2 VALUES ( 'SR_MGR', 1, 4);
期望的输出是:
se there are 3;
se there are 4;
se there are 5;
sse there are 2;
sse there are 3;
sse there are 4;
sse there are 5;
sse there are 6;
mgr there are 3;
mgr there are 4;
mgr there are 5;
sr_mgr there are 1;
sr_mgr there are 2;
sr_mgr there are 3;
sr_mgr there are 4;
我曾尝试使用按级别连接。
SELECT role_name||' there are '||level
FROM task_2
CONNECT BY level < max_cnt
AND level > min_cnt
ORDER BY role_name;
输出是:
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 1
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 4
se there are 4
se there are 4
se there are 4
se there are 1
se there are 4
se there are 4
se there are 4
se there are 4
se there are 4
sr_mgr there are 2
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 1
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 3
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 3
sse there are 3
sse there are 4
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 4
sse there are 5
sse there are 3
sse there are 4
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 1
sse there are 5
sse there are 5
sse there are 3
sse there are 5
sse there are 4
sse there are 4
已选择 64 行
所以,我看不到我应该使用什么以及如何使用。因为级别每次都随着角色名称而变化。那么谁能告诉我我错过了什么?