Hi all!
It is necessary for delete where current of cursor, but name of underlied
table is not known beforehand.
My cursor is defined as DECLARE MYCUR CURSOR FOR STMT.
STMT is prepared dynamically in program logic.
I can not use DELETE FROM TABLENAME WHERE CURRENT OF MYCUR because
tablename
is not known beforehand.
I can not form delete statement dynamically too because cursor is not
defined in scope of this statement.

For example, see pseudocode please:

declare MYCUR cursor for stmt;
...
set tablename='MYTABLE';
...
set :sqlstmt = 'select .. from ' || tablename || 'for update';
set :delstmt= 'delete from '|| tablename || 'where current of MYCUR';

prepare stmt from :sqlstmt;

open MYCUR;
...
fetch from MYCUR into ...;
...
execute immediate :delstmt;


----------------------------------------------------------------------------
When execute immediate I receive error:
SQL0504N The cursor "MYCUR" is not defined. SQLSTATE=34000


What can I do instead?
I do not want delete by condition - it is slowly even by key!


Alexey Kasyanov