Re: plpgsql ?

Поиск
Список
Период
Сортировка
От Kovacs Zoltan Sandor
Тема Re: plpgsql ?
Дата
Msg-id Pine.LNX.4.05.10012202147060.29810-100000@pc10.radnoti-szeged.sulinet.hu
обсуждение исходный текст
Ответ на plpgsql ?  ("guard" <guard@ficnet.net>)
Список pgsql-sql
> CREATE FUNCTION autono (text,text) RETURNS text AS '
>   DECLARE
>     a1 ALIAS FOR $1;
>     a2 ALIAS FOR $1;
>     ret_val text;
>   BEGIN
>     select tna  into ret_val from a1  where pamt_no=a2;
> 
>   RETURN ret_val;
> END;' LANGUAGE 'plpgsql'
> 
> 
> error run  "   select tna  into ret_val from a1  where pamt_no=a2;    "
You cannot give a table name as an argument. You should write different
SELECTs for different tables, like this:

if a1 = ''dummy1'' then select tna into ret_val from dummy1 where
pamt_no=a2; end if;

if a1 = ''dummy2'' then select tna into ret_val from dummy2 where
pamt_no=a2; end if;

...

And so on. Unfortunately... :-)

Zoltan




В списке pgsql-sql по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: how to alter/drop check contraint?
Следующее
От: Sandis Jerics
Дата:
Сообщение: sorting the text values as integers