dbTalk Databases Forums  

Issue while inserting data through sqlldr

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Issue while inserting data through sqlldr in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sandy80
 
Posts: n/a

Default Issue while inserting data through sqlldr - 09-14-2010 , 08:56 AM






Hi,

I am having an issue while inserting data into an oracle table through
sqlldr. My requirement is to be able to enter data into a field with 4
decimal places. Since I am getting data which has values with more
than 4 decimal places those records are rejected.

I use the following command in the control file for the table:

LOAD DATA
APPEND
INTO TABLE TB_01
WHEN record_type_CD = 'RECORD'
FIELDS TERMINATED BY "|"
trailing NULLCOLS
(
COLUMN_1 INTEGER EXTERNAL,
COLUMN_2 CHAR
"TO_NUMBER(:COLUMN_2,'999999999.9999')",
COLUMN_3 INTEGER EXTERNAL
)
The records get rejected when the data for column 2 is like "|
80300.3519999999989522621035575866699219|"

If I change the control file and make the code for column 2 as
COLUMN_2 CHAR "TO_CHAR(:COLUMN_2,'999999999D9999')"
then the load rejects records with data like "|4257000000|" in column
2.

I want to be able to insert both the records into the table with the
value being limited to 4 decimal places. Let me know if you can
provide any help on this. Any help would be appreciated. Thanks!

Reply With Quote
  #2  
Old   
gazzag
 
Posts: n/a

Default Re: Issue while inserting data through sqlldr - 09-14-2010 , 09:42 AM






On 14 Sep, 14:56, Sandy80 <svarshneym... (AT) gmail (DOT) com> wrote:
Quote:
Hi,

I am having an issue while inserting data into an oracle table through
sqlldr. My requirement is to be able to enter data into a field with 4
decimal places. Since I am getting data which has values with more
than 4 decimal places those records are rejected.

I use the following command in the control file for the table:

LOAD DATA
* *APPEND
* *INTO TABLE TB_01
* * * * WHEN record_type_CD = 'RECORD'
* * * * FIELDS TERMINATED BY "|"
* * * * trailing NULLCOLS
(
* * * *COLUMN_1 * * * * INTEGER * * * * EXTERNAL,
* * * *COLUMN_2 * * * * CHAR
* * * * * * * * "TO_NUMBER(:COLUMN_2,'999999999.9999')",
* * * *COLUMN_3 * * * *INTEGER * * * * *EXTERNAL
)
The records get rejected when the data for column 2 is like "|
80300.3519999999989522621035575866699219|"

If I change the control file and make the code for column 2 as
COLUMN_2 * * * * CHAR * * * * * "TO_CHAR(:COLUMN_2,'999999999D9999')"
then the load rejects records with data like "|4257000000|" in column
2.

I want to be able to insert both the records into the table with the
value being limited to 4 decimal places. Let me know if you can
provide any help on this. Any help would be appreciated. Thanks!
Have you tried the TRUNC function?


HTH
-g

Reply With Quote
  #3  
Old   
ddf
 
Posts: n/a

Default Re: Issue while inserting data through sqlldr - 09-14-2010 , 11:06 AM



On Sep 14, 10:42*am, gazzag <gar... (AT) jamms (DOT) org> wrote:
Quote:
On 14 Sep, 14:56, Sandy80 <svarshneym... (AT) gmail (DOT) com> wrote:





Hi,

I am having an issue while inserting data into an oracle table through
sqlldr. My requirement is to be able to enter data into a field with 4
decimal places. Since I am getting data which has values with more
than 4 decimal places those records are rejected.

I use the following command in the control file for the table:

LOAD DATA
* *APPEND
* *INTO TABLE TB_01
* * * * WHEN record_type_CD = 'RECORD'
* * * * FIELDS TERMINATED BY "|"
* * * * trailing NULLCOLS
(
* * * *COLUMN_1 * * * * INTEGER * * * * EXTERNAL,
* * * *COLUMN_2 * * * * CHAR
* * * * * * * * "TO_NUMBER(:COLUMN_2,'999999999.9999')",
* * * *COLUMN_3 * * * *INTEGER * * * * *EXTERNAL
)
The records get rejected when the data for column 2 is like "|
80300.3519999999989522621035575866699219|"

If I change the control file and make the code for column 2 as
COLUMN_2 * * * * CHAR * * * * * "TO_CHAR(:COLUMN_2,'999999999D9999')"
then the load rejects records with data like "|4257000000|" in column
2.

I want to be able to insert both the records into the table with the
value being limited to 4 decimal places. Let me know if you can
provide any help on this. Any help would be appreciated. Thanks!

Have you tried the TRUNC function?

HTH
-g- Hide quoted text -

- Show quoted text -
Or the round() function.



David Fitzjarrell

Reply With Quote
  #4  
Old   
Sandy80
 
Posts: n/a

Default Re: Issue while inserting data through sqlldr - 09-15-2010 , 02:57 AM



Thanks for the suggestions!

I removed all the earlier code and just put it as:

COLUMN_2 CHAR "TRUNC(:COLUMN_2,4)"

And this time it processed all the data properly, including the values
with no decimal places. It is working fine now!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.