Forum Stats

  • 3,760,320 Users
  • 2,251,685 Discussions
  • 7,871,059 Comments

Discussions

How to return VARCHAR2 back to Python

epipko
epipko Member Posts: 101 Blue Ribbon
edited Aug 12, 2020 6:59PM in Python

Two part question here:

1. I need to assign VARCHAR2 datatype to return value. As it is right now, I am getting AttributeError: module 'cx_Oracle' has no attribute 'VARCHAR2'

2. Does my query look like it's going to work?

            line_item_sku = 'Axt56_XT_87'            div = cur.var(cx_Oracle.VARCHAR2)            sql = ("""  SELECT div                        FROM div_lookup                        WHERE fix = :x, x=substr('line_item_sku',1,1)                    """)            cur.execute(sql)            div, = cur.fetchone()            print (div)

Best Answer

Answers