[DB-SIG] a little trouble passing values to Oracle using bind variables

Michael.Coll-Barth@VerizonWireless.com Michael.Coll-Barth at VerizonWireless.com
Tue May 17 15:13:37 CEST 2005


As the subject line says, I am having some trouble passing bind variables to
Oracle.  When I pass a printable string value, such as 'NM', I get data.
When I try to pass a non-printable character, such as 'return' - chr(13), I
get no data back.  I can't simply make NactionCode = chr(13), as python
would change the value of NactionCode to '\r' and Oracle sees this as a two
byte character, and not chr(13).  I have looked into how Oracle might accept
something like '\x00' for chr(0), but to no avail.  

Any thoughts?


def goGetIt( NactivityDt, NactionCode ):

    dataQuery = '''select a, b, c
                   from %s 
                   where activityDt      = :NactivityDt
                     and actionCode      = :NactionCode
                   order by %s
                ''' % ( schema.tableName )

    dbm.cursor.execute(dataQuery, NactivityDt = activityDt, NactionCode =
actionCode )
    result = dbm.cursor.fetchall()

    return result

NactivityDt = '12-apr-2005'
NactionCode = 'NM'
act1 = goGetIt( NactivityDt, NactionCode )

NactivityDt = '12-apr-2005'
NactionCode = 'chr(13)'
act2 = goGetIt( NactivityDt, NactionCode )

NactivityDt = '12-apr-2005'
NactionCode = chr(13)
act3 = goGetIt( NactivityDt, NactionCode )
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.

More information about the DB-SIG mailing list