How to return more than one value from a function?

Answer Posted / mglbayar

We can use oracle pipelined function

FUNCTION f_serie_arithmetica (p_nr IN NUMBER)
RETURN ARRAY PIPELINED
IS
v_sum NUMBER;
BEGIN
v_sum := 0;
FOR i IN 1 .. p_nr
LOOP
v_sum := v_sum + i;
PIPE ROW (v_sum);
END LOOP;
RETURN;
END;

Usage:
select * from table(f_serie_arithmetica(23));

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What jobs use sql?

526


what are numeric data types? : Sql dba

576


Is sql between inclusive?

587


Can we join same table in sql?

523


What is sql deadlock?

562






Which is better join or subquery?

604


What view means?

556


in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.

1643


How delete a row in sql?

533


how many sql dml commands are supported by 'mysql'? : Sql dba

567


what are aggregate and scalar functions? : Sql dba

550


What is the difference between clustered and non-clustered index in sql?

521


what is a view? : Sql dba

634


What is pl/sql table? Why is it used?

559


define sql insert statement ? : Sql dba

548