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: Call stored Function from SQL statement?

Re: Call stored Function from SQL statement?

From: Kenny Gump <kgump_at_mylanlabs.com>
Date: Mon, 18 Jan 1999 16:38:44 -0500
Message-ID: <36a3a9fd.0@news.mountain.net>


In the case of your function here Yes you can call it from SQL.

select sum_nums(1,5,7)
from dual;

or

select sum_nums(item_price1, item_price2, item_price3) from order_item_table;

the second example will return on answer for each row in the table.

There are a set of rules for a function to be included in a SQL statement. Basically it boils down to the function must be a single row function (not Group), it cannot do any DML and cannot call any procedure or function that breaks rule #1 or #2.

Kenny Gump
OCP 7.3 DBA



Adrian Harrison wrote in message <36a35f1b.24891512_at_news.globalnet.co.uk>...
>I have a stored function with several parameters - similar to below
>
>///////////////////////////////////////////////////////////////////////////
//////////////////////////

>CREATE OR REPLACE FUNCTION sum_nums (a IN NUMBER, b IN NUMBER, c IN NUMBER)
RETURN number
> IS
> BEGIN
> RETURN a+b+c;
> END;
>///////////////////////////////////////////////////////////////////////////
//////////////////////////

>
>Is it possible to call this from a SQL statement?
>
>Something like -
>
> select * from sum_nums (1,5,7);
>
>The parameters passed will be actual field values from a table?
>
>Any ideas
>
>thanks
>
>adrian harrison
>
Received on Mon Jan 18 1999 - 15:38:44 CST

Original text of this message

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