Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Oracle Column Data Convertion

Original Message
Name: delory
Date: January 9, 2008 at 04:21:48 Pacific
Subject: Oracle Column Data Convertion
OS: Oracle 9i
CPU/Ram: 1400 256
Model/Manufacturer: Compaq
Comment:
Hi everyone,

I have to run a conversion on multiple tables to change the data in one column on each table. I am happy to run this separately for each table, but I would like to know the best way to do this.

e.g. for table 1 with 50 colums and 1000 rows, I wish to change all the data in column 3 to new values based on a lookup spreadsheet I have, containing a list of old values and new values:

value1;value2;
value3;value4;
etc.

so I want to read the first row in the table, see the data in col3, and if it matches value1, change it value2, etc.

I want some kind of a scrip to do this so that I can then change the relevant details for the next table, and change the lookup table with the values for that table.

Does anyone have any suggestions on the most efficient way to do this please?

Many thanks.



Report Offensive Message For Removal


Response Number 1
Name: gohome88
Date: January 23, 2008 at 15:27:18 Pacific
Subject: Oracle Column Data Convertion
Reply: (edit)
By doing that,
1. create a lookup table with 2 columuns new and old
2. load the spreadsheet into the lookup table by using SQLloader
3. write PL/SQL
3.1 create cursor for the lookup table
3.2 wirte the cursor for loop to update the table with the new value

This piece of code can be reused for the rest of your tables.


gohome88


Report Offensive Follow Up For Removal

Response Number 2
Name: User123456789
Date: February 3, 2008 at 06:29:30 Pacific
Subject: Oracle Column Data Convertion
Reply: (edit)
Add the new column in the table, update the value accordingly (cant be that hard), change the PK or UK (if it involves any old column), remove the NOT NULL property from these old columns (if still present), empty the old values, try to remove the columns (wont work on 9i I guess, but have a try).

If the old columns bother you, you can go on to step 2, trying to recreate the table without those columns (create table as select ...), and/or "rename table ...".

Hi there.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Oracle Column Data Convertion

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




exessive internet traffic

ZoneAlarm Question. Blocked Connect

Windows Live Messenger Problem

Delete $Uninstall after SP3 updates

help for hp compaq laptop


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC