Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to return VARCHAR2 back to Python

epipkoAug 11 2020 — edited Aug 12 2020

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)

This post has been answered by Christopher Jones-Oracle on Aug 11 2020
Jump to Answer

Comments

Post Details

Added on Aug 11 2020
1 comment
774 views