Temp Table In SQL Function

Поиск
Список
Период
Сортировка
От
Тема Temp Table In SQL Function
Дата
Msg-id 200109080348.31c5@lh00.opsion.fr
обсуждение исходный текст
Список pgsql-general
Hello!

I am trying to create a sql function that returns 2
values using temporary table as the "media":

database1=# CREATE FUNCTION SaveNumeric(int2,int2)
RETURNS INTEGER AS '
database1'#  CREATE TEMP TABLE mytemp(a int2,b int2);
database1'#  INSERT INTO mytemp VALUES ($1+1,$2+100);
database1'#  SELECT 1;
database1'# ' LANGUAGE 'sql';
ERROR:  Relation 'mytemp' does not exist

But below seems to work:

database1=# CREATE FUNCTION Drop2Numeric() RETURNS
INTEGER AS '
database1'#  DROP TABLE mytemp;
database1'#  SELECT 1;
database1'# ' LANGUAGE 'sql';
CREATE

Why the creation of SaveNumeric(int2,int2) fails
while the creation of Drop2Numeric() succeeds?

Regards,

CN

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com






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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: recursive text construction in plpgsql?
Следующее
От: caldodge@fpcc.net (Calvin Dodge)
Дата:
Сообщение: Re: Problem w/ dumping huge table and no disk space