create cx_Oracle arrayvar for DATETIME
سؤال
I want to create a cx_Oracle arrayvar for datetime, wihch I can then use to feed callproc. So the code I expect is something like this:
dt1 = datetime.datetime.strptime('2012/07/30 10:42:09', '%Y/%m/%d %H:%M:%S')
dt2 = ...(another datetime value)...
av1 = cursor.arrayvar(cx_Oracle.DATETIME, [dt1, dt2])
av2 = ...(another arrayvar)...
cursor.callproc('my_db_procedure', (av1, av2))
However I keep getting this error:
PLS-00306: wrong number or types of arguments in call to 'my_db_procedure'
Can someone point out what I was doing wrong?
المحلول
OK, finally I found out what was wrong. In my PL/SQL code I defined the input parameter type as:
TYPE id IS TABLE OF varchar2(16);
which should actually be:
TYPE id IS TABLE OF varchar2(16) INDEX BY BINARY_INTEGER;
I hope this could help someone with similar issue.
لا تنتمي إلى StackOverflow