From: | Jeff Eckermann <jeckermann(at)verio(dot)net> |
---|---|
To: | "'Soma Interesting'" <dfunct(at)telus(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | RE: dynamic field names in a function. |
Date: | 2001-03-30 17:30:14 |
Message-ID: | 08CD1781F85AD4118E0800A0C9B8580B0949EA@NEZU |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In my experience, the best way to find out answers like this is to try it
out and see. Usually I find that I need to fiddle around with the syntax a
bit (I believe it's called debugging) before getting something to work.
Postgresql is very powerful; the capability to utilize that power comes at a
price. In other words, be prepared to put in a solid investment if you want
to see a return.
(I'm not accustomed to preaching, but sometimes this just needs to be said).
> -----Original Message-----
> From: Soma Interesting [SMTP:dfunct(at)telus(dot)net]
> Sent: Thursday, March 29, 2001 4:39 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] dynamic field names in a function.
>
>
> I want to be able to reference NEW.field_0 though NEW.field_x where x is
> coming from NEW.qty in a FOR loop of pl/pgsql function. Is this possible?
>
> In other words:
>
> FOR j IN 0..NEW.str LOOP
>
> ans := ''q'' || i || ''a'' || j;
> cor := ''q'' || i || ''c'' || j;
> eval := 'q'' || i || ''e'' || j;
>
> IF NEW.ans = NEW.cor
> THEN NEW.eval := 1;
> END IF;
>
> END LOOP;
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Soma Interesting | 2001-03-30 18:06:50 | RE: dynamic field names in a function. |
Previous Message | Konstantinos Agouros | 2001-03-30 17:10:25 | Performance-Problem |