From: Anton Prokofiev <a.d.prokofiev@googlemail.com>
To: pgsql-sql@postgresql.org
Subject: return %ROWTYPE from function
Date: Sun, 23 May 2010 14:42:38 -0700 (PDT)
Message-ID: <0b4febda-32f3-4346-bb99-4d5197464f19@i31g2000vbt.googlegroups.com> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: a.d.prokofiev@googlemail.com
Subject: Re: return %ROWTYPE from function
In-Reply-To: <0b4febda-32f3-4346-bb99-4d5197464f19@i31g2000vbt.googlegroups.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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