Обсуждение: PLPGSQL function schema or table parameter
Is it possible to pass a table name and/or schema name to a plpgsql function? How can I use them in the code? Which Types to use for each of the parameters? E.g. create or replace function MyTest (mySchema WhichType?, myTable WhichType?) returns integer as ' declare result integer; Begin select id into result from mySchema.myTable where... return result; End; ' language plpgsql; Sorry if this issue has already been addressed before but I can't find any objective comments on this. Thanks. sidnei
am 05.09.2005, um 14:26:31 -0300 mailte Sidnei de Souza folgendes: > Is it possible to pass a table name and/or schema name to a plpgsql > function? Yes. > How can I use them in the code? Which Types to use for each of the > parameters? varchar. > > E.g. > > create or replace function MyTest (mySchema WhichType?, myTable WhichType?) varchar, varchar. (possibly other char-types like char(n)) Read http://www.postgresql.org/docs/8.0/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN Regards, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===