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!

insert with timestamp variable fails

_AZ_Aug 1 2017 — edited Aug 2 2017

this is going a bit hairy.

1. I'm running against the TimesTen database, which is somewhat different from regular Oracle db.

b. the "insert" statements with regular subs variables ( not TS) work fine.

c. the "insert" statements with TS as literal work fine too.

d. the "insert" with TS as a subs variable - do NOT:

create table test(ts timestamp, one unmber);

in cx_oracle:

cursor.execute("INSERT INTO test VALUES (TIMESTAMP ':ts',:one,2)", one=1, ts='2007-01-20 12:45:23' )

  cursor.execute("INSERT INTO test VALUES (TIMESTAMP ':ts',:one,2)", one=1, ts='2007-01-20 12:45:23' )

cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

cursor.execute("INSERT INTO test VALUES (TIMESTAMP '2007-01-20 12:45:23',:one,2)", one=1)

<no error>

the ultimate goal is to get either datetime.datetime.now() type or string passed to the "insert"

thank you

Message was edited by: _AZ_ syntax highlight

This post has been answered by Anthony Tuininga-Oracle on Aug 2 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2017
Added on Aug 1 2017
6 comments
5,145 views