SQL IN statement on oracle via python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaf3773
    New Member
    • Jan 2012
    • 20

    SQL IN statement on oracle via python

    I need help trying to execute this SQL statement on an oracle database via python.

    select switch,switch|| '-'||tkg_name as tkg_name,(date_ time - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400)as date_time,perce nt_occupied from Table_name where tkg_name in ('AB65UT','LIY8 70','IUY890') and
    trunc(date_time ) between '21-DEC-11' and '27-DEC-11';

    I also like to know how to escape the single quotes in the SQL statement.
    This SQL statement runs perfectly in Oracle SQL Developer

    I already got the connection to the database working and can run simple SQL scripts on it.

    Help will be very much appreciated.

    i found a way of doing this by
    cur.execute(""" select ....""")


    Kaf
Working...