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: Oracle eval() function?

Re: Oracle eval() function?

From: Chris Weiss <chris_at_intralect.com>
Date: 2000/03/27
Message-ID: <k7RD4.6734$h01.49162@news1.rdc1.mi.home.com>#1/1

<thycotic_at_my-deja.com> wrote in message news:8bogpp$q84$1_at_nnrp1.deja.com...
> Does anybody know how to get Oracle to evaluate a string
> as an expression in PL/SQL?
> Something similar to the eval functions of VB, JavaScript and Perl.
> e.g. eval(" ")
> Not having to write a custom function would be preferable...
> TIA,
> J

You should read up on EXECUTE IMMEDIATE and SELECT <SOME EXPRESSSION> FROM DUAL; For example,

select 5+2*(3+200)/2 from dual;

Returns 208.

In a script you would use

EXECUTE IMMEDIATE 'SELECT '||<YOUR EXPRESSION> INTO <SOME VAR> FROM DUAL;

Chris
chris_at_intralect.com Received on Mon Mar 27 2000 - 00:00:00 CST

Original text of this message

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