By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,197 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,197 IT Pros & Developers. It's quick & easy.

Loading from a column

P: n/a
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Why not use sqlldr to load the data from the text file into table2? You can
use the fixed column position or a delimiter to separate the data into
different columns.

Alistair

"Demetris" <DM***@laiki.com> wrote in message
news:c5**************************@posting.google.c om...
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.

Jul 19 '05 #2

P: n/a
DM***@laiki.com (Demetris) wrote in message news:<c5**************************@posting.google. com>...
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.


Use the various String functions to split that data according to your needs.
for example

table1
keyid number
data_x char(660)

table2
keyid number
datapart1 number
datapart2 varchar(100)

insert into table2 (keyid, datapart1, datapart2) values
( select keyid, to_num(substr(data_x,1,10)), ltrim(substr(data_x,50,100))
from table1 ) ;

My syntax may be off, but you get the idea.

More complex conversions will require PL/SQL or other programming language.
Jul 19 '05 #3

P: n/a
"Alistair Thomson" <al******@despammed.com> wrote in message news:<bv*******************@news.demon.co.uk>...
Why not use sqlldr to load the data from the text file into table2? You can
use the fixed column position or a delimiter to separate the data into
different columns.

Alistair

"Demetris" <DM***@laiki.com> wrote in message
news:c5**************************@posting.google.c om...
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.


Detemtris, if the data is not in fixed absolute positions but is
relative to various delimiter characters or constants then look in the
SQL manual chapter on single row functions for substr, instr, and
other character manipulation functions.

HTH -- Mark D Powell --
Jul 19 '05 #4

P: n/a
I cannot load the data from the text file into the second table for a
reason.
In the first table there are some columns that are populated with data
derived from functions and must be unique. Those unique data must be
present in the second table as well.

"Alistair Thomson" <al******@despammed.com> wrote in message news:<bv*******************@news.demon.co.uk>...
Why not use sqlldr to load the data from the text file into table2? You can
use the fixed column position or a delimiter to separate the data into
different columns.

Alistair

"Demetris" <DM***@laiki.com> wrote in message
news:c5**************************@posting.google.c om...
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.

Jul 19 '05 #5

P: n/a
Thank all of you for the information you have provided me.
It was very helpful!

Thanks again
D. M i n a

ed********@magicinterface.com (Ed prochak) wrote in message news:<4b*************************@posting.google.c om>...
DM***@laiki.com (Demetris) wrote in message news:<c5**************************@posting.google. com>...
Hello there!
I have a table (table1) and one of its columns DATA_X is CHAR(660)
I will create another table (table2) similar to the above but i will
replace the DATA_X column with several columns (different data types)

The table1 is populated with data using a text file.
After the loading is finished on table1 i want to select all the data
from table1 and load it in table2. The DATA_X must be split in several
columns.

How do i perform this?

Thank you.


Use the various String functions to split that data according to your needs.
for example

table1
keyid number
data_x char(660)

table2
keyid number
datapart1 number
datapart2 varchar(100)

insert into table2 (keyid, datapart1, datapart2) values
( select keyid, to_num(substr(data_x,1,10)), ltrim(substr(data_x,50,100))
from table1 ) ;

My syntax may be off, but you get the idea.

More complex conversions will require PL/SQL or other programming language.

Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.