|
|
| · · · · · · · | |
|
How to cal function in in another function
Hi,
i have
written these functions....,please go through this...
table emp: It contains
empno
ename
mgr
sal
dept
-------------------------------------------------------------------------
22
swarna 23
2600
20
Now i wrote function(sub
function)
create or replace function
subfun1(int8,out p_mgr int8,out p_name varchar) as
' begin select ename,mgr into p_name,p_mgr from emp where empno=$1 ; end; ' language'plpgsql'; When i executing this function,it returns
like....
select
subfun1(22); returns (23,swarna) as record
type Now i
want use/call this function in main function
create
or replace function mainfun(int8,out p_sal int8,out p_dept varchar)
as
' declare no record; begin select subfun1($1) into no; select sal,dept into p_sal,p_dept from emp where mgr=no.p_mgr limit 1; end; ' language'plpgsql'; Now
when i am executing this function like....
select
mainfun(22); returns error message like....
ERROR: record "no" has no
field "p_mgr"
CONTEXT: PL/pgSQL function "mainfun" line 5 at select into variables So,how to solve this problem?
Thanks
& Regards Vivekananda.R |
Software Engineer
Infinite
Computer Solutions |
Exciting Times…Infinite Possibilities... SEI-CMMI
level 5 |
ISO
9001:2000 Tel
+91-80-5193-0000|
Fax +91-80-51930009 |
Cell No +91-9986463365|www.infics.com
|