Wednesday, November 23, 2005

some postgresql snippet

create type something as (
x int,
y int,
z int
)





create or replace function mibsomething() returns setof something
as
$$
declare
r something%rowtype;
begin

/*
select 7, 8 into r;
return next r;

select 9, 10 into r;
return next r;*/

for r in select 7, 8, 9 union select 9, 10, 11 loop
r.x = r.x + 10;
return next r;
end loop;

end;
$$ language 'PLPGSQL';


select * from mibsomething() as x

0 Comments:

Post a Comment

<< Home