Re: accessing fully qualified fields in records in PLPGSQL?
От | Darren Ferguson |
---|---|
Тема | Re: accessing fully qualified fields in records in PLPGSQL? |
Дата | |
Msg-id | Pine.LNX.4.10.10203251151220.16838-100000@thread.crystalballinc.com обсуждение исходный текст |
Ответ на | accessing fully qualified fields in records in PLPGSQL? ("Oberpriller, Wade D." <oberpwd@nsc-msg01.network.com>) |
Ответы |
pg_dump-ing tables and their sequences
|
Список | pgsql-general |
dev=> CREATE FUNCTION test() RETURNS INTEGER AS ' dev'> DECLARE dev'> rec RECORD; dev'> val INTEGER; dev'> BEGIN dev'> FOR rec IN SELECT oid FROM inv_locations LOOP dev'> val := rec.oid; dev'> END LOOP; dev'> RETURN val; dev'> END;' LANGUAGE 'plpgsql'; CREATE dev=> select test(); test -------- 534321 (1 row) Did not see your declare etc but this one works. Returns the final oid for that table HTH Darren Ferguson On Mon, 25 Mar 2002, Oberpriller, Wade D. wrote: > How does one access a field in a record from a query like so: > > FOR REC IN SELECT myTable.oid FROM myTable, yourTable WHERE (myTable.id = > yourTable.id) LOOP > VAL := REC.oid; > VAL := REC.myTable.oid; > END LOOP; > > I get errors in PLPGSQL compilation for both the assignment statements > above. What is the correct way to get the myTable oid in the REC record? > > Wade Oberpriller http://www.storagetek.com > Software Development Phone: (763) 424-1538 > StorageTek: MRDC (800) 328-9108 ext. 1538 > wade_oberpriller@storagetek.com Fax: (763) 391-1095 > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
В списке pgsql-general по дате отправления: