RE: dynamic field names in a function.
От | Jeff Eckermann |
---|---|
Тема | RE: dynamic field names in a function. |
Дата | |
Msg-id | 08CD1781F85AD4118E0800A0C9B8580B0949EA@NEZU обсуждение исходный текст |
Ответ на | dynamic field names in a function. (Soma Interesting <dfunct@telus.net>) |
Ответы |
RE: dynamic field names in a function.
|
Список | 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@telus.net] > Sent: Thursday, March 29, 2001 4:39 PM > To: pgsql-general@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; > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
В списке pgsql-general по дате отправления: