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 8, ProC, Solaris 2.6 (Calling PL/SQL function)

Re: Oracle 8, ProC, Solaris 2.6 (Calling PL/SQL function)

From: Michael Krolewski <vandra_at_u.washington.edu>
Date: Tue, 14 Apr 1998 00:22:18 -0700
Message-ID: <35330EAA.6A62E63A@u.washington.edu>


For any procedure or function, one either has to embed it into another SQL statement
or create an anonymous PL/SQL block....

   char sqlStatement[] = "begin\n:outputVar := AddThis (:myX, :myY);\nend;";

   parse and execute with the appropriate variables....

Mike Krolewski

Mike Ryan wrote:

> If I have a function declared like
>
> create or replace function AddThis(x number,y number) return number
> as
> begin
> return x+y;
> end;
>
> Using SQL Plus I can call the function with
>
> Variable n number
> exec :n:=AddThis(1,2)
> print n
> 3
>
> How can I call this from a ProC program ?
> I can get the ProC to connect to Oracle, but when I try to call the
> function, I cant compile, I keep getting semantic errors.
>
> Help,
> Mike
> --------------------------------------------------------
> Mike Ryan,
> TNF Lab.,
> 416 SoftTown Aoyama,Jingumae, Tel: 81-3-5413-7235
> Shibuya,Tokyo. Fax: 81-3-5413-7236
> Japan.
Received on Tue Apr 14 1998 - 02:22:18 CDT

Original text of this message

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