Extract data from query insert in table, if Null insert other values [message #302027] |
Fri, 22 February 2008 13:59  |
suzyque54
Messages: 14 Registered: December 2006
|
Junior Member |
|
|
I need help with this query. I am trying to extract data with query1 and load the results to a table1. However, sometimes the results or query1 are null and then I want to load other values so my table is not missing data especially a date as I need an entry for each day. Both the query and the table have 3 columns, ENDDATE, ID, and COUNT.
1 INSERT
2 WHEN (ENDDATE IS NULL) THEN
3 into table1 (ENDDATE, ID, COUNT)
4 VALUES(TO_CHAR(SYSDATE, 'MM/DD/YYYY')),'NONE', 0)
5 ELSE
6 into table1 (ENDDATE, TID, CHRONICCOUNT)
7 VALUES (ENDDATE, ID, COUNT)
8* SELECT * from query 1
SQL> /
VALUES(TO_CHAR(SYSDATE, 'MM/DD/YYYY')),'NONE', 0)
ERROR at line 4:
ORA-00928: missing SELECT keyword
Thanks for your help this is driving me crazy!
|
|
|
|