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

Amit Saxena amitsaxena69 at gmail.com
Mon Jul 30 15:28:20 CEST 2007


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




On 7/30/07, Greg Lindstrom <gslindstrom at gmail.com> wrote:
>
> My Oracle connection is set up using the adodb module (
> http://adodb.sourceforge.net/).  I don't remember why we set it up that
> way...we haven't touched this part of our code for almost 2 years!.
>
> from cx_Oracle import makedsn
> import adodb
>
> db = adodb.NewADOConnection('oci8')
> connection_string = makedsn(ip, port, database)   <== your values here, of
> course
> db.Connect(connection _string, username, password)  <== and here, too
>
> query = "SELECT name_of_pgSQL_routine(%(argument1)s, %(argument2)s)"
> results = db.execute(query, locals())
>
> and go from there.  Let me know if yo have other questions.
>
> HTH,
>
> --greg
>
>
>


-- 
Thanks and Regards,
Amit Saxena
Senior QA Engineer
Ketera
Direct: +91 4199 5028
Mobile: +91 99001 18641
asaxena at ketera.com

» Visit us at http://www.ketera.com
» Watch the demo at http://www.ketera.com/resources/demos.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070730/c1d4ed45/attachment.html 


More information about the Tutor mailing list