Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Evaluation of Logical expression
On Apr 11, 6:28 pm, Богомол Александр Анатольевич
<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
Please refrain from top-posting. Also, you could get away with simple COUNT() instead of NVL(MAX(1),0)... :)
Regards,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Received on Wed Apr 11 2007 - 11:44:49 CDT
![]() |
![]() |