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:dfu...@telus.net]
Sent: Thursday, March 29, 2001 4:39 PM
To: pgsq...@postgresql.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;