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

What is the difference between join and natural join?

473


What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql

535


What is the difference between delete, truncate and drop command?

547


Can we write dml inside a function in sql server?

499


how would concatenate strings in mysql? : Sql dba

569






What does (*) mean in sql?

527


What programs use sql?

523


Mention what is the use of function "module procedure" in pl/sql?

561


What are the types of optimization?

519


How to start oracle sql developer?

558


Which one is better sql or oracle?

496


Is primary key clustered or nonclustered?

556


how to load data files into tables with 'mysqlimport'? : Sql dba

520


How much does sql certification cost?

543


How many types of triggers exist in pl/sql?

561