Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: Loading from a column

Re: Loading from a column

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 5 Feb 2004 10:33:30 -0800
Message-ID: <4b5394b2.0402051033.9bd3846@posting.google.com>


DMina_at_laiki.com (Demetris) wrote in message news:<c5285638.0402050340.3e482dc0_at_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. Received on Thu Feb 05 2004 - 12:33:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US