You can use it as:
SELECT * FROM get_test_data(1000) AS t1 (emp_name VARCHAR);
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)
On 12/12/06, Rikard Pavelic <[EMAIL PROTECTED]> wrote:
Shoaib Mir wrote:
> You can use a SETOF function as:
>
> CREATE OR REPLACE FUNCTION get_test_data
Richard Huxton wrote:
Rikard Pavelic wrote:
I know setof record will do if I explicitly name OUT parameters.
But I want Postgre to figure out for himself what parameters to
return as out parameters.
I don't see why it would make things very ambiguous.
Think about what happens if you use suc
Rikard Pavelic wrote:
Martijn van Oosterhout wrote:
Just "setof record" will do. As for the implicit declaration of
variable names, that's harder. I don't know if you can do that without
making things very ambiguous.
I know setof record will do if I explicitly name OUT parameters.
But I wa
Martijn van Oosterhout wrote:
Just "setof record" will do. As for the implicit declaration of
variable names, that's harder. I don't know if you can do that without
making things very ambiguous.
I know setof record will do if I explicitly name OUT parameters.
But I want Postgre to figure ou
TECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Rikard Pavelic
> Sent: Tuesday, December 12, 2006 3:06 PM
> To: Shoaib Mir; pgsql-general@postgresql.org
> Subject: Re: [GENERAL] returning parameters from function
>
> This doesn't work. ;(
> I get ERROR: a col
Shoaib Mir wrote:
You can use a SETOF function as:
CREATE OR REPLACE FUNCTION get_test_data (numeric)
RETURNS SETOF RECORD AS
$$
DECLARE
temp_recRECORD;
BEGIN
FOR temp_rec IN (SELECT ename FROM emp WHERE sal > $1)
LOOP
RETURN NEXT temp_rec;
END LOOP;
RETURN;
E
On Tue, Dec 12, 2006 at 10:30:07AM +0100, Rikard Pavelic wrote:
Hi!
Is there any plan to add implicit declaration of returning parameters
for functions?
Something like:
create function list(in a int) returns setof implicit record as
You can use a SETOF function as:
CREATE OR REPLACE FUNCTION
On Tue, Dec 12, 2006 at 10:30:07AM +0100, Rikard Pavelic wrote:
> Hi!
>
> Is there any plan to add implicit declaration of returning parameters
> for functions?
> Something like:
> create function list(in a int) returns setof implicit record as
Just "setof record" will do. As for the implicit
Hi!
Is there any plan to add implicit declaration of returning parameters
for functions?
Something like:
create function list(in a int) returns setof implicit record as
$$
if a=1 then select * from table1;
else select * from table2;
end if;
$$
languge sql;
which would than dynamically create o