I've created a stored procedure where we want to determine the currval of a sequence. The sequence name self is not known in front, so it has to be passed to the procedure. This, off course, can be done by a IN parameter. But how can i use it within the stored procedure correctly in a SQL statement. Like "Select schema.sequencename.currval from dummy"
I've placed schema.sequencename in a parameter (with the name SEQ_NAME) and tried next:
SEQ_CURR := SEQ_NAME || '.CURRVAL';
SELECT :SEQ_CURR INTO CURR FROM DUMMY;
The schema and sequence name must be dynamic but it doesn't work. Who can give me the working trick?