Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Inserting records in a cursor
Before using an element in the collection, you should extend collection
(initialize collection element):
First:
Tabla.EXTEND;
Then:
Tabla(1).ntotal := 1;
And so on...
Igor Neyman, OCP DBA
ineyman_at_perceptron.com
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Juan Cachito Reyes
Pacheco
Sent: Wednesday, March 03, 2004 3:43 PM
To: oracle-l_at_freelists.org
Subject: Re: Inserting records in a cursor
Could you please give a complete example creating a cursor, and adding values and returning :) pleeease... if I'm not abusing of you. I'm getting other error messages.
declare
Tabla ctb.typ_cco_imputacion;
begin
Tabla(1).ntotal := 1;
Tabla(2).ntotal := 1;
Tabla(3).ntotal := 1;
tabla(4).ntotal := 1;
--RETURN Tabla;
rollback;
end;
16:39:00 ORA-06531: Referencia a una recopilación no inicializada
you are probably confused between a table (a rdbms entity) and a
collection
(aka pl/sql table). Collections do not use DML statements, you need to
treat
them like arrays ... that's what they are.
tubla[1].ntotal := 1; tubla[2].ntotal := 1; tubla[3].ntotal := 1; tubla[4].ntotal := 1;
Raj
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Juan Cachito Reyes
Pacheco
Sent: Wednesday, March 03, 2004 3:07 PM
To: oracle-l_at_freelists.org
Subject: Inserting records in a cursor
Hi, maybe this is a stupid question, but I didn't it before, I want to create a cursor load data, and return in in a funciton something like
If you can please, thank you.
CREATE OR REPLACE
TYPE ctb.tyo_cco_imputacion AS OBJECT
(
nTotal NUMBER,
cCCO1 VARCHAR2(9),
cCCO2 VARCHAR2(9),
cCCO3 VARCHAR2(9),
cCCO4 VARCHAR2(9),
cCCO5 VARCHAR2(9),
nMonto NUMBER(16,2)
)
/
CREATE OR REPLACE TYPE ctb.typ_cco_imputacion AS TABLE OF CTB.TYO_CCO_IMPUTACION;
/
create functoin load return ctb.typ_cco_imputacion
TuBLA typ_cco_imputacion;
begin
insert into TUBLA values(1,2,3,4);
insert into TUBLA values(1,4,3,4);
....
retturn tubla
end;
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlput 'unsubscribe' in the subject line.
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
![]() |
![]() |