473,495 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Loading from a column

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
5 4670
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
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1915
by: Bill Stock | last post by:
The few times in the past that I've loaded unbound data, I've tended to cheat and use temp tables (not really unbound) or use code for small datasets. I'm currently involved in a project that...
5
12205
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
4
357
by: Fred Nelson | last post by:
I have an applicatioin that I'm writing that uses a "case" file that contains over 350 columns and more may be added in the future. I would like to create a dataset with all the column names and...
5
4311
by: schapopa | last post by:
I have a flex grid and I am loading data to this flex grid in this way While sqldr.Read j = j + 1 MSFlexGrid1PLSummary.set_TextMatrix(MSFlexGrid1PLSummary.Row, MSFlexGrid1PLSummary.Col,...
7
7126
by: tojigneshshah | last post by:
Hi, I am loading data from ascii delimiter file and some of the rows are getting rejected while loading. 1.0|11487.0|FQ|105061.0|332735.0|01|X.NNIE HATFIELD|1992-06-25 00:00:00|1992-...
1
1815
by: aj | last post by:
DB2 WSUE LUW v8.2 FP4 (aka v8.1 FP11) RHEL AS 4 I am EXPORTing in IXF format from one schema and then LOADing into another schema. The DB modeling tool I am using likes to put the PK columns...
1
1556
by: gspk | last post by:
Hi, I have a input file in the following format , 1-4 5-8 9-10 11 12-14 ------------------------------------ 1000 +500 25 1 250 2000 -520 55 1 25 2500 *525 55 1 125
10
13359
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
5
6822
by: yeoj13 | last post by:
Hello, I have a db2load script I'm using to populate a large table. Ideally, my target table is required to have "Not Null" constraints on a number of different columns. I've noticed a ...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.