Re: Function problem

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Function problem
Дата
Msg-id web-830646@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Function problem  ("Patrick Hatcher" <PHatcher@macys.com>)
Список pgsql-novice
Partick,

> Ahhhhhhhh.  Thank you Josh.  I just learned something new.  I've been
>  doing
> it this way in MS SQL for years.

Different Procedural SQL implementation, different syntax.

Transact-SQL:
variable assignment:
SELECT @fig=col1, @mike=col2
FROM table1 WHERE col3 = 'a'
temp table creation:
SELECT col1, col2 INTO temp_1
FROM table1 WHRE col3 = 'a'

PL/pgSQL:
variable assignment:
SELECT col1, col2 INTO v_fig, v_mike
FROM table1 WHERE col3='a';
temp table creation
CREATE TEMPORARY TABLE temp_1 AS
SELECT col1, col2 FROM table1
WHERE col3='a';

BTW, in either language you want to minimize your creation of temporary
 tables in procedures -- they are much slower than variables or even
 very complex queries.

-Josh Berkus



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

Предыдущее
От: "Patrick Hatcher"
Дата:
Сообщение: Re: Function problem
Следующее
От: Thorsten Haude
Дата:
Сообщение: Re: create database, user