Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL in Pl/SQL
Mark Aengenheyster <"'no spam loser' aengenhm"@rspa.dot.gov> wrote in
article
> SELECT ADID INTO V_ADID FROM OP_ADDRESS
> WHERE CITY = V_CITY
> AND STATE = V_STATE;
> ...
> How do I right the SQL so that it will return a row if the value is NULL
> and if it is not NULL ( = 'something')?
> ...
Mark,
I think you may need to do an "outer join" i.e.:
" ... outer joins include all of the records from the first (left) of two
tables,
even if there are no matching values for records in the second (right)
table."
This is usually done when SELECTing from two tables but it may (should?)
work with just one table. I beleive the proper syntax would be to place
a plus on the side of join that is to always be copied. Since my stuff
never
seems to work the first time BE SURE to try it both ways!
SELECT ADID INTO V_ADID FROM OP_ADDRESS
WHERE CITY (+) = V_CITY
AND STATE (+) = V_STATE
Good luck!
Ted
-- 186,282 miles per second isn't just a good idea ... it's the LAW! These comments do not necessarily reflect the views of Landis & Staefa, Inc.Received on Wed Apr 29 1998 - 00:00:00 CDT