[DB-SIG] reg Prepared Statment Error

Andy Todd andy47 at halfcooked.com
Mon Feb 13 12:04:57 CET 2006


python eager wrote:
> Hi,
>  
> i am using prepared statment.While passing the value i am getting the 
> following error
>  
> DatabaseError: ORA-01036: illegal variable name/number
>  
> _Code Snippet :_
> a=cursor.prepare("DELETE FROM PERSONALDETAILS WHERE PID =?")
> cursor.execute(a,(id))
>  
> Please rectify the error
>  
> regards
> Python Eager

You don't need a prepared statement. Oracle and cx_Oracle will take of 
this for you. Refer to my previous answer to your questions, the 
archives of this mailing list are available at 
http://mail.python.org/pipermail/db-sig/

Your session should be something like;

 >>> a = cursor.execute("DELETE FROM personaldetails WHERE pid = :pid", 
{"pid": id})

Or even;

 >>> a = cursor.execute("DELETE FROM personaldetails WHERE pid = :pid", 
(id,))

Please try different combinations in an interactive session because this 
is the best way to find out what works and what doesn't.

Regards,
Andy
-- 
--------------------------------------------------------------------------------
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/


More information about the DB-SIG mailing list