Path: news.f.de.plusline.net!news-fra1.dfn.de!news-nue1.dfn.de!news-stu1.dfn.de!news.germany.com!postnews.google.com!w1g2000hsg.googlegroups.com!not-for-mail
From: "Vince" <vinnyop@yahoo.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: Evaluation of Logical expression
Date: 11 Apr 2007 16:14:08 -0700
Organization: http://groups.google.com
Lines: 59
Message-ID: <1176333248.359977.284080@w1g2000hsg.googlegroups.com>
References: <eviio3$k0f$1@news4.fe.internet.bosch.com>
   <4703C546C994704E953AD8C47CA12CF751CCB3@ns.investbank.ru>
NNTP-Posting-Host: 198.31.83.50
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1176333248 10509 127.0.0.1 (11 Apr 2007 23:14:08 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 11 Apr 2007 23:14:08 +0000 (UTC)
In-Reply-To: <4703C546C994704E953AD8C47CA12CF751CCB3@ns.investbank.ru>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: w1g2000hsg.googlegroups.com; posting-host=198.31.83.50;
   posting-account=oOaxRAwAAABpgk-tSFyXemtXGYGcaZ1v
Xref: news.f.de.plusline.net comp.databases.oracle.server:196249

On Apr 11, 7:28 am, =E2=CF=C7=CF=CD=CF=CC =E1=CC=C5=CB=D3=C1=CE=C4=D2 =E1=
=CE=C1=D4=CF=CC=D8=C5=D7=C9=DE
<bogo...@investbank.ru> wrote:
> Replace 'C' logic characters '&&', '||' with  'AND' ,'OR'
> Then use 'execute immediate' statement.
> Example:
>
> C_logical_expression:=3D '(1>0) && (2>6)'
> logical_expression:=3D
> replace(replace(C_logical_expression,'&&','AND'),'&&','OR')
>
> execute immediate
>    'select nvl(max(1),0)
>          from dual where
>     '|| logical_expression
>    into  tmpn ;
>
> if tmpn =3D 1 then
>   successful!!!!
> end if;
>
> Alexander
>
>
>
> -----Original Message-----
> From: Sadashiva [mailto:a...@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 =3D 1 )

execute immediate
   'select nvl(max(1),0)
           from dual where
      '|| logical_expression
     into  tmpn using :bindvariable1, :bindvariable2;

