Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: data loading question
Let's say the table in question looks like this:
MY_TAB:
tab_id tab_old_col1 tab_new_col2
------ ------------ ------------
1 32.00 <null> 2 23.99 <null> 3 44.50 <null> ... 99 15.45 <null>
Assuming tab_new_col2 is the column you added.
Let's start off with the easy senario: You want to have all values equal to one new value: UPDATE MY_TAB set TAB_NEW_COL2='New Product' where 1=1; This will apply this for all. You can do the same thing for select records: UPDATE MY_TAB set TAB_NEW_COL2='New Product' where tab_id between 1 and 25;
You must have some method of identifying which values go into tab_new_col2 based on some key value. So you must at least have a mapping of a key - value pair. In our example, lets say that tab_id is key. then you must have a datafile mapping the key to the new value, like:
1,"Product1" 2,"Product2" 3,"Another Product"
You could sql*load this file into a temp table (say TEMP_TAB) and run an update statement like: UPDATE MY_TAB set TAB_NEW_COL2=(select temp_col from TEMP_TAB where tab_id=temp_id);
In article <1998081113295500.JAA00722_at_ladder01.news.aol.com>,
iancrozier_at_aol.com (Iancrozier) wrote:
> I have a table which had a new column added recently.
> I now have data to load into this new column.
> Is there any way that I can just add data to this column?
> sqlload offers four methods:
> INSERT,REPLACE,APPEND AND TRUNCATE
>
> They only work on complete rows. Is there any way just to add data to
> ceratin columns? Thanks in advance.
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Tue Aug 11 1998 - 11:49:26 CDT
![]() |
![]() |