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: Pl/sql bulk collect problem

RE: Pl/sql bulk collect problem

From: Mercadante, Thomas F (LABOR) <Thomas.Mercadante_at_labor.state.ny.us>
Date: Wed, 12 Dec 2007 13:23:45 -0500
Message-ID: <ABB9D76E187C5146AB5683F5A07336FF018E3026@EXCNYSM0A1AJ.nysemail.nyenet>


Joe,

Try declaring your PL/SQL tables as just plain numbers?

TYPE lat_type IS TABLE OF NUMBER INDEX BY PLS_INTEGER;

Tom

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sweetser, Joe Sent: Wednesday, December 12, 2007 12:28 PM To: oracle-l_at_freelists.org
Subject: Pl/sql bulk collect problem

Disclaimer: I am not anything even close to a programmer.

But I am playing around with FORALL and BULK COLLECT. I am trying to convert character values to numeric ones and then update a table with the numeric values. The character data can have up to 10 digits to the right of the decimal point so I am trying to convert that to a number and round it to 6 digits of accuracy. There are also some NULL values in those character fields.

I have a table that has (among others) these columns defined:

desc risksr
ID_BUILDING NUMBER(10)
<snip>

LOCLATITUDE VARCHAR2(25)
LOCLONGITUDE VARCHAR2(25)
<snip>

I have the following declarations in my pl/sql code:

TYPE id_type IS TABLE OF NUMBER INDEX BY PLS_INTEGER; TYPE lat_type IS TABLE OF NUMBER(10,6) INDEX BY PLS_INTEGER; TYPE long_type IS TABLE OF NUMBER(10,6) INDEX BY PLS_INTEGER; b_id_data id_type; b_lat_data lat_type; b_long_data long_type;

And my select statement is:

    SELECT id_building,

           NVL(ROUND(TO_NUMBER(loclatitude), 6), 99999),
           NVL(ROUND(TO_NUMBER(loclongitude), 6), 99999)
    BULK COLLECT INTO b_id_data, b_lat_data, b_long_data
    FROM risksr;

When I try to run this, I get:

DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: Bulk bind: Error in define ORA-06512: at line 102

102 is the line where my select statement is. I've been OTN'ing, Metalink'ing and google'ing with no luck on this error.

Is it wrong to try and convert the data during a BULK COLLECT operation? Any other ideas/pointers/suggestions welcome as well.

Thanks,
-joe  

Confidentiality Note: This message contains information that may be confidential and/or privileged. If you are not the intended recipient, you should not use, copy, disclose, distribute or take any action based on this message. If you have received this message in error, please advise the sender immediately by reply email and delete this message. Although ICAT Managers, LLC scans e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses. Thank you.

--
http://www.freelists.org/webpage/oracle-l




--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 12 2007 - 12:23:45 CST

Original text of this message

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