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: Nuno Guerreiro <nuno-v-guerreiro_at_invalid.telecom.pt>
Date: Mon, 18 Jan 1999 17:06:08 GMT
Message-ID: <36a36999.542439707@news.telecom.pt>


On Mon, 18 Jan 1999 16:24:35 GMT, adrianh_at_globalnet.co.uk (Adrian Harrison) wrote:

>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
>

Well, not exactly.

If you have table T1 with fields f1, f2, f3, then you can do the following:

select sum_nums(f1, f2, f3) from T1;

You'll get the sum of the 3 fields for each row.

Hope this helps,

Nuno Guerreiro



As I don't normally appreciate unsolicited commercial e-mail (widely known as SPAM), I encoded my e-mail address. If you want to reply by e-mail, please remove the text added to fool spam software

"The art of arts, the glory of expression and the sunshine that lights the light of letters  is simplicity"

                                                        Walt Whitman Received on Mon Jan 18 1999 - 11:06:08 CST

Original text of this message

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