a little trouble passing values to Oracle using bind variables

Discussion in 'Python' started by Michael.Coll-Barth@VerizonWireless.com, May 17, 2005.

  1. Guest


    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.
    , May 17, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.