472,782 Members | 1,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

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 4641
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
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
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
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
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
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
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
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
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
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 ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.