Inserting records in a cursor solved 2004-03-03 - By Jared.Still@(protected)
All this looping is making me nauseated
;)
"Juan Cachito Reyes Pacheco " <jreyes@(protected) >
Sent by: oracle-l-bounce@(protected)
03/03/2004 01:07 PM
Please respond to oracle-l
To: <oracle-l@(protected) >
cc:
Subject: Re: Inserting records in a cursor solved
thanks chris, jamadagni and igor
Here is the solution, solving (until new bug found) my bug in function
tables :)
FUNCTION TEST
return TYP_CCO_IMPUTACION
as
l_data TYP_CCO_IMPUTACION := TYP_CCO_IMPUTACION();
begin
for i in 1..10
loop
l_data.extend;
l_data(l_data.count) :=
TYO_CCO_IMPUTACION( i,i,i,i,i,i,i );
end loop;
return l_data;
end;
select *
from the ( select cast( test as TYP_CCO_IMPUTACION )
from dual )
-- -- Original Message -- --
From: "Chris Stephens " <ChrisStephens@(protected) >
To: <oracle-l@(protected) >
Sent: Wednesday, March 03, 2004 4:59 PM
Subject: RE: Inserting records in a cursor
Excellent spanglish!
-- --Original Message-- --
From: Jamadagni, Rajendra [mailto:Rajendra.Jamadagni@(protected)]
Sent: Wednesday, March 03, 2004 2:56 PM
To: oracle-l@(protected)
Subject: RE: Inserting records in a cursor
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 is
TuBLA ctb.typ_cco_imputacion;
begin
for i in 1 .. 10
loop
TUBLA(i).nTotal := i;
TUBLA(i).cCCO1 := 'ccol1 ' || i;
TUBLA(i).cCCO2 := 'ccol2 ' || i;
TUBLA(i).cCCO3 := 'ccol3 ' || i;
TUBLA(i).cCCO4 := 'ccol4 ' || i;
TUBLA(i).cCCO5 := 'ccol5 ' || i;
TUBLA(i).nMonto := i;
end loop;
retturn tubla;
end;
/
something like this should work ...
Raj
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
----
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
select standard_disclaimer from company_requirements;
QOTD: Any clod can have facts, having an opinion is an art !
-- --Original Message-- --
From: oracle-l-bounce@(protected)
[mailto:oracle-l-bounce@(protected)]On Behalf Of Juan Cachito Reyes
Pacheco
Sent: Wednesday, March 03, 2004 3:43 PM
To: oracle-l@(protected)
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 (See ORA-06531.ora-code.com): Referencia a una recopilaci¨Žn no inicializada
-- -- Original Message -- --
From: "Jamadagni, Rajendra " <Rajendra.Jamadagni@(protected) >
To: <oracle-l@(protected) >
Sent: Wednesday, March 03, 2004 4:16 PM
Subject: RE: Inserting records in a cursor
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
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
----
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
select standard_disclaimer from company_requirements;
QOTD: Any clod can have facts, having an opinion is an art !
-- --Original Message-- --
From: oracle-l-bounce@(protected)
[mailto:oracle-l-bounce@(protected)]On Behalf Of Juan Cachito Reyes
Pacheco
Sent: Wednesday, March 03, 2004 3:07 PM
To: oracle-l@(protected)
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;
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
<br > <font size=2 face= "sans-serif " >All this looping is making me nauseated </font >
<br >
<br > <font size=2 face= "sans-serif " >;) </font >
<br >
<br >
<br >
<br >
<table width=100% >
<tr valign=top >
<td >
<td > <font size=1 face= "sans-serif " > <b >"Juan Cachito Reyes Pacheco" <jreyes@(protected)> </b > </font >
<br > <font size=1 face= "sans-serif " >Sent by: oracle-l-bounce@(protected) </font >
<p > <font size=1 face= "sans-serif " > 03/03/2004 01:07 PM </font >
<br > <font size=2 face= "sans-serif " > </font > <font size=1 face= "sans-serif " >Please respond to oracle-l </font >
<br >
<td > <font size=1 face= "Arial " > </font >
<br > <font size=1 face= "sans-serif " > To: <oracle-l@(protected)> </font >
<br > <font size=1 face= "sans-serif " > cc: </font >
<br > <font size=1 face= "sans-serif " > Subject: Re: Inserting records in a cursor solved </font > </table >
<br >
<br >
<br > <font size=2 face= "Courier New " >thanks chris, jamadagni and igor <br >
<br >
Here is the solution, solving (until new bug found) my bug in function <br >
tables :) <br >
<br >
FUNCTION TEST <br >
<br >
return TYP_CCO_IMPUTACION <br >
<br >
as <br >
<br >
l_data TYP_CCO_IMPUTACION := TYP_CCO_IMPUTACION(); <br >
<br >
begin <br >
<br >
for i in 1..10 <br >
<br >
loop <br >
<br >
l_data.extend; <br >
<br >
l_data(l_data.count) := <br >
<br >
TYO_CCO_IMPUTACION( i,i,i,i,i,i,i ); <br >
<br >
end loop; <br >
<br >
<br >
return l_data; <br >
<br >
end; <br >
<br >
<br >
<br >
<br >
<br >
<br >
<br >
select * <br >
<br >
from the ( select cast( test as TYP_CCO_IMPUTACION ) <br >
<br >
from dual ) <br >
<br >
-- -- Original Message -- -- <br >
From: "Chris Stephens" <ChrisStephens@(protected)> <br >
To: <oracle-l@(protected)> <br >
Sent: Wednesday, March 03, 2004 4:59 PM <br >
Subject: RE: Inserting records in a cursor <br >
<br >
<br >
Excellent spanglish! <br >
<br >
-- --Original Message-- -- <br >
From: Jamadagni, Rajendra [mailto:Rajendra.Jamadagni@(protected)] <br >
Sent: Wednesday, March 03, 2004 2:56 PM <br >
To: oracle-l@(protected) <br >
Subject: RE: Inserting records in a cursor <br >
<br >
CREATE OR REPLACE TYPE ctb.tyo_cco_imputacion AS OBJECT( <br >
nTotal NUMBER, <br >
cCCO1 VARCHAR2(9), <br >
cCCO2 VARCHAR2(9), <br >
cCCO3 VARCHAR2(9), <br >
cCCO4 VARCHAR2(9), <br >
cCCO5 VARCHAR2(9), <br >
nMonto NUMBER(16,2)) <br >
/ <br >
<br >
CREATE OR REPLACE TYPE ctb.typ_cco_imputacion AS TABLE OF <br >
CTB.TYO_CCO_IMPUTACION; <br >
/ <br >
<br >
create functoin load return ctb.typ_cco_imputacion is <br >
TuBLA ctb.typ_cco_imputacion; <br >
begin <br >
for i in 1 .. 10 <br >
loop <br >
TUBLA(i).nTotal := i; <br >
TUBLA(i).cCCO1 := 'ccol1 ' || i; <br >
TUBLA(i).cCCO2 := 'ccol2 ' || i; <br >
TUBLA(i).cCCO3 := 'ccol3 ' || i; <br >
TUBLA(i).cCCO4 := 'ccol4 ' || i; <br >
TUBLA(i).cCCO5 := 'ccol5 ' || i; <br >
TUBLA(i).nMonto := i; <br >
end loop; <br >
retturn tubla; <br >
end; <br >
/ <br >
<br >
something like this should work ... <br >
Raj <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- <br >
---- <br >
Rajendra dot Jamadagni at nospamespn dot com <br >
All Views expressed in this email are strictly personal. <br >
select standard_disclaimer from company_requirements; <br >
QOTD: Any clod can have facts, having an opinion is an art ! <br >
<br >
<br >
-- --Original Message-- -- <br >
From: oracle-l-bounce@(protected) <br >
[mailto:oracle-l-bounce@(protected)]On Behalf Of Juan Cachito Reyes <br >
Pacheco <br >
Sent: Wednesday, March 03, 2004 3:43 PM <br >
To: oracle-l@(protected) <br >
Subject: Re: Inserting records in a cursor <br >
<br >
</font >
<br > <font size=2 face= "Courier New " >Could you please give a complete example creating a cursor, and adding <br >
values and returning :) pleeease... if I 'm not abusing of you. <br >
I 'm getting other error messages. <br >
<br >
<br >
declare <br >
<br >
Tabla ctb.typ_cco_imputacion; <br >
<br >
begin <br >
<br >
Tabla(1).ntotal := 1; <br >
<br >
Tabla(2).ntotal := 1; <br >
<br >
Tabla(3).ntotal := 1; <br >
<br >
tabla(4).ntotal := 1; <br >
<br >
--RETURN Tabla; <br >
<br >
rollback; <br >
<br >
end; <br >
<br >
16:39:00 ORA-06531 (See ORA-06531.ora-code.com): Referencia a una recopilaci¨Žn no inicializada <br >
<br >
-- -- Original Message -- -- <br >
From: "Jamadagni, Rajendra" <Rajendra.Jamadagni@(protected)> <br >
To: <oracle-l@(protected)> <br >
Sent: Wednesday, March 03, 2004 4:16 PM <br >
Subject: RE: Inserting records in a cursor <br >
<br >
<br >
you are probably confused between a table (a rdbms entity) and a collection <br >
(aka pl/sql table). Collections do not use DML statements, you need to treat <br >
them like arrays ... that 's what they are. <br >
<br >
tubla[1].ntotal := 1; <br >
tubla[2].ntotal := 1; <br >
tubla[3].ntotal := 1; <br >
tubla[4].ntotal := 1; <br >
<br >
Raj <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- <br >
---- <br >
Rajendra dot Jamadagni at nospamespn dot com <br >
All Views expressed in this email are strictly personal. <br >
select standard_disclaimer from company_requirements; <br >
QOTD: Any clod can have facts, having an opinion is an art ! <br >
<br >
<br >
-- --Original Message-- -- <br >
From: oracle-l-bounce@(protected) <br >
[mailto:oracle-l-bounce@(protected)]On Behalf Of Juan Cachito Reyes <br >
Pacheco <br >
Sent: Wednesday, March 03, 2004 3:07 PM <br >
To: oracle-l@(protected) <br >
Subject: Inserting records in a cursor <br >
<br >
<br >
Hi, maybe this is a stupid question, but I didn 't it before, I want to <br >
create a cursor load data, and return in in a funciton <br >
something like <br >
<br >
If you can please, thank you. <br >
CREATE OR REPLACE <br >
<br >
TYPE ctb.tyo_cco_imputacion AS OBJECT <br >
<br >
( <br >
<br >
nTotal NUMBER, <br >
<br >
cCCO1 VARCHAR2(9), <br >
<br >
cCCO2 VARCHAR2(9), <br >
<br >
cCCO3 VARCHAR2(9), <br >
<br >
cCCO4 VARCHAR2(9), <br >
<br >
cCCO5 VARCHAR2(9), <br >
<br >
nMonto NUMBER(16,2) <br >
<br >
) <br >
<br >
/ <br >
<br >
CREATE OR REPLACE <br >
<br >
TYPE ctb.typ_cco_imputacion AS TABLE OF CTB.TYO_CCO_IMPUTACION; <br >
<br >
/ <br >
<br >
<br >
<br >
create functoin load return ctb.typ_cco_imputacion <br >
<br >
TuBLA typ_cco_imputacion; <br >
<br >
begin <br >
<br >
insert into TUBLA values(1,2,3,4); <br >
<br >
insert into TUBLA values(1,4,3,4); <br >
<br >
.... <br >
<br >
retturn tubla <br >
<br >
end; <br >
<br >
<br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- </font >
<br > <font size=2 face= "Courier New " >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- <br >
<br >
<br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- <br >
<br >
<br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
Please see the official ORACLE-L FAQ: http://www.orafaq.com <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ <br >
To unsubscribe send email to: oracle-l-request@(protected) <br >
put 'unsubscribe ' in the subject line. <br >
-- <br >
Archives are at http://www.freelists.org/archives/oracle-l/ <br >
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html <br >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- <br >
</font >
<br >
<br >
|
|