Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Oratcl

4 views
Skip to first unread message

manfre...@zf-lenksysteme.com

unread,
Dec 5, 2005, 10:17:05 AM12/5/05
to
Greetings to all out there,
Is there a possibility to access the return value of a Oracle stored
function?
"part_state" is a function taking two arguments and returning a numeric
value.
I use Oratcl 3.3 (compatibility issues), but the question also applies
to 4.3.

I can do:
...
orasql $cursor \
"call part_state( :identnumber, :machine) into :state" \
-parseonly
orabinexec $cursor :identnumber 123456 :machine 000050 :state ""
...
or:
...
set plsql {BEGIN
:state := part_state( :identnumber, :machine);
END;
}
oraplexec $cursor $plsql :state "" :identnumber 123456 :machine 000050
...
perfectly well (the function works as supposed).

However, I did not find a way out for the result value (bind variable
:state), which should end up in a Tcl variable ...

Best regards
Manfred Frey

thel...@gmail.com

unread,
Dec 5, 2005, 6:53:44 PM12/5/05
to
Hi Manfred, yes there is an easy way to do this.

In Oratcl 4.3 you would do it this way.

set plsql {BEGIN
:state := part_state( :identnumber, :machine);
END;
}

set lda [oralogon ... ]
set cur [oraopen $lda]
oraparse $cur $plsql
orabind $cur :state "" :identnumber 123456 :machine 000050
oraexec $cur

if ([orafetch $cur -dataarray params] == 0]} {
puts $params(:state)
}

oraclose $cur
oralogoff $lda


To be honest Manfred I have not used Oratcl 3.3 in so long that I don't
remember the exact syntax, But I do remember that you need an orafetch
.

but it will probably be something like this:

orafetch $cursor {puts @1}

-Todd

manfre...@zf-lenksysteme.com

unread,
Dec 7, 2005, 6:48:58 AM12/7/05
to
Hi Todd,
I got it working now with both Versions of Oratcl (3.3 and 4.3).
Thank you
Manfred

thel...@gmail.com

unread,
Dec 7, 2005, 7:51:12 AM12/7/05
to
Glad to hear it. Good luck.

0 new messages