Re: [SQL] select into

2006-11-23 Thread Mulham freshcode
Hi, Thanks very much for all the suggestions. Like Andreas said i have to use EXECUTE to do this. That was my guess too but i was putting the INTO cluase into the string before executing it. This is a step forward. The problem now is getting the into to work with a record. Am using a RECORD

Re: [SQL] select into

2006-11-23 Thread Adrian Klaver
On Thursday 23 November 2006 09:19 am, Mulham freshcode wrote: > Hi, > Thanks very much for all the suggestions. Like Andreas said i have to > use EXECUTE to do this. That was my guess too but i was putting the INTO > cluase into the string before executing it. This is a step forward. The > pro

Re: [SQL] select into

2006-11-23 Thread Mulham freshcode
Hello Adrian, Here is my execute string, sql_str1 = 'select * from ' || svc_tbl_name || ' where uid = ' || sub_id ; execute sql_str1 into svc_data_rec ; svc_data_rec is a RECORD, which is supposed to be dynamic. If I need to define the structure of the record then there will be no point in usin

Re: [SQL] select into

2006-11-23 Thread Tom Lane
Mulham freshcode <[EMAIL PROTECTED]> 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. regar

Re: [SQL] select into

2006-11-23 Thread Mulham freshcode
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 fro