Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Evaluation of Logical expression
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
![]() |
![]() |