次の表があります。
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;
connect by と level を使用しようとしました。
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 行が選択されました
そのため、何をどのように正確に使用すればよいかわかりません。毎回 role_name によってレベルが異なるためです。それで、私が欠けているものを誰か教えてもらえますか?