Thread: Function

Function

From
"Sumita Biswas (sbiswas)"
Date:
Hi All,

This function of mine gives a Parse Error:

CREATE or replace FUNCTION Proc_ConferenceSummary(date,date,int,int,int)
RETURNS SETOF tbl_error_master AS
'
declare li_CallManagerId int;
beginselect * FROM tbl_error_master;
end;
'
LANGUAGE SQL;

psql:Proc_ConferenceSummary.sql:9: ERROR:  parser: parse error at or
near "int" at character 31

I don't see any Syntax Error. Can you please let me know what can be the
issue?

Regards,
Sumita



Re: Function

From
Stephan Szabo
Date:
On Mon, 16 Feb 2004, Sumita Biswas (sbiswas) wrote:

> Thanks for the answer.
> I have one more issue. How do I test a function that I wrote?
> I was able to create a function called Proc_ConferenceSummary().
> In SQL Server I used to run it through query analyzer by writing the
> following command:
> exec Proc_ConferenceSummary '12/1/2003','1/23/2004',1,1,0,5001

For functions that return setof or complex types, you can do it as
select * from Proc_ConferenceSummary(...) as alias;

For simple functions you can just use:
select functionname(...);