tags:

views:

34

answers:

1

How to send a table to function as argument?

Need something like that:

CREATE OR REPLACE FUNCTION test(argTable TABLE(
        field1 integer,
        field1 integer,
        etc smallint
))
    RETURNS integer AS
$BODY$

... Is it possible btw?

UPD: I'm going to send a temp table to function so I suppose I need table structure declaration in arguments list.

+2  A: 

You could use EXECUTE which allows the execution of an arbitrary string.

musiKk
thanks. actually it's not that I planned to do. but that solved my problem.
noxvile
Actually EXECUTE is the better way. My guess is you wanted to pass the table rows in as values. Where execute is more like a pass by reference approach which doesn't incur the cost of moving a big chunk of data around.
StarShip3000