Hi people,
I'm writing a plpgsql function in pgadminIII and want to know if the arguments can have the following type:
tablename.columnname%TYPE
If so, how do I accomplish this in pgadminIII as it doesn't allow me to change the arguments to this type.
The function I'm writing looks like this:
CREATE OR REPLACE FUNCTION totnrchange(a table1.resnr%TYPE, b table1.fnr%TYPE, c table1.fdate%TYPE, d table1.dep%TYPE, e table1.arr%TYPE, f table1.nrdays%TYPE)
RETURNS integer AS
$BODY$DECLARE
tot integer;
BEGIN
select count(resnr) into tot from table1 x where x.resnr=a and x.fnr=b and x.fdate=c and x.dep=d and x.arr=e and x.nrdays>=f group by x.resnr,x.fnr,x.fdate,x.dep,x.arr;
return tot;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
Brgds
Dino