How to return more than one value from a function?

Answer Posted / murali

We can return more than one row using out parameter. Try
this with the following.

create or replace function my_func(myno number, myname out
varchar2) return number as
mysal emp.sal%type;
begin
select ename, sal into myname, mysal from emp where
empno=myno;
return sal;
end;

in the above example we are returning first value mysal
using return statement and second value myname using out
parameter.

Is This Answer Correct ?    11 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of primary keys are there?

529


Explain cursor types?

581


what is the difference between primary key and unique key? : Sql dba

531


How to use sql*plus built-in timers?

578


what is uncommittable transactions? : Transact sql

570






How do we accept inputs from user during runtime?

548


What is difference between db2 and sql?

533


Is record in oracle pl sql?

533


What is assignment operator in pl sql?

567


Explain raise_application_error.

644


How do you create a db file?

523


What is normalisation and its types?

550


What are different methods to trace the pl/sql code?

544


what is a table called, if it has neither cluster nor non-cluster index? What is it used for? : Sql dba

524


What is meant by cursor in sql?

547