Access a Field / Column of a resultset by Number
Access a Field / Column of a resultset by Number
От:
Daniel Schuchardt <d.schuchardt@prodat-sql.de>
Дата:
hy group, i currently look for a solution to access a resultset in a db-stored function by number. in plpgsql thats not possible. so i checked out plpython. so far so good, thats working: CREATE OR REPLACE FUNCTION dokv_dorecnokeywords(sqlstatement VARCHAR) RETURNS VOID AS $$ rv = plpy.execute(sqlstatement, 1) |||||->"SELECT * FROM art WHERE ak_nr='TEST'" s = 'ak_bez' |||| fieldname is static here, should be by number plpy.notice(s+'='+rv[0][s]) return $$ LANGUAGE plpythonu; now i need a solution to get the number of fields as well as the fieldnames of that resultset and run through all fields (by number or by name). (i need the fieldname too) -- Daniel Schuchardt /Softwareentwicklung/ /http://www.prodat-sql.de/
Re: Access a Field / Column of a resultset by Number
От:
"A. Kretschmer" <andreas.kretschmer@schollglas.com>
Дата:
In response to Daniel Schuchardt : > hy group, > > i currently look for a solution to access a resultset in a db-stored > function by number. in plpgsql thats not possible. Can you wait until 8.5? http://okbob.blogspot.com/2009/10/dynamic-access-to-record-fields-in.html Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99