Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL ?? - Insert from multiple tables

SQL ?? - Insert from multiple tables

From: Dina April <april_at_typhoon.xnet.com>
Date: 1997/10/08
Message-ID: <61gsnt$q6u$1@flood.xnet.com>#1/1

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 Anderson
Received on Wed Oct 08 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US