create or replace function inuse_tb(author_in in VARCHAR2, year_in IN NUMBER) /* This function will take an author name and a year to find out what tiebreakers are already in use for that combination. Author name IS CASE SENSITIVE. If a tiebreaker is used multiple times for that combination, it will be shown multiple times. C. Fogelsong 10/01/2008 */ return varchar2 IS in_use VARCHAR2(4000); CURSOR tb_cur IS SELECT NVL(short_citation_tiebreaker, 'null') sctb FROM reference WHERE short_citation_author = author_in AND short_citation_year = year_in; BEGIN FOR tb IN tb_cur LOOP EXIT WHEN length(in_use) > 3994; in_use:= in_use||tb.sctb||', '; END LOOP; in_use:= RTRIM(in_use, ', '); RETURN(in_use); END; / GRANT EXECUTE ON INUSE_TB TO PUBLIC;