Home » RDBMS Server » Server Utilities » Converting Column headings into values
Converting Column headings into values [message #395111] Tue, 31 March 2009 05:50 Go to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
I am trying to import csv/txt files using sql loader and want to have some of the column headings entered as values into the column of the target oracle table while loading or manipulated afterwards via SQL code. Can anyone please help?
Re: Converting Column headings into values [message #395115 is a reply to message #395111] Tue, 31 March 2009 06:08 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post an example of what you mean.

Regards
Michel
Re: Converting Column headings into values [message #395142 is a reply to message #395111] Tue, 31 March 2009 08:16 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
ok, i will receive files with name and adress details with various brochure names as column headers with the qty ordered values under each brochure name columns.

In the target oracle table there is a column named 'Brochure Name', so when i import the file into this table the actual Column name has to be entered into this column.

thats why i don't know how to transform the incoming column names into a column of the target table as values.

Any help would be greatly appreciated.
Re: Converting Column headings into values [message #395151 is a reply to message #395111] Tue, 31 March 2009 08:38 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
example:

Incoming file -

Name Tour_London Tour_Paris Tour_NewYork
----- ------------ ---------- -------------
Smith 1 0 1
David 2 0 0
Carl 0 2 0
Wendy 0 1 1


Target Oracle Table -

Name Brochure_Name Qty_Ordered
----- ------------- ------------
Smith Tour_London 1
Smith Tour_NewYork 1
David Tour_London 2
Carl Tour_Paris 2
Wendy Tour_Paris 1
Wendy Tour_NewYork 1


[Updated on: Tue, 31 March 2009 08:40]

Report message to a moderator

Re: Converting Column headings into values [message #395153 is a reply to message #395111] Tue, 31 March 2009 08:42 Go to previous messageGo to next message
cookiemonster
Messages: 12422
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is the number of brochure columns fixed or variable?
Re: Converting Column headings into values [message #395163 is a reply to message #395151] Tue, 31 March 2009 09:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use external table then you have the power of SQL by hand and all pivoting/unpivoting techniques.

Regards
Michel
Re: Converting Column headings into values [message #395173 is a reply to message #395163] Tue, 31 March 2009 09:56 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
what is external table?
Re: Converting Column headings into values [message #395174 is a reply to message #395153] Tue, 31 March 2009 10:00 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
can vary.....
Re: Converting Column headings into values [message #395175 is a reply to message #395111] Tue, 31 March 2009 10:01 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
how could i create pivot table from SQL?
Re: Converting Column headings into values [message #395181 is a reply to message #395111] Tue, 31 March 2009 10:06 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>how could i create pivot table from SQL?
by using PIVOT

http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#CHDCEJJE
Re: Converting Column headings into values [message #395192 is a reply to message #395173] Tue, 31 March 2009 10:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ravin_C wrote on Tue, 31 March 2009 16:56
what is external table?

Click on the link I posted.

Quote:
how could i create pivot table from SQL?

There are many and many examples here.

Regards
Michel
Re: Converting Column headings into values [message #395385 is a reply to message #395111] Wed, 01 April 2009 05:00 Go to previous messageGo to next message
Ravin_C
Messages: 38
Registered: February 2008
Location: United Kingdom
Member
ok, I want to know the SQL syntax that could be used to transform my input data into pivotted data, please help!
Re: Converting Column headings into values [message #395389 is a reply to message #395385] Wed, 01 April 2009 05:09 Go to previous message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please search!

Regards
Michel
Previous Topic: SQLLDR
Next Topic: Import using impdp alongwith Internal error
Goto Forum:
  


Current Time: Fri Dec 09 05:56:02 CST 2016

Total time taken to generate the page: 0.05498 seconds