How to cal function in in another function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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          

 
Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@xxxxxxxxxx and delete this email from your records.

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux