From jkstill@cybcon.com Tue, 20 Feb 2001 10:00:55 -0800 From: jkstill@cybcon.com Date: Tue, 20 Feb 2001 10:00:55 -0800 Subject: Re: [Doubt] - Returning Type Table Message-ID: MIME-Version: 1.0 Content-Type: text/plain > 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@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@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).