calling Oracle functions
Anthony Tuininga
anthony at computronix.com
Fri Sep 13 12:55:21 EDT 2002
On Fri, 2002-09-13 at 10:22, Дамјан Г. wrote:
>
> > Oracle differentiates between functions and procedures so you must
> > identify that you are calling a function, not a procedure. The DB API
> > does not allow for this, so you must use an anonymous PL/SQL block and
> > some non DB API code. The way to do this is as follows:
>
> ok. I also tried that, I mean a PL/SQL block... but
>
> > Replace the data types as appropriate.
>
> > v_Vars = v_Cursor.setinputsizes(p_Result = cx_Oracle.NUMBER)
>
> didn't know about this :)) thanks.
You're welcome.
> ...
> > If anyone has suggestions about how to improve this, fire away... :-)
>
> yes, put it in the documentation.
> Actually is there any documentation about cx_Oracle, past the README
> file?
Bits and pieces in a variety of places. The assumption (to date) has
been that the DB API is sufficient for almost everything and that you
really shouldn't use extensions.... :-) However, over the couple of
years that I have been using the DB API I have discovered a fair number
of deficiencies with respect to Oracle, in particular when it comes to
performance and quirks of Oracle. It hasn't been a problem for me since
I wrote cx_Oracle, but it has been my desire to consolidate the DB API
document with descriptions of the extensions used by cx_Oracle -- I hope
to do something about this in the next month or so.
> Now a simpler question:
> is it possible to specify the data source name directly not through
> the alias defined in tnsnames.ora. In perl DBD I can specify a
> connection string like cs = "dbi:Oracle:host=1.10.100.200;sid=TEST"?
cx_Oracle is passing the string directly to Oracle, so whatever it
accepts, cx_Oracle will accept. Specifically, you can take the entire
string that is in your tnsnames.ora file and pass it directly as in
v_TNS =
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=opus)(PORT=1521)))(CONNECT_DATA=(SID=DEV)))
v_Connection = cx_Oracle.connect("user", "pw", v_TNS)
and that works just fine. Does that answer your question?
--
Anthony Tuininga
anthony at computronix.com
Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
http://www.computronix.com
More information about the Python-list
mailing list