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

Home -> Community -> Usenet -> c.d.o.server -> Re: Evaluation of Logical expression

Re: Evaluation of Logical expression

From: Vince <vinnyop_at_yahoo.com>
Date: 11 Apr 2007 16:14:08 -0700
Message-ID: <1176333248.359977.284080@w1g2000hsg.googlegroups.com>


On Apr 11, 7:28 am, Богомол Александр Анатольевич <bogo..._at_investbank.ru> wrote:
> Replace 'C' logic characters '&&', '||' with 'AND' ,'OR'
> Then use 'execute immediate' statement.
> Example:
>
> C_logical_expression:= '(1>0) && (2>6)'
> logical_expression:=
> replace(replace(C_logical_expression,'&&','AND'),'&&','OR')
>
> execute immediate
> 'select nvl(max(1),0)
> from dual where
> '|| logical_expression
> into tmpn ;
>
> if tmpn = 1 then
> successful!!!!
> end if;
>
> Alexander
>
>
>
> -----Original Message-----
> From: Sadashiva [mailto:a..._at_b.c]
>
> Posted At: Wednesday, April 11, 2007 3:13 PM
> Posted To: server
> Conversation: Evaluation of Logical expression
> Subject: Evaluation of Logical expression
>
> Hello,
>
> I need to evaluate a logical expression (for e.g..: '(1>0) && (2>6)' )
> stored as varchar in one of my tables. The logical expression is of
> standard
> 'C' language syntax.
> Is there any standard function available in Oracle?
> Has anyone implemented any such logic?
>
> Thanks,
> Sadashiva- Hide quoted text -
>
> - Show quoted text -

if you execute these statements often/and or and they have the same type of check, you may want to consider using bind variables intead of the values themselves:

table data: (:daysPastDue > 0 ) or (:alertSent = 1 )

execute immediate

   'select nvl(max(1),0)

           from dual where
      '|| logical_expression
     into  tmpn using :bindvariable1, :bindvariable2;
Received on Wed Apr 11 2007 - 18:14:08 CDT

Original text of this message

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