[Tutor] How can I execute a PL/SQL Procedure directly through

Greg Lindstrom gslindstrom at gmail.com
Mon Jul 30 15:34:48 CEST 2007


On 7/30/07, Amit Saxena <amitsaxena69 at gmail.com> wrote:
>
>
> I m still not able to run a Procedure
>
> from cx_Oracle import makedsn
> import adodb
>
> db = adodb.NewADOConnection('oci8')
> connection_string = makedsn("10.200.91.27 ", 1521, "scorpio")   #<== your
> values here, of course
> db.Connect(connection_string, "kcmdev", "devkcm")  #<== and here, too
>
> #query = "SELECT * from USER_ROLE where ROLE_FK = 29"
> results = db.Execute("metadata.sql")
> print results
>
>
> is giving an error saying
>
> Traceback (most recent call last):
>   File "D:/Python/sql.py", line 9, in <module>
>     results = db.Execute("metadata.sql")
>   File "C:\Python25\Lib\site-packages\adodb\adodb.py", line 274, in
> Execute
>     c = self._query(sql,params)
>   File "C:\Python25\Lib\site-packages\adodb\adodb.py", line 265, in _query
>
>     raise sys.exc_info()[0] ,str(err)+': '+sql
> DatabaseError: ORA-00900: invalid SQL statement
> : metadata.sql
>

What is in metadata.sql?  If it is a PL/SQL query, then you should "SELECT
metadata()".  If is a file containing sql (is the pl/sql you wish to execute
in this file?) then I'm not sure how to proceed.

Is the PL/SQL you wish to run saved in Oracle?  Can you show us what's in
the metadata.sql file?

--greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070730/2ee34b1f/attachment.htm 


More information about the Tutor mailing list