[SQL] pl/pgsql and returning rows
Here is the senario... I have a table defined as create table details ( field1 field2 . . . ); and a function: create function get_details(int4) returns details as ' declare ret details%ROWTYPE; site_recrecord; cntct contacts%ROWTYPE; begin select into site_rec * sites_table where id = $1 limit 1; select into cntct * from contacts where id = site_rec.contact; -- and then i populate rows of ret. ret.name := cntct.name; ret.ip := site_rec.ip; . . . return ret; end; ' language 'plpgsql'; now the problem is when is when I do a: SELECT get_details(55); all i get is a single oid-looking return value: get_details - 136295592 (1 row) How do i get at the actual information in the row? Is this type of function even possible? If not, is there a different manner in which i should approach this task? Thanx in advance. -Wade ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] pl/pgsql and returning rows
Here is the senario... I have a table defined as create table details ( field1 field2 . . . ); and a function: create function get_details(int4) returns details as ' declare ret details%ROWTYPE; site_recrecord; cntct contacts%ROWTYPE; begin select into site_rec * sites_table where id = $1 limit 1; select into cntct * from contacts where id = site_rec.contact; -- and then i populate rows of ret. ret.name := cntct.name; ret.ip := site_rec.ip; . . . return ret; end; ' language 'plpgsql'; now the problem is when is when I do a: SELECT get_details(55); all i get is a single oid-looking return value: get_details - 136295592 (1 row) How do i get at the actual information in the row? Is this type of function even possible? If not, is there a different manner in which i should approach this task? Thanx in advance. -Wade ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
