Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3F5B4632E18 for ; Wed, 2 Sep 2009 05:34:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 92559-01 for ; Wed, 2 Sep 2009 08:34:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id 23BBA6326C5 for ; Wed, 2 Sep 2009 05:34:03 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MKt72-1MilHz4BwP-000D3S; Wed, 02 Sep 2009 10:34:00 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1MilHf-0008Nn-00 for pgsql-sql@postgresql.org; Wed, 02 Sep 2009 10:33:39 +0200 Date: Wed, 2 Sep 2009 10:33:39 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: How to create Function which retruns username and password Message-ID: <20090902083339.GA31088@a-kretschmer.de> References: <79ad14900909020105n41de133es75b7a0457327e3ca@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <79ad14900909020105n41de133es75b7a0457327e3ca@mail.gmail.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX18zxaVK/tybV3uMarqr/sd18kplOyBs9TqNZ8y NEY/DhFQIN2jx3ahwhUoXMDdYaohpLJvVCWs+bNShJ+LYLlDtu YDxDLPCgnMCvyH7DUWoYw== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/11 X-Sequence-Number: 33076 In response to venkat : > Dear All, > >     I want to create function which returns username and password from the > database.I have users table in the database.in that i have username and > password columns.I need return username and password using functions.it is > urgent. I am waiting for your great response, test=# create table usernames (username text, passwort text); CREATE TABLE test=*# create or replace function get_usernames() returns setof usernames as $$ begin return query select username, passwort from usernames; end;$$ language plpgsql; CREATE FUNCTION test=*# insert into usernames values ('user1', 'password1'); INSERT 0 1 test=*# insert into usernames values ('user2', 'password2'); INSERT 0 1 test=*# select * from get_usernames(); username | passwort ----------+----------- user1 | password1 user2 | password2 (2 rows) HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net