Quantcast
Viewing all articles
Browse latest Browse all 8968

how to pass a sequence name to a stored procedure?

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?


Viewing all articles
Browse latest Browse all 8968

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>