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

Home -> Community -> Usenet -> c.d.o.misc -> Re: calling stored function from sql

Re: calling stored function from sql

From: Gary O'Keefe <gary_at_onegoodidea.com>
Date: Thu, 19 Aug 1999 14:11:01 GMT
Message-ID: <37bc0a98.19468578@news.hydro.co.uk>


A keyboard was whacked upside igor_at_easynet.co.uk's head and out came:

>Hi folks,
>
>I've got a stored PL/SQL function which writes to multiple tables. Can
>I call it from SQL? All the documentation I've found suggests that I
>can't (unless wrapping it in a stored package and not defining PRAGMA
>RESTRICT_REFERENCES would work - but I'd guess that may be fatally
>dim). If I can't, what's the mistake I'm making in my basic approach?

Over-elaboration. The pseudo-table 'dual' exists for just such a purpose.

SQL> create or replace function twiceasmuch(half in number) return number is
  2 begin
  3 return(half * 2);
  4 end;
  5 /

Function created.

SQL> select twiceasmuch(2)
  2 from dual
  3 /

TWICEASMUCH(2)


             4

SQL> Hope this helps

Gary
--
Gary O'Keefe
gary_at_onegoodidea.com

You know the score - my current employer has nothing to do with what I post Received on Thu Aug 19 1999 - 09:11:01 CDT

Original text of this message

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