From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | "Patrick Hatcher" <PHatcher(at)macys(dot)com>, josh(at)agliodbs(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Function problem |
Date: | 2002-03-16 21:10:31 |
Message-ID: | web-830646@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Thorsten Haude | 2002-03-17 14:53:16 | Re: create database, user |
Previous Message | Patrick Hatcher | 2002-03-16 03:19:58 | Re: Function problem |