Hi... I almost have my delete program working... but when I test it at the DB2> prompt or in a KSH with db2 -ao preceding the SQL commands, I get a message that cursor I declared is Read-Only or not positioned on a row(whether I use with hold or not).
The column w/UI is a date field, not time-stamp. Here's the query:
declare X1 cursor with hold for select col_with_UI from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1 for update of col_with_UI.
I've also tried:
declare X1 cursor for select col_with_UI from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1
And:
declare X1 cursor with hold for select col_with_index_from _same_table from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1 for update of select col_with_index_from _same_table
And when I do a fetch I get results plus sqlstate:00000
When I do the delete I get either sqlstate: 24504 or sqlstate: 24501.
Any ideas? Can I even get real results via the DB2> prompt or a KSH, or do I have to compile before I test it?
Just an FYI the delete statement is:
delete from HUGE_TABLE where current of X1
Thank you,
DrD123
The column w/UI is a date field, not time-stamp. Here's the query:
declare X1 cursor with hold for select col_with_UI from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1 for update of col_with_UI.
I've also tried:
declare X1 cursor for select col_with_UI from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1
And:
declare X1 cursor with hold for select col_with_index_from _same_table from HUGE_TABLE where days(CURRENT DATE) - days(col_with_UI)>:host_var1 for update of select col_with_index_from _same_table
And when I do a fetch I get results plus sqlstate:00000
When I do the delete I get either sqlstate: 24504 or sqlstate: 24501.
Any ideas? Can I even get real results via the DB2> prompt or a KSH, or do I have to compile before I test it?
Just an FYI the delete statement is:
delete from HUGE_TABLE where current of X1
Thank you,
DrD123