Re: SQLPLUS Oracle 8i query

From: <vernalGreens_at_gmail.com>
Date: 20 Jul 2006 00:22:54 -0700
Message-ID: <1153380174.403651.5820_at_s13g2000cwa.googlegroups.com>


select * from tablename
where
country = 'abc'
if _at_userEnteredParameter = 'pqr' then

    and city = 'xyz'
end if

[Quoted] If a user selected pqr from a dropdown on the webpage, only then I want the city statement to run.

How can I achieve this in SQLPLUS (I think the syntax in the above query is incorrect). I'm using oracle 8i. Can I use conditional if in SQLPLUS? Cris Carampa wrote:
> vernalGreens_at_gmail.com wrote:
>
> > I want to modify the query so that "and city = 'xyz'" run only when
> > region = pqr.
>
> You can do that with plain SQL, there's no need for procedural
> constructs here.
>
> It's not clear what you want to do with rows with region!='pqr'. I
> assumed you wish to select all of them. Then:
>
> select * from tablename
> where
> country = 'abc' and
> (
> (region='pqr' and city='xyz')
> or
> (region!='pqr')
> )
>
> Kind regards,
>
> --
> Cris Carampa (spamto:cris119_at_operamail.com)
> when they kick at your front door | how you gonna come ?
> with your hands on your head | or on the trigger of your gun ?
Received on Thu Jul 20 2006 - 09:22:54 CEST

Original text of this message