pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedreturn %ROWTYPE from function
2+ messages / 2 participants
[nested] [flat]
* return %ROWTYPE from function
@ 2010-05-23 21:42 Anton Prokofiev <a.d.prokofiev@googlemail.com>
2010-05-24 01:15 ` Re: return %ROWTYPE from function jr <jorg.raskowski@tailorware.org.uk>
0 siblings, 1 reply; 2+ messages in thread
From: Anton Prokofiev @ 2010-05-23 21:42 UTC (permalink / raw)
To: pgsql-sql
Hello, All!
I've tried to do following:
create table test ( id BIGSERIAL NOT NULL, constraint pk_test primary
key (id),
val BIGINT NOT NULL
);
create or replace function get_rec (in p_id test.id%TYPE) returns test
%ROWTYPE as $$
declare
retval test%ROWTYPE;
begin
select * from test into retval
where id = $1;
return retval;
end;
$$ language 'plpgsql';
I got an error message: "sysntax error at or near ROWTYPE"
Is it possible to return ONE record that has the same type as table?
I Oracle it is work fine....
Any Ideas or work around?
Thanks.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: return %ROWTYPE from function
2010-05-23 21:42 return %ROWTYPE from function Anton Prokofiev <a.d.prokofiev@googlemail.com>
@ 2010-05-24 01:15 ` jr <jorg.raskowski@tailorware.org.uk>
0 siblings, 0 replies; 2+ messages in thread
From: jr @ 2010-05-24 01:15 UTC (permalink / raw)
To: pgsql-sql
hi Anton,
works fine if you write:
create or replace function get_rec (in p_id test.id%TYPE) returns test as $$
--
regards, jr. (jr@tailorware.org.uk)
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-05-24 01:15 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-23 21:42 return %ROWTYPE from function Anton Prokofiev <a.d.prokofiev@googlemail.com>
2010-05-24 01:15 ` jr <jorg.raskowski@tailorware.org.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox