[Python] cx_Oracle returned value as variable

Discussão em 'Python' iniciado por Stack, Abril 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am running following code -

    cuidsql = "SELECT CUST_ID FROM XXCUST_HIER_DATA WHERE CUST_NAME = "+"'"+str(cust_name)+"' AND END_DATE IS NULL"

    cursor.execute(cuidsql)
    custIdVal = cursor.var(int)
    print(custIdVal)


    I am expecting output as number which is customer ID. But the output I am getting is - <cx_Oracle.Var of type DB_TYPE_NUMBER with value None>

    When I run the same SQL for a customer I am getting output as 2339. How can I get this and assign this value to custIdVal?

    Continue reading...

Compartilhe esta Página