Oracle8i Application Developer's Guide - Large Objects (LOBs) Release 2 (8.1.6) Part Number A76940-01 |
|
Managing LOBs , 6 of 10
This is a very fast and simple way to load LOB
s. 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 if the NULLIF
directive was used instead of the DEFAULTIF
directive. Also note that you can use loader datatypes other than CHAR
to load LOB
S. Use the RAW datatype when loading BLOBs.
Loading different size LOB
s 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 Oracle8i 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-2000, Oracle Corporation. All Rights Reserved. |
|