Returning a row from a function

Поиск
Список
Период
Сортировка
От deepaji@chequemail.com
Тема Returning a row from a function
Дата
Msg-id 20010207050009.24668.cpmta@c000.muc.cp.net
обсуждение исходный текст
Список pgsql-sql
Hi,

This is my first experinece in writing to u. Please excuse any obvious errors.

I have only recently started using the postgres database and i would like to know if it is possible to return a record
fromthe fucntion(both sql and plpgsql).
 

I tried this code.. but the reuslt i got was

create function ret_rec(char(10)) returns setof label as
'
select * from label where label_id = $1'
language 'sql';

hmv=# select ret_rec('L0001'); ?column?  
-----------136449928

I also tried this.. 

create function ret_rec(char(10)) returns label as
'
declare
label_rec record;
begin
select into label_rec * from label where label_id = $1;
return label_rec;
end;'
language 'plpgsql';


hmv=# select ret_rec('L0001'); ret_rec  
-----------136469400
(1 row)

What is the problem and what is this value that is being returned? Is there any other way in which i can handle this?

Please help.

Also, please tell me if there is any way in which i can pass values to a plpgsql function that is being called by a
trigger?(ie)this function exceutes when a trigger fires.. can i pass arguments to this function?
 

Regards and Thanx in advance
Deepa.


Chequemail.com - a free web based e-mail service that also pays!!!
http://www.chequemail.com


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Sebastian"
Дата:
Сообщение: Load or Copy ??
Следующее
От: Guerrino Di Minno
Дата:
Сообщение: Datatype in SQL Server 2000