Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Oracle Sequence UserFx issue
I have created a small sequence (submeter_seq) that I would like to call for
the NEXTVAL through a function. The plan is to pass in a string of the table
name, and then through a DECODE statement call the proper Oracle sequence for
the passed table and return a new primary key value.
Everything I have tried cannot make this function work when called as: SELECT get_next_key ('tablename') from Dual;
I consistantly receive the message:
SELECT GET_NEXT_KEY ('submeter') from DUAL
*
ORA-00902: invalid datatype
Any insight into this situation would certainly be appreciated!
Thank you,
Daniel
RETURN INT IS next_key INT; BEGIN SELECT DECODE(for_table, 'submeter', submeter_seq.CURRVAL) INTO NEXT_KEY FROM DUAL; RETURN (next_key); END;
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Tue May 05 1998 - 16:00:15 CDT