Re: select into

From: Mulham freshcode <mulhamcode(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: select into
Date: 2006-11-24 06:54:13
Message-ID: 20061124065413.38499.qmail@web90514.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Tom,

Thanks for the help. Am using version 8.0 and it seems like RECORD is not that dynamic still. I tried with the FOR ... IN EXECUTE ... LOOP and it does the trick. But am still finding it hard to move forward with this. I have the name of table field in a varchar variable that i got from information_schema.columns and I have the records variable that stores the contains the data from that table. Usually I'd do something like data_rec.col_name to extract the data from the record but now I don't know the name per se. how can i say something like data_rec[col_name] where col_name is a variable that has the actual column name. I found no examples in the docs that explain this. Can it be done in version 8.0.1?

I find variable substitution kind of confusing. I mean why is there no way of saying explicitly replace this variable with its content before executing the statement?

Sorry for the long question,
and thanks again for the help

Mustafa...

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote: Mulham freshcode writes:
> execute sql_str1 into svc_data_rec ;

> svc_data_rec is a RECORD, which is supposed to be dynamic.

This should work --- in PG 8.1 or later. In older versions you'd have
to fool around with a FOR ... IN EXECUTE ... loop.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ezequias Rodrigues da Rocha 2006-11-24 13:07:37 Numbers
Previous Message Tom Lane 2006-11-24 04:45:19 Re: select into