Home » RDBMS Server » Server Utilities » SqlLoader Substring in Control File
SqlLoader Substring in Control File [message #301648] Thu, 21 February 2008 04:16 Go to next message
ginshin
Messages: 5
Registered: February 2008
Junior Member
Hi,

I have this Control File :
LOAD DATA INFILE "C:\Temp\ChgEvt.DAT"
APPEND 
INTO TABLE EVT
 FIELDS TERMINATED X'09'
 TRAILING NULLCOLS
 (F1,F2,F3,F4,F5,F6,F7,F8,F9,EVT_MAJ,EVT_GUILTY,EVT_DDM)


In the shema of my Oracle Database, the field F9 is a varchar2(4000). Sometimes the source file C:\Temp\ChgEvt.DAT contains data >4000 characters in the F9 field !

What is the solution ? Truncate the data ?
Re: SqlLoader Substring in Control File [message #301651 is a reply to message #301648] Thu, 21 February 2008 04:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
See "Applying SQL Operators to Fields", in Database Utilities, Part II SQL*Loader, Chapter 9 Field List Reference and use SUBSTR.

Regards
Michel
Re: SqlLoader Substring in Control File [message #301690 is a reply to message #301651] Thu, 21 February 2008 06:44 Go to previous messageGo to next message
ginshin
Messages: 5
Registered: February 2008
Junior Member
If i use a CLOB type for the F9 field, is it possible to make request such as

select * from MyTable where F9 like '%test%'


Re: SqlLoader Substring in Control File [message #301700 is a reply to message #301690] Thu, 21 February 2008 07:15 Go to previous messageGo to next message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Answer depends on your version.

Regards
Michel
Re: SqlLoader Substring in Control File [message #301703 is a reply to message #301648] Thu, 21 February 2008 07:18 Go to previous messageGo to next message
ginshin
Messages: 5
Registered: February 2008
Junior Member
Oracle 9i
Re: SqlLoader Substring in Control File [message #301705 is a reply to message #301703] Thu, 21 February 2008 07:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
9.0 or 9.2?

Well, in this case it works in both but this is not true for all features.

Regards
Michel
Re: SqlLoader Substring in Control File [message #301709 is a reply to message #301648] Thu, 21 February 2008 07:39 Go to previous messageGo to next message
ginshin
Messages: 5
Registered: February 2008
Junior Member
9.2.0.7

My first step is so to change my F9 field from varchar2(4000) to CLOB.

An what can i place in my control file to load this CLOB field ?
Re: SqlLoader Substring in Control File [message #301713 is a reply to message #301709] Thu, 21 February 2008 07:51 Go to previous messageGo to next message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No change in your control file.
But there may be changed in your object management.
You don't administrate the same way a varchar2 and a clob.
Oracle does not use the same mechanisms to handle them. Accesses and undos are different.

Regards
Michel
Re: SqlLoader Substring in Control File [message #301716 is a reply to message #301648] Thu, 21 February 2008 07:55 Go to previous messageGo to next message
ginshin
Messages: 5
Registered: February 2008
Junior Member
My table is empty, i want to alter it and define the CLOB type :

ORA-22858: invalid alteration of datatype


Confused
Re: SqlLoader Substring in Control File [message #301722 is a reply to message #301716] Thu, 21 February 2008 08:01 Go to previous message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't directly do alter.
You have to add a CLOB column, move the data to the new column, drop the old column, rename the new one.
Or create a new table as select from the old one, drop the old table and rename the new one.
Or use dbms_redefinition package
Or use export/drop table/recreate table/import
Or...

But you can't directly use alter table.

Regards
Michel
Previous Topic: Multiple WHEN conditions in SQL*Loader
Next Topic: Can we use SYSTIMESTAMP in SQL Loader
Goto Forum:
  


Current Time: Sat Jun 08 21:01:28 CDT 2024