Sunday, June 21, 2009

Subprograms in PL/SQL?

select sal from emp where eno = func_highpayee;

--function declaration
create or replace function func_highpayee
return number
as
varEno NUMBER default 0;
begin
select eno into varEno from emp where sal = (select max(sal)from emp) and rownum =1;
return(varEno);
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('No Data found for SELECT on ' );
end;

executing a proc or func:
begin
proc-name;
end;

exec proc-name;

No comments:

Post a Comment