Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: [Doubt] - Returning Type Table

Re: [Doubt] - Returning Type Table

From: <jkstill_at_cybcon.com>
Date: Tue, 20 Feb 2001 10:00:55 -0800
Message-ID: <F001.002B8D73.20010220095040@fatcity.com>

> scott> VARIABLE rtc REFCURSOR
> scott> EXECUTE :rtc := rtc_dept
> begin :rtc := rtc_dept; end;
>

The first thing I notice is that the code above is assinging an 'index by table' to a ref cursor.

You might start there.

Jared

On Mon, 19 Feb 2001, Eriovaldo do Carmo Andrietta wrote:

>
> Hi Friends :
>
> I have the code bellow and would like to return the variable type table.
>
>
> CREATE OR REPLACE PACKAGE cv_types AS
> TYPE DeptCurType is REF CURSOR RETURN dept%ROWTYPE;
> TYPE retorno IS TABLE OF SCOTT.dept%ROWTYPE INDEX BY BINARY_INTEGER;
> TYPE Tipo_Tabela_Emp IS TABLE OF EMP%ROWTYPE INDEX BY BINARY_INTEGER;
> TYPE Tipo_Tabela_Dept IS TABLE OF DEPT%ROWTYPE INDEX BY BINARY_INTEGER;
> END cv_types;
>
>
> create or replace function rtc_dept
> RETURN cv_types.Tipo_Tabela_Dept
> IS
> cursor resultset is
> select * from dept;
> tabdept cv_types.Tipo_tabela_Dept;
> I BINARY_INTEGER;
> tab dept%rowtype;
> BEGIN
> i := 1;
> open resultset;
> loop
> fetch resultset into tab;
> exit when resultset%notfound;
> tabdept(i).dname := '- ' || tab.dname;
> dbms_output.put_line (tabdept(i).dname);
> i := i + 1;
> end loop;
> close resultset;
> RETURN(tabdept);
> END;
>
> scott>
> scott>
> scott>
> scott> VARIABLE rtc REFCURSOR
> scott> EXECUTE :rtc := rtc_dept
> begin :rtc := rtc_dept; end;
>
> *
> ERROR at line 1:
> ORA-06550: line 1, column 15:
> PLS-00382: expression is of wrong type
> ORA-06550: line 1, column 7:
> PL/SQL: Statement ignored
>
>
> scott> PRINT rtc
> ERROR:
> ORA-24338: statement handle not executed
>
>
> Error printing variable "rtc"
> scott>
>
> what is wrong ?
>
> Eriovaldo do Carmo Andrietta
> Widesoft Sistemas Ltda.
> Limeira/SP - Brasil
>
>
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: jkstill_at_cybcon.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Feb 20 2001 - 12:00:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US