Domanda

I have this code:

        curs.callproc('add_command_pkg.add_command', [],
                      { 'command_id' : 7,
                        'session_id' : None,
                        'expiry_time' : 'sysdate + 7',
                        'config_id' : 6 })

When I run this, I get this error:

File "N:\app\MainWidget.py", line 453, in myFunc
curs.callproc('add_command_pkg.add_command', [], { 'command_id' : 7, 'session_id' : None, 'expiry _time' : 'sysdate + 7', 'config_id' : 6 })
cx_Oracle.DatabaseError: ORA-01858: a non-numeric character was found where a nu meric was expected ORA-06512: at line 1

What parameter am I passing in wrong and how do I fix it?

edit:

command signature:

                                        ( command_id   IN NUMBER,
                                          expiry_time  IN DATE,
                                          session_id   IN NUMBER DEFAULT NULL,
                                          config_id    IN NUMBER DEFAULT NULL
                                        );

Also, how do I commit this?

È stato utile?

Soluzione

You can't pass in the string 'sysdate + 7' for parameter expiry_time.

You could compose a datetime object or perhaps just change your procedure to accept a numeric "days offset" and add or subtract that from sysdate within the procedure itself.

For the committing, you can call commit on cx_Oracle's connection object.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top