Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 06A076341A1 for ; Thu, 27 May 2010 16:29:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 14872-05-2 for ; Thu, 27 May 2010 19:29:07 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id A3692634284 for ; Thu, 27 May 2010 16:29:00 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id o4RJSlK0031458 for ; Thu, 27 May 2010 16:28:57 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id o4NLgZmD017252 for pgsql-sql@postgresql.org; Sun, 23 May 2010 18:42:35 -0300 (ADT) (envelope-from news) From: Anton Prokofiev X-Newsgroups: pgsql.sql Subject: return %ROWTYPE from function Date: Sun, 23 May 2010 14:42:38 -0700 (PDT) Organization: http://groups.google.com Lines: 31 Message-ID: <0b4febda-32f3-4346-bb99-4d5197464f19@i31g2000vbt.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Complaints-To: groups-abuse@google.com Complaints-To: groups-abuse@google.com Injection-Info: i31g2000vbt.googlegroups.com; posting-host=88.152.252.35; posting-account=5AYfhgoAAAAS4ReDQf98B33xa-p1oSNp User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.19) Gecko/2010040118 Ubuntu/8.10 (intrepid) Firefox/3.0.19,gzip(gfe) To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-5 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/9 X-Sequence-Number: 34200 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.