++ PLPGSQL

Started by Shaun Clementsabout 21 years ago2 messagesgeneral
Jump to latest
#1Shaun Clements
ShaunC@relyant.co.za

Adding to that.

Can you assign the value of a dynamic record value.
For example

If I have written dataset returned, into a record.
I now want to call on a particular column value from the first row.
The column name is dynamic.
Can I use something like this

sales_month1_x := RECORDNAME.quote_ident('month1_'||quote_literal(yr2));

Where the value of
RECORDNAME.month1_2004
is assigned to sales_month1_x

Is this possible.
It doesnt look right, in that I have referenced RECORDNAME.quote_ident
That should bomb out..
how would I reference the dynamic column of the record.

Thanks in advance.

Kind Regards,
Shaun Clements

#2Richard Huxton
dev@archonet.com
In reply to: Shaun Clements (#1)
Re: ++ PLPGSQL

Shaun Clements wrote:

Can you assign the value of a dynamic record value.
For example
sales_month1_x := RECORDNAME.quote_ident('month1_'||quote_literal(yr2));

You're right - it won't work. PLPGSQL has strict type-checking, so it's
no good for this sort of stuff. Perhaps pl/tcl/perl/python would be
better for you.

--
Richard Huxton
Archonet Ltd