第一步:创建测试PS
CREATE OR REPLACE PROCEDURE etl.test_connect
AS
--l_begin_date DATE;
--l_issue_length NUMBER:=8;
CURSOR c_issue_id
IS
SELECT EW_ISSUE_ID,
EW_BEGIN_DATE,
TRUNC(EW_END_DATE)-TRUNC(EW_BEGIN_DATE) issue_length
FROM cnface.cn_ew_issue_dimt0
WHERE EW_ISSUE_STATUS='biding';
BEGIN
FOR r_issue_id IN c_issue_id
LOOP
INSERT INTO cnface.a
SELECT r_issue_id.EW_BEGIN_DATE+a.rn
FROM (
SELECT ROWNUM-1 rn
FROM DUAL
connect BY ROWNUM<=r_issue_id.issue_length
) a;
END LOOP;
COMMIT;
END;
/
第二步:执行PS
exec etl.test_connect
每三步:查看数据
SQL> select * from cnface.a;
2007-11-01 10:10:00
2007-11-02 10:10:00
2007-11-03 10:10:00
2007-11-04 10:10:00
呵呵,这样就出来了想要的数据,我也不知道为什么,关于connect by 的用法还有待研究!很神奇
[@more@]