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: Passing a parameter to a Where Clause in PL/SQL !

Re: Passing a parameter to a Where Clause in PL/SQL !

From: Giovanni Bronzini <mc2256_at_mclink.it>
Date: Mon, 10 Dec 2001 00:19:44 +0100
Message-ID: <9v0rjf$6na$1@newsreader1.mclink.it>


If it's possiblo to identify a "dummy" value (ie: a value which is impossible for that field, for instance "Age=-1" ...) you could consider simply the following:
nvl(d_column,<dummy_value>) = nvl(ai_str3, <dummy_value>)

It's a bit "unconventinal" I know, and it may cause problems when extending the possible values to include the dummy value. Taken out this situation it works.

Giovanni Bronzini

"Jim Kennedy" <kennedy-family_at_attbi.com> ha scritto nel messaggio news:jmtQ7.17754$ER5.271247_at_rwcrnsc52...
> Have 2 queries and pick the one that you need. If it is null then use the
> query that does not specify the d_column otherwise use the other.
> Jim
> "Kavous Niamir" <KNiamir_at_home.com> wrote in message
> news:9SsQ7.31288$KT.7701303_at_news4.rdc1.on.home.com...
> > You will have to excuse me if this sounds a bit elementary, but I'm new
to
> > this stuff and have to find out ASAP. I have a VB application that
passes
> > several parameters to a PL/SQL package. These are used in a WHERE
clauses
> of
> > a SQL query. For example :
> >
> > Select a_column
> > from a_table
> > where b_column = ai_str1
> > and c.column = ai_str2
> > and d.column = ai_str3 -- the line I'm having problem with
> >
> > Now my problem is that a user can either send a string for ai_str3 or a
> null
> > value. How can I structure the query such that if the user sends a null
> > value, the third condition would be simply ignored.. I have been
thinking
> > along the lines of having :
> >
> > d_column = nvl(ai_str3, d_column)
> >
> > Would that work or what do you think I should do?
> >
> > Regards, Kavous
> >
> >
> >
> >
>
>
Received on Sun Dec 09 2001 - 17:19:44 CST

Original text of this message

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