Skip site navigation (1) Skip section navigation (2)

RE: function that returns a set of records and integer(both of them)‏

From: daniel blanco <daniel_b_adrian(at)hotmail(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: RE: function that returns a set of records and integer(both of them)‏
Date: 2008-07-13 02:32:52
Message-ID: BLU143-W159DA5CF6516B95B86F1DBB7920@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-sql
Ok, thanks pavel............. i think i'll try set of cursors..... by the way in t-sql i did it as follows:
table users with a field called name
 
create procedure list_user_by_name
@info_name varchar
as
declare @sw
begin
         select @n=(select count(*) from users where name like (@info_name+'%'))
         if @sw>0
         begin
                   select * where name like (@info_name+'%')
                   return 1
         end
         else
         begin
                   return 0
         end
end
 
as you see i do a select and a return at the same time when de sw variable is > than 0. i was expecting to do a similiar function with plpgsql o sql in postgresql
> Date: Sat, 12 Jul 2008 09:05:45 +0200> From: pavel(dot)stehule(at)gmail(dot)com> To: daniel_b_adrian(at)hotmail(dot)com> Subject: Re: [SQL] function that returns a set of records and integer(both of them)‏> CC: pgsql-sql(at)postgresql(dot)org> > 2008/7/11 daniel blanco <daniel_b_adrian(at)hotmail(dot)com>:> > Hi Everyone> >> > I would like to know if i can create a function that returns a set of record> > with the sql statement: select and a integer, i mean both of them, because i> > remenber that in sql server (transact sql) i can do that in a stored> > procedure doing a select statement and a return of a integer in the same> > procedure,> > when I worked with T-SQL this wasn't possible - stored procedure> should return recordset or multirecord set or OUT variables. And it> was solution. When I would returns some similar like you, I had to> return two recordsets.> > i'm migrating to postgresql and i have stored procedures like> > this in my sql server database, can i do that with postgresql?> > You canno
 t return integer and recordset from function now. There is> one workaround, you can return set of cursors.> > Regards> Pavel Stehule> > >> > Thanks.........> > ________________________________> > Get news, entertainment and everything you care about at Live.com. Check it> > out!> > -- > Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)> To make changes to your subscription:> http://www.postgresql.org/mailpref/pgsql-sql
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

In response to

Responses

pgsql-sql by date

Next:From: Pavel StehuleDate: 2008-07-13 05:06:07
Subject: Re: function that returns a set of records and integer(both of them)‏
Previous:From: John HaslerDate: 2008-07-12 22:53:58
Subject: Re: Copyright and Paper walls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group