Re: [SQL] CREATE TABLE AS inside of a function

2006-07-24 Thread Stephan Szabo
On Mon, 24 Jul 2006, Kevin Nikiforuk wrote: > So, I've changed my code as Erik suggested: > > CREATE OR REPLACE FUNCTION rgio() RETURNS INTEGER as $$ > DECLARE > lv RECORD; > > BEGIN > FOR lv IN SELECT DISTINCT rg > FROM ldevrg > LOOP > >

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-24 Thread Kevin Nikiforuk
near line 23 psql:rgio.sql:32: LINE 1: SELECT 'CREATE TABLE rgio_' || $ $1 || ' AS psql:rgio.sql:32: ^ From: [EMAIL PROTECTED] on behalf of Erik Jones Sent: Fri 7/21/2006 3:04 PM To:

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Erik Jones
Rodrigo De Leon wrote: On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Rodrigo De Leon
On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figu

[SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Kevin Nikiforuk
So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figure out how to use a variable in the name of the new table