Opening a PL/SQL cursor as you tried is not allowed.
Native dynamic SQL (NDS) could be good choice for that thing:
p_var1 IN varchar2,
p_cur In OUT cur_type)
lvcSql :='OPEN p_cur FOR '||
'SELECT col1, col2 '||
'FROM table '||v_where ;
OPEN p_cur FOR lvcSql;
Thank you for replies.
To simflex: the procedure is the part of the packege, that's why it's written this way. cur_type is defined in package spec.
To ales: It's not compiled this way, we don't have NDS, it's Oracle 7.
Problem still exists...
Oh, I'm sorry I overlooked the version in title ...
In 7.3 is not possible to open PL/SQL cursor for dynamically built query. Try to redesign the proc, perhaps you could write more statically defined statements like "OPEN p_cur FOR SELECT ..." and put them into "IF-THEN-ELSIF-END IF".
Or, if you need create you query dynamically, just use ordinary dbms_sql cursor (lnCursor) instead of PL/SQL cursor. You can also pass it out of the proc and fetch from it.
Of course, it means more coding.