I'm not sure if I understand Sudhir's requirements correctly - this is what I *think* he wants:
- He has a the starting and ending date in a table and he wants to insert one record for each day between this two dates. He said he want's to use only SQL and no other table. Since Chris have already mention the use of DUAL (which *is* "another table") I suppose the usage of public views like ALL_OBJECTS is allowed. So how about this:
INSERT INTO para_tab(from_dt)
SELECT pt.from_dt+x.row_num-1
FROM para_tab pt,
(SELECT rownum row_num FROM all_objects
WHERE ROWNUM <= (SELECT to_dt - from_dt +1 FROM para_tab)) x;
This will insert a single row for every date between the reference dates (from_dt and to_dt). The join
obviously results in cartesian merge join, but as there is only one row in PARA_TAB initialy this bares no performance penalty. BTW, in 8i any user has (at least) about 10.000 rows available in ALL_OBJECTS, so this query can span a date range of at least about 30 years.
HTH,
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?