Loading Column Data in csv File

Question:

Using sql loader, we will load the file data to table.  But the difficulties is, loading data contains 12 months.  
But in a table we have date as only one column.

i.e., for each record in a file we have to load 12 records in a table.

How to load this type of data in  a oracle table?

Solution:

Although the solution is manual it will work. We can also use cursor to do the same job.

CREATE TABLE ZZZ(CTRY VARCHAR2(20), FC VARCHAR2(20), MFT VARCHAR2(20), A200908 VARCHAR2(20), B200909 VARCHAR2(20), C200910 VARCHAR2(20), D200911 VARCHAR2(20), E200912 VARCHAR2(20), F201001 VARCHAR2(20));

DROP TABLE ZZZ;

INSERT into zzz values('AT', '001M', 'Ren', '0', '3', '4', '0', '0', '0'); INSERT into zzz values('AT', '002M', 'Ren', '521', '614', '574', '613', '448', '503'); INSERT into zzz values('AT', '002M', 'Dac', '0', '3', '2', '0', '0', '0');
 

CREATE TABLE ZZZ3(CTRY VARCHAR2(20), FC VARCHAR2(20), MFT VARCHAR2(20), DATE1 VARCHAR2(20), Qty VARCHAR2(20));

SELECT  ctry, fc, mft, '200908', A200908 FROM ZZZ UNION ALL SELECT  ctry, fc, mft, '200910',b200909 FROM ZZZ UNION ALL SELECT  ctry, fc, mft, '200910',c200910 FROM ZZZ UNION ALL SELECT  ctry, fc, mft, '200911',d200911 FROM ZZZ UNION ALL SELECT  ctry, fc, mft, '200912',e200912 FROM ZZZ UNION ALL SELECT  ctry, fc, mft, '201001',f201001 FROM ZZZ

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.