Simple PL/SQL question about sequences

From: Jim Mc Ree <mcree_at_orionsci.com>
Date: 1996/11/15
Message-ID: <328CCC1D.79AA_at_orionsci.com>#1/1


I want to implement a PL/SQL function where I pass in the name of a sequence and get back the next value in the sequence. I am brand-new to Oracle and PL/SQL and haven't found a way to do this (that compiles) on my own, so I thought the net would have the answer. It seems like such a simple problem. Here's what I currently have:



CREATE OR REPLACE FUNCTION read_counter (counter_name in VARCHAR2) RETURN NUMBER IS
  counter NUMBER;

BEGIN   SELECT :counter_name.nextval INTO counter FROM dual;   RETURN (counter);

END;
/


The above function does not compile. What am I doing wrong in syntax or my approach?

Thank you for any help you can provide.

Jim. Received on Fri Nov 15 1996 - 00:00:00 CET

Original text of this message