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 -> Re: SQL in Pl/SQL

Re: SQL in Pl/SQL

From: Ted Maas <ted.maas_at_us.landisstaefa.com>
Date: 1998/04/29
Message-ID: <01bd73b1$59cf37c0$3fe1ad0a@usbgrw7291.bgr.us.abatos.com>#1/1

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

Original text of this message

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