How to Return Table From Function
| От | Rehan Saleem |
|---|---|
| Тема | How to Return Table From Function |
| Дата | |
| Msg-id | 1327237795.19340.YahooMailNeo@web121606.mail.ne1.yahoo.com обсуждение исходный текст |
| Ответы |
Re: How to Return Table From Function
Re: How to Return Table From Function |
| Список | pgsql-sql |
hi , i have created this function
CREATE OR REPLACE FUNCTION totaloverlapcount(user_id integer , bg integer ,center_distance integer)
RETURNS varchar AS $$
DECLARE percentage record;
BEGIN
select fname, lname, count(userid) totalcount ,100.00*count(useriddetails)/totaluser into percentage
from users
where userid= user_id and bloodgroup>=bg and
(centredistance<=center_distance or center_distance=1)
group by fname, lname, user_id;
return percentage;
RETURNS varchar AS $$
DECLARE percentage record;
BEGIN
select fname, lname, count(userid) totalcount ,100.00*count(useriddetails)/totaluser into percentage
from users
where userid= user_id and bloodgroup>=bg and
(centredistance<=center_distance or center_distance=1)
group by fname, lname, user_id;
return percentage;
its just a dummy function , but all i want to know that how can i return fname , lname totalcount and percentage from this function in the form of table , not the return type varchar.
thanks
В списке pgsql-sql по дате отправления: