I need to make a funtion that take one parameter and then returns a "record" with x number of fields, collected from x no. of tables, i.e. I need to run several sql statemtents to collect all the needed values from x no. of fields and insert it into a "record" and return the "record" at the end... Can someone get me started? I have not written many function in plpgsql before, so any help is appreciated... (how to a create the return "record", etc?) btw, I am using PostgreSQL 7.4 (will be upgrading to 8.1 after the summer but need a function working for 7.4 first...) Regards, BTJ -- ----------------------------------------------------------------------------------------------- Bjørn T Johansen btj@xxxxxxxxxx ----------------------------------------------------------------------------------------------- Someone wrote: "I understand that if you play a Windows CD backwards you hear strange Satanic messages" To which someone replied: "It's even worse than that; play it forwards and it installs Windows" -----------------------------------------------------------------------------------------------