Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQL ?? - Insert from multiple tables
Hi -
I am ahving a problem with the following SQL statement:
insert into table1 (fld1, fld2, fld3) select a.fld1, b.fld2, 'test value' from table2 a, table3 b where a.fldx = 'val1' and b.fldy = 'val2'
What happens:
If there is no record in table3 (b) where fldy = 'val2', the new record is not inserted into table1
What I want to happen:
If there is no record in table3 (b) where fldy = 'val2', the new record is inserted into table1 and fld2 is set to NULL
How can I modify my SQL statement to do this?
Thanks.
Dave
-- David S. April Syclo LLC (847) 842-0320 101 Lions Dr. - Suite 118 april_at_syclo.com Barrington, IL 60010 "Paradise is exactly like where you are right now, only much, much, better." - Laurie AndersonReceived on Wed Oct 08 1997 - 00:00:00 CDT