3

I am trying to insert data into an Oracle database, while in the process I am getting this error cx_Oracle.NotSupportedError: Python value of type tuple not supported.

Script I am using

curs.execute('insert into APP(APP_CODE,APP_NAME,PARENT_APP_CODE,INSERT_DTTM,INSERT_USER,UPDATE_DTTM,UPDATE_USER,IDFED_PROVIDER_ID,IDFED_SAML_GTWY_URL,TEMPLATE_FTL,USER_ACCTS_FLAG,XML_DATA_FLAG,CAPS_REQUIRED,SESSIONID_REQUIRED) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)'',row_data)

DB Schema

(APP_CODE VARCHAR2(50 BYTE) NOT NULL 
, APP_NAME VARCHAR2(80 BYTE) NOT NULL 
, PARENT_APP_CODE VARCHAR2(20 BYTE) 
, INSERT_DTTM TIMESTAMP(6) DEFAULT SYSDATE NOT NULL 
, INSERT_USER VARCHAR2(150 BYTE) DEFAULT USER NOT NULL 
, UPDATE_DTTM TIMESTAMP(6) DEFAULT SYSDATE NOT NULL 
, UPDATE_USER VARCHAR2(150 BYTE) DEFAULT USER NOT NULL 
, IDFED_PROVIDER_ID VARCHAR2(1000 BYTE) 
, IDFED_SAML_GTWY_URL VARCHAR2(2000 BYTE) 
, TEMPLATE_FTL CLOB 
, USER_ACCTS_FLAG VARCHAR2(30 BYTE) 
, XML_DATA_FLAG VARCHAR2(30 BYTE) 
, CAPS_REQUIRED VARCHAR2(1 BYTE) DEFAULT 'N' 
, SESSIONID_REQUIRED VARCHAR2(1 BYTE) DEFAULT 'N')

can anyone please help me?

4
  • Please print row_data and check if any item is a tuple. Commented Nov 18, 2019 at 7:40
  • row_data I am using currently : row_data = [("appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y")] Commented Nov 18, 2019 at 8:15
  • You have a list with only one entry: a tuple. Now execute tries to fill in the whole tuple to parameter :1. Get rid of the list and use the tuple only or vice versa. Commented Nov 18, 2019 at 8:53
  • 1
    You can use row_data[0]. row_data should be a list or tuple of elements where individual element can not be a tuple/list itself. Commented Nov 18, 2019 at 8:56

1 Answer 1

2

I am using currently:

row_data = [("appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y")]

row_data is a list containing a tuple of 14 items. curs.execute is assigning the first element of the list to :1; however, that first element is the tuple which causes the error to be thrown.

As mentioned by @Matthias you should remove either the [] list or the () tuple:

row_data = ("appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y")

or

row_data = ["appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.