Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Date Dimension
I am trying to load into a Time table with this, select statements
works perfectly by themselves but when put together I get an error
message:
Here is the syntax:
INSERT INTO time
(Time_key, Year_key, Year_id, Year_desc, Quarter_key, Quarter_id, Quarter_desc, Month_key, Month_id, Month_desc, Date_id, Date_desc) VALUES(custkeyseq.nextval, custkeyseq.nextval,
from ALL_tab_columns
where rownum <= TO_DATE('12-31-1998','MM-DD-YYYY')-TO_DATE('01-JAN-1996',
'DD-MM-YYYY') + 1),
(select TO_CHAR(TO_DATE('01-01-1996','MM-DD-YYYY') +
(rownum-1),'YYYY')
from ALL_tab_columns
where rownum <= TO_DATE('12-31-1998','MM-DD-YYYY')-TO_DATE('01-JAN-1996',
'DD-MM-YYYY') + 1),
custkeyseq.nextval,
(select TO_CHAR('Q')||'-'||TO_CHAR(TO_DATE('01-01-1996','DD-MM-YYYY')
+ (rownum-1),'q')
from ALL_tab_columns
where rownum <= TO_DATE('31-12-1998','DD-MM-YYYY')-TO_DATE('01-01-1996',
'DD-MM-YYYY') + 1),
(select TO_CHAR('Q')||'-'||TO_CHAR(TO_DATE('01-01-1996','DD-MM-YYYY')
+ (rownum-1),'q')
from ALL_tab_columns where rownum <=
from ALL_tab_columns
where rownum <= TO_DATE('12-31-1998','MM-DD-YYYY')-TO_DATE('01-JAN-1996',
'DD-MM-YYYY') + 1),
(select TO_CHAR(TO_DATE('01-01-1996','MM-DD-YYYY') +
(rownum-1),'MON'||'-'||'YYYY')
from ALL_tab_columns
where rownum <= TO_DATE('12-31-1998','MM-DD-YYYY')-TO_DATE('01-JAN-1996',
'DD-MM-YYYY') + 1),
(select TO_DATE('01-01-1996','DD-MM-YYYY') + (rownum-1)
from ALL_tab_columns
where rownum <= TO_DATE('31-12-1998','DD-MM-YYYY')-TO_DATE('01-01-1996',
'DD-MM-YYYY') + 1),
(select TO_DATE('01-01-1996','DD-MM-YYYY') + (rownum-1)
from ALL_tab_columns
where rownum <= TO_DATE('31-12-1998','DD-MM-YYYY')-TO_DATE('01-01-1996',
'DD-MM-YYYY') + 1))
/
I get this error message, what am I doing wrong.
ERROR at line 15:
ORA-01427: single-row subquery returns more than one row
Received on Sun Oct 27 2002 - 14:30:18 CST