Home » SQL & PL/SQL » SQL & PL/SQL » how to return multile values from function.
how to return multile values from function. [message #185897] Fri, 04 August 2006 03:02 Go to next message
ommin
Messages: 22
Registered: June 2006
Location: pune,India
Junior Member

hi
my query is regarding functions.
How to return more than 1 value from function.
Re: how to return multile values from function. [message #185901 is a reply to message #185897] Fri, 04 August 2006 03:18 Go to previous messageGo to next message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
Have the function return a record, an object, a collection or a ref cursor.
Re: how to return multile values from function. [message #185902 is a reply to message #185897] Fri, 04 August 2006 03:23 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Have the function return a collection.

SQL> create or replace  type num_tab as table of number(8,0);
  2  /

Type created.

SQL>   CREATE OR REPLACE FUNCTION multiple_rows RETURN num_tab AS
  2    v_return  num_tab := num_tab();
  3  BEGIN
  4    v_return.extend(4);
  5    v_return(1) := 1;
  6    v_return(2) := 2;
  7    v_return(3) := 99;
  8    v_return(4) := 0;
  9    return v_return;
 10* END;
SQL> /

Function created.

SQL> select multiple_rows from dual;

MULTIPLE_ROWS
-----------------------------------------------------------------
NUM_TAB(1, 2, 99, 0)
Re: how to return multile values from function. [message #185931 is a reply to message #185897] Fri, 04 August 2006 06:01 Go to previous message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member



To have a More detailed View ...

SELECT   * from  TABLE(CAST(multiple_rows AS num_tab))


Thumbs Up
Rajuvan
Previous Topic: Problem with Greek CharSet
Next Topic: Help me regarding this query
Goto Forum:
  


Current Time: Sat Dec 03 18:24:46 CST 2016

Total time taken to generate the page: 0.08610 seconds