dynamic field names in a function.

From: Soma Interesting <dfunct(at)telus(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: dynamic field names in a function.
Date: 2001-03-29 22:38:31
Message-ID: 5.0.2.1.0.20010329142546.02a54ea8@pop.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Manuel Sugawara 2001-03-29 22:56:30 Re: Consistent pg_dump's
Previous Message Andrew Hammond 2001-03-29 22:16:54 A valuable addition to PHP...