| Oracle9i Application Developer's Guide - Large Objects (LOBs) Release 1 (9.0.1) Part Number A88879-01 |
|
Managing LOBs , 7 of 12
This is a very fast and simple way to load LOBs. Unfortunately, the LOBs to be loaded are not usually the same size.
|
Note:
A possible work-around is to pad |
To load LOBs using this format, use either CHAR or RAW as the loading datatype. For example:
LOAD DATA INFILE 'sample.dat' "fix 21" INTO TABLE Multimedia_tab (Clip_ID POSITION(1:3) INTEGER EXTERNAL, Story POSITION(5:20) CHAR DEFAULTIF Story=BLANKS)
007 Once upon a time
If the datafield containing the story is empty, then an empty LOB instead of a NULL LOB is produced. A NULL LOB is produced only if the NULLIF clause is used instead of the DEFAULTIF clause. You can use loader datatypes other than CHAR to load LOBs. Use the RAW datatype when loading BLOBs.
Loading different size LOBs in the same column (that is, datafile field) is not a problem. The trade-off for this added flexibility is performance. Loading in this format is somewhat slower because the loader has to scan through the data, looking for the delimiter string. For example:
LOAD DATA INFILE 'sample1.dat' "str '<endrec>\n'" INTO TABLE Multimedia_tab FIELDS TERMINATED BY ',' ( Clip_ID CHAR(3), Story CHAR(507) ENCLOSED BY '<startlob>' AND '<endlob>' )
007, <startlob> Once upon a time,The end. <endlob>| 008, <startlob> Once upon another time ....The end. <endlob>|
You could use VARCHAR (see Oracle9i Utilities), VARCHARC, or VARRAW datatypes to load LOB data organized in this way. Note that this method of loading produces better performance over the previous method, however, it removes some of the flexibility, that is, it requires you to know the LOB length for each LOB before loading. For example:
LOAD DATA INFILE 'sample2.dat' "str '<endrec>\n'" INTO TABLE Multimedia_tab FIELDS TERMINATED BY ',' ( Clip_ID INTEGER EXTERNAL (3), Story VARCHARC (3, 500) )
007,041 Once upon a time... .... The end. <endrec> 008,000 <endrec>
|
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|