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: C (embedded SQL) : receive boolean out-parameter of a stored procedure

Re: C (embedded SQL) : receive boolean out-parameter of a stored procedure

From: Kevin Brand <kevin.brandx_at_tel.gte.com>
Date: Thu, 4 Oct 2001 16:14:48 -0500
Message-ID: <9pijbr$rcm$1@news.gte.com>

You could wrap your function with some PL in the anonymous block and convert the returned boolean to an int like this...

Assuming your function looks like this:

    function myfunc return boolean

Then your PRO/C code looks like this:

int mybool;
...
EXEC SQL EXECUTE
    DECLARE
        local_mybool boolean;
    BEGIN

        local_mybool := schemaname.myfunc;
        if ( local_mybool = TRUE ) then
            :mybool :=1;
        else
            :mybool :=0;
        end if;

    END;
END-EXEC; Now the local integer has either a zero or a one.

Hth,

-Kevin

"bernhard labus" <bernhard.labus_at_home.ins.de> wrote in message news:3bbc6084$0$231$4d4ebb8e_at_businessnews.de.uu.net...
> Hallo,
>
> does anybody know, how to handle this:
>
> - given:
> a stored procedure with out parameter boolean or
> function return boolean, e.g.
> procedure bool_bla (out_bool out boolean) or function bool_bla return
> boolean ..
>
> - wanted:
> call the procedure/function in C (embedded sql), e.g.
> exec sql execute
> begin
> :mybool := bool_bla; or bool_bla(:mybool);
> end;
> end-exec;
>
> - needed:
> ? How declare "mybool", the C-variable to hold the boolean value?
> returned from the stored procedure
> Server-System is Oracle-RDBMS 7.3.4, Pro*C 2.2.4.0.0
>
> Have browsed through oracle-technet and dejanews, found nothing,
> except (funny) example with function "sal_ok" return boolean,
> created from C, but no call/execute explained.
>
> Thanx, Bernhard
>
>
Received on Thu Oct 04 2001 - 16:14:48 CDT

Original text of this message

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