Is it possible to return anything apart from number and varchar2 from any function.Also is it possible to return row of data ?
Yes it is possible to return row of data from the function.
create or replace function test(emp_name varchar2)
return emp%rowtype
is
x emp%rowtype;
Begin
SELECT * into x from emp wnere ename=emp_name;
return x;
end test;
SELECT * from emp;
Declare
y emp%rowtype;
begin
y:=ha('KING');
DBMS_OUTPUT.put_line('NAME IS '||y.ename||' salary is '||y.sal||' and job is '||y.job);
end;
Output:
NAME IS KING salary is 5000 and job is PRESIDENT
No comments:
Post a Comment