On Jan 16, 2004, at 8:30 PM, Philippe Lang wrote:


Hello,

I'd like to write a function similar to that:

------------------------------------------------
CREATE FUNCTION public.report_join_parameter(char(6))
  RETURNS ??? AS

<snip />


Do I ***HAVE TO*** define a composite type for the columns my function
is supposed to return?

As far as I know. It's not that hard.


CREATE TYPE report_join_type (
        tableAfield1 <type>,
        tableAfield2 <type>,
        tableBfield1 <type>,
        tableBfield2 <type>,
        tableCfield1 <type>,
        tableCfield2 <type>
);

I thought a view would be more appropriate, but if I'm not wrong, a view
does not accept any parameter as input...

But you can just define the view and select it with a WHERE clause with your parameter, just like a normal table. Would that help?


Michael Glaesemann
grzm myrealbox com


---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend

Reply via email to