Stored Procedures - Variable Tables?
Posted in 1997
Folks --
This may have been answered, but I couldn't find it in the
archives.
ODS 7.23 on AIX 4.1.5
Can I use a variable to represent a table name? We're using
Peoplesoft, and many of those tables have effective dates. We'd
like to be able to use the same stored procedure for all the tables.
My gut reaction is no, and so far we haven't found a way to
make it work, but can we do something like:
CREATE PROCEDURE efflookup( fromtbl varchar(15), p_effdt date )
RETURNING date;DEFINE p_date date;
SELECT max(effdt) INTO p_date
FROM fromtbl
WHERE p_effdt >= effdt;
RETURN p_date;
END PROCEDURE
--
Vic Goldberg
Manager, Database Administration Team
Cornell Information Technologies
(607) 254-7441 (voice) (607) 255-6982 (fax)