Home » RDBMS Server » Server Utilities » Need help to write SQL*LOADER control file.
Need help to write SQL*LOADER control file. [message #270133] Tue, 25 September 2007 18:47 Go to next message
vshalpatel
Messages: 5
Registered: September 2007
Junior Member
I have a source *.csv file that I am loading in oracle database TABLE ( oracle 9i versin 9.2)
using SQL*LOADER. I am trying to explain the scenario below.


data file: product_metatag.csv

styl DESCRIPTION
2001,"Peep-toe Shoe, Women's, Seen in Hollywood"
2002,"Star watch, flat, ballerina shoes"
2003,"patent shoes, ballerina shoes, low, flat shoe"
2004,"round toe, high heel"
2005,"men's business wear, casual male, dating scene"
2006,"men's business wear"
2007,"pointy toe, women's,high"
2008, men's business wear
2009, ballerina shoes

Note : there are 2 columns in source file ( column heading is there)
if there is coma (,) in the values under DESCRIPTION column then, values appears enclosed by " "
othervise value is not enclosed in " "( check record with styl: 2008, 2009).
only values under DESCRIPTION column is loaded in the target table named: metadata.
values under styl column should not be loaded in target table ( filler )


TARGET TABLE: metadata (should look like this:)

ID METATAG
1001 Peep-toe Shoe
1002 Women's
1003 Seen in Hollywood
1004 Star watch
1005 flat
1006 ballerina shoes
1007 low
1008 flat shoe
1009 round toe
1010 high heel
1011 men's business wear
1012 casual male
1013 dating scene
1014 pointy toe
1015 high

Note: METATAG is primary key , so each value under METATAG must appear only once.
ID is generated by ORACLE SEQUENCE.

Que: i created control file. I USED multiple 'INTO' STATEMENT and I used the sql*loader keyword POSITION,
to read the same physical record from differnt position and load in to target table column: metatag.
but i couldnt succeded. i didnt get desired result.
can someone please give me logic in control file to load the source data in desired format?

any help will be highly appreciated

Thanks
Vishal
Re: Need help to write SQL*LOADER control file. [message #270167 is a reply to message #270133] Wed, 26 September 2007 00:45 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
First,
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Then,
Post your control file and why you "didnt get desired result".

Regards
Michel
Previous Topic: full database export with fake values of data
Next Topic: Replacing Zero
Goto Forum:
  


Current Time: Wed Dec 25 10:12:50 CST 2024