Change column datatype from varchar2 to number(10) and keep existing data

Hi,
I need to change the datatype on a column that already has data in it from a varchar2 to number(10). The data that is already there is not necessarily number data, however I must be able to keep the old data to. We are running 10g. Does anyone have any ideas? Thanks. Here's the current data.
Current Values for From_Value
T
U
T2
K
M
A
T
T1
O
E
S
NSTU
4

Example of keeping the data in the current column and adding a new numeric column for numeric data:
SQL> drop table t purge;
Table dropped.
SQL> create table t(i int, x varchar2(10));
Table created.
SQL> insert into t values(1, 'T1');
1 row created.
SQL> insert into t values(2, 2);
1 row created.
SQL> --
SQL> alter table t add (xn number);
Table altered.
SQL> --
SQL> begin
  2  for c in (select i, x from t)
  3  loop
  4   begin
  5   update t set xn = to_number(c.x) where i = c.i;
  6   exception
  7    when invalid_number then null;
  8   end;
  9  end loop;
10  end;
11  /
PL/SQL procedure successfully completed.
SQL> show errors
No errors.
SQL> select * from t;
         I X                  XN
         1 T1
         2 2                   2

Similar Messages

  • Why is it that the Facetime icon disappeared after i changed my sim from qatar vodafone number to philippines smart number? How can i reactivate my facetime?

    Why is it that the Facetime icon disappeared after i changed my sim from qatar vodafone number to philippines smart number? How can i reactivate my facetime?

    Check to see if you have an old phone number associated with this person in your address book. When you call someone on Facetime it calls ALL numbers/emails associated with that persons contact sheet! This was my problem, this stranger has my husband's old phone number!

  • Why does Lion KEEP reversing changes you make in address book and other applications without your consent and without wanting it to??? Plus address book will NOT import old address book contacts from Snow Lepoard 10.6 and keep them.  This Lion OXS 7 is ..

    Why does Lion KEEP reversing changes you make in address book and other applications without your consent and without wanting it to??? Plus address book will NOT import old address book contacts from Snow Lepoard 10.6 and keep them.  This Lion OXS 7 is .. becoming very frustrating ... it will NOT keep changes made in the Address Book and it has destroyed my contacts which I only have electronically since 10.4 in my address book. I am NOT happy with this OS7 it has a lot of issues and faults.  How can one stop automatic reversing of data when inputting???
    Please help! 
    Wished I NEVER upgraded to this Lion!!!
    Carmelo

    Relax. Your address book database is corrupted.
    If you are syncing your Contacts with MobileMe or something else, disable it for now.
    Backup your address book by going to File>Export>Address Book Archive.
    Quit Address Book.
    Open your Library by holding down the Option (alt) key while selecting the Go menu in Finder. Select Library. Navigate into your Application Support/AddressBook folder and delete the addressbook-v22.abcddb file.
    Open Address Book. It will recreate the database from the raw data.
    See how that works. If it is ok, then reenable syncing and see how that works.

  • HT201320 I have two email accounts. However, the iPad automatically uses the account that I only want to use for business. How can I change the account from which mail is sent and received?

    I have two email accounts. However, the iPad automatically uses the account that I only want to use for business. How can I change the account from which mail is sent and received?

    You are most welcome

  • Can I change my plan from full to just lightroom and photoshop cc

    can I change my plan from full to just lightroom and photo shop CC ??

    Your line needs to be out of contract before you can switch to a prepaid plan. You might have to get a different phone if you have a 4G LTE smartphone. The prepaid plans only support 3G only phones at this time.

  • Can i move my apps from itouch to iphone 4S and keep the saved stuff ive done so far

    can i move my apps from itouch to iphone 4S and keep the saved stuff ive done so far

    If the developers of the apps have followed Apple's guidelines, the data should be in the backup made in iTunes, so you should be able to just restore the iPhone 4S from the most recent backup of the iPod touch, re-sync your apps, and you should be good to go. If any of the data is critical, though, you may want to confirm with the developer of the app, just in case they have some special procedure.
    Regards.

  • I erased my HD. Now I can't instal mountain lion from my bootable flash drive, and keep getting "installation error. Try again."

    I bought  mountain lion, made a bootable flash drive.
    I booted from it and it went to upgrading right away!
    So I stopped it and went to my former recovery partition I erased my HD because I wanted a clean start.
    Now I can't instal mountain lion from the bootable flash drive, and keep getting "installation error. Try again."
    and there is no 4 choices window.
    I don't know what to do.

    How did you create the USB install thumb drive? If it was with Disk Utility I have run into this problem and have since used THIS program to make the USB install drive.
    As to your problem you only have one option and that is to Reinstall the Original OS X version that came on your computer or if you still have the Lion Recovery Partition use that to reinstall Lion. Or if you system came with Lion and you have No Lion Recovery HD Partition you can boot the system from over the internet and Reinstall Lion.
    At startup hold down the Command+Option+r keys until you saa a spinning Globe in the center of the screen. Once that loads Repartition the drive as One partition and then reinstall Lion.

  • Changing column datatype value

    Can any body forward me the SQL for changing the datatype value from
    Varchar2(64) to Varchar2(2)
    Arif

    You can do that if the column is empty, or its contents size is not bigger than the new size :
    SQL> create table test_tab(a varchar2(100));
    Table created.
    SQL> alter table test_tab modify a varchar2(50);
    Table altered.
    SQL> insert into test_tab values('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
    1 row created.
    SQL> alter table test_tab modify a varchar2(40);
    Table altered.
    SQL> ed
    Wrote file afiedt.buf
      1* alter table test_tab modify a varchar2(20)
    SQL> /
    alter table test_tab modify a varchar2(20)
    ERROR at line 1:
    ORA-01441: cannot decrease column length because some value is too big
    SQL>

  • DATAEXPORT to RDBMS - changing column dim from Accounts to Time

    While performing a DATAEXPORT to Oracle using DSN, the format of the table created has the members of the Accounts dimension in the columns and the other dimensions in the rows. Is is possible to change the column dimension from Accounts to Time while exporting data to RDBMS using the DATAEXPORT command?
    The problem is that I have around 1000 members in the Accounts dimension and cannot have that many columns in my table. Is it possible to manually define the column dimension while using the DATAEXPORT command? I can use the Jexport cdf, but I am not sure if I will get the same performance as the DATAEXPORT with the bulk insert options.
    Thanks,
    FJ

    Thanks for the quick reply, Glenn.
    But, I did go through the technical reference and it mentions that the DataExportColHeader option can only be used with text files and I am trying to export to a relational database.
    Regards,
    Francis

  • Converting datatype from Varchar2 to BLOB ...how..???

    Hi i have to convert the datatype of a varchar2 column in one of my tables to BLOB...and i also have to preserve the data existing in the column in the process.
    Please guide .
    Thanks.

    first of all, I don't think that BLOB and VARCHAR2 are compatible, logically that is. BLOB is binary and VARCHAR2 is mere text.
    The way I'd do it is to have all the VARCHAR2 saved into text files and then stored in BLOB. Here is a hint:
    let's call your VARCHAR2 column 'X'
    1- create a new column in the table of type BLOB and call it 'Y'.
    2- using pl/sql text I/O, save each VARCHAR2 in a text file using the primary key of the table as file name.
    3- upload each file back to the table in it's corresponding record in column 'Y'.
    4- update the table setting 'X' in each table to NULL.
    5- alter table to delete column 'X'.
    6- alter table to rename 'Y' ---> 'X'
    finally, before doing any of these steps make sure you have enough disk space and that you really know how to deal with BLOB's as they need special insert and update commands.
    hope that helped
    Nasser Asiri

  • HT203167 I changed my location from the UK to Australia and lost my complete itunes library

    I changed my location from itunes UK to itunes Australia....my complete itunes library was wiped and I cannot retrieve it? help? Thank you

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Can I change the snooze from 10 to 15 min and how?

    Can I change the snooze from 10 to 15 min? How!!?

    iPhone User Guide
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • Have you been successful porting your number and keeping unlimited data?

    Hi , I am trying to save money by getting rid of my texting plan($20) and having Google Voice as my SMS provider. I want to keep my number so I will port my number to GV. For a 1-time fee of $20. The Problem is that during the process some people lose their UNLIMITED DATA package. I, of course don't want this to happen. I have searched the interwebs and found that this forum had the good information on it.
    https://community.verizonwireless.com/thread/779321?start=0&tstart=0
    https://community.verizonwireless.com/thread/779321?start=80&tstart=0
    See post # 3 and # 85 for detailed instructions. I was in the process of doing it but Google Wallet denied my transaction because I needed to verify my account. This process takes 3 days. So I will wait and try again. I would like to know if the rest of the verizon community has been succesful or has regretted doing this.
    I feel that this process should work and would like to keep this discussion open so other people can do the same. We all know sms and voice mins are cheap and carriers are just milking money from data plans.
    PS. I felt # 85 was really straight forward
    Joined the community to thank the OP - and to add in another success story. Before I start my 'experience share', I think its pertinent to mention that I have the Galaxy S4 [Android]
    Started the GV Port on Monday at about 3PM. Provided GV with personal details, phone number, billing PIN (you can set one up or change your current PIN on the VZW website after logging on to your account) and my account number (excluded the -00001 after my account number as suggested by other posters on this thread). Google charged me $20 to complete the port.
    On Tuesday morning, approximately at about 11AM, I logged into my VZW account and requested a new number (VZW's website states that this process is free if done online). At this time, my GV Port status showed "Number Change Pending". Once the new number was assigned to me by VZW (the number is issued instantly), I had to turn my phone off and wait a few minutes before turning it back on. When I turned my phone back on, it showed that the new number was active (no VZW notifications - just tried a test call from my landline).
    Almost 24 Hours down to the minute (so at about 3PM on Tuesday), I got an email from GV stating that my port was complete. On the GV website, I then added in my new number (under Settings>Phones), and set all calls (and texts) to forward to my new number. GV walked me through a couple of programming steps - and confirmed that my GV calls would be forwarded to my new VZW number. Please note that if you want GV to pick up your VM's, then you will need to activate Google voicemail on the GV website (Settings>Phones). Else, VZW voicemail will end up picking up your calls - and a message like "this user has a VM box that has not been set up" will play.
    I also opened up the GV app on my phone and changed the settings to "Make all calls through Google Voice". Also, I turned off the 'Messaging' app, and set the GV app as the default app for handling all texts.
    As of now, I can make and receive calls via the setup described above. Folks receiving calls from me see my GV number on their displays (so no need to update folks with my new number), and when I receive calls on my GV number, my VZW phone displays the number of the person trying to reach me (so no updating my contacts list). Low priced international calls, desktop-based texting, unlimited storage of texts/VM's/call-logs, here I come!
    My texts arent working yet, but GV states that it takes about 3 days before texting becomes active. When it does, I'm hoping that all texts will be routed via the GV app (I'm fairly certain that it will)
    Other things to note:
    Banking Apps: Some banking apps that require verification codes to be sent via text might stop working. I just got an email from BOFA this morning asking me to reverify my mobile number. Need to fix this once GV texting becomes active
    Messaging: Existing texts on your device cannot be backed up/imported into GV. That said, Google Play has a couple of free apps that backup your entire message archive under a separate label within your Gmail account
    Hope this helps someone else out there in taking the plunge. Seems like the process is fairly straightforward unless you decide to skip some steps or if you are impatient and try to change things too quickly (I would really urge you against skipping steps, hurrying things up, etc. GV is completely automated, and getting "support" is almost impossible).
    All the best!"

    You won't lose your unlimited data as long as your account stays active and you don't purchase a subsidized phone. I just did this yesterday and it took just a few minutes over 24 hours to port my number over to GV. I still have unlimited data. I pretty much followed the instructions you have above except I waited about 7 hours to get a new number from VZW just to make sure there were no hiccups. VZW says you may get some overages if you change your number immediately as opposed to on the first day of your billing cycle because they prorate your minutes and texts used. Luckily I have unlimited everything so it didn't make a difference for me. I'm planning on going over to T-Mobile. My home is a dead zone for cell phones and I always have a weak signal and sometimes don't get my calls. I figure if I'm going to pay for an unsubsidized phone, I might as well go with a company that has wifi calling and a cheaper unlimited plan. I pay $94/mo before taxes with VZW; I'll only be paying $59.50 with T-Mobile for the same plan with 2.5 GB tethering included. T-Mobile here in LA is pretty good and even if I don't get LTE, I can fall back on their HSPA+ network, which is way better than VZW's crippled 3G network. No regrets porting over. The ONLY way I'll stay with VZW is if they allow me to keep my unlimited data (not going to do Verizon Max) and get a subsidized phone. CAN YOU HEAR ME NOW VERIZON?

  • How can you get your files from outlook onto your ipad2 and keep it in the files?, how can you get your files from outlook onto your ipad2 and keep it in the files?

    How can you get files from your outlook folder from the ipad2 and keep it there for future reference?

    It's unclear what you are asking outlook is a mail, appointment, tasks and contacts
    Programs outlook have no direct contact with files

  • [sqlldr] upload number datatype from varchar2 datatype in ctl file

    dear friends.
    this is two files from my DAT file.
    In the last field the data is: |3180.8| or |605.|
    00000000|0|0601|2000082|6|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|3180.8|
    00000000|0|0601|2000082|1|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|605.|
    in the table destination the field have NUMBER(12,2) and i want to upload in this datatype in my control file.
    I had read about portable and non-portable datatypes but i dont understand. This topic is refer about my problem?
    In other ways, what will be the instruction in order to upload this datatype ???
    Thanks a lot.
    cesar
    P.D. please apologize my english

    A lot of thanks my friend...
    i saw in your example that is function... but... please, would you describe me what is my specific error in my files ?
    Example of my datfile is:
    00000000|0|0601|2000082|6|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|3180.8|
    00000000|0|0601|2000082|1|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|605.|
    My CTL file is:
    Load DATA
    APPEND
    INTO TABLE PLANELEC.PEMVX_DATOSCOMPDOM
    fields terminated by "|" TRAILING NULLCOLS
    V_NUMPAQTE,
    V_NUMLOTE,
    V_NUMFORM,
    N_NUMORDEN,
    V_CODDOCIDE,
    V_NUMDOCIDE,
    N_NUMCORAPO,
    N_ESTASGHAB,
    V_NOMBREVIA,
    V_NUMEROVIA,
    V_INTERIOR,
    V_NOMZONA,
    V_REFERNCIA,
    V_CODTVIA,
    V_CODZONA,
    V_CODUBIGEO,
    TEST_INTEGER CONSTANT 0,
    TEST_NUMBER (this is ths field where i put the last field of datfile)
    This is my sh. file:
    # /bin/bash
    export ORACLE_SID=plelpp
    export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    export PATH=$PATH:$ORACLE_HOME/bin
    sqlldr USERID=system, CONTROL=T818COMP.ctl, LOG=T818COMP.log, data=10pemvx_datoscompdom_20080304165740.dat, bad=T818COMP.bad, discard=T818COMP.dsc
    And finally, this is my *.log file that show errors when i execute my sh file:
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Mar 6 07:50:46 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: T818COMP.ctl
    Data File: 10pemvx_datoscompdom_20080304165740.dat
    Bad File: T818COMP.bad
    Discard File: T818COMP.dsc
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table PLANELEC.PEMVX_DATOSCOMPDOM, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    V_NUMPAQTE FIRST * | CHARACTER
    V_NUMLOTE NEXT * | CHARACTER
    V_NUMFORM NEXT * | CHARACTER
    N_NUMORDEN NEXT * | CHARACTER
    V_CODDOCIDE NEXT * | CHARACTER
    V_NUMDOCIDE NEXT * | CHARACTER
    N_NUMCORAPO NEXT * | CHARACTER
    N_ESTASGHAB NEXT * | CHARACTER
    V_NOMBREVIA NEXT * | CHARACTER
    V_NUMEROVIA NEXT * | CHARACTER
    V_INTERIOR NEXT * | CHARACTER
    V_NOMZONA NEXT * | CHARACTER
    V_REFERNCIA NEXT * | CHARACTER
    V_CODTVIA NEXT * | CHARACTER
    V_CODZONA NEXT * | CHARACTER
    V_CODUBIGEO NEXT * | CHARACTER
    TEST_INTEGER CONSTANT
    Value is '0'
    TEST_NUMBER NEXT * | CHARACTER
    value used for ROWS parameter changed from 64 to 58
    Record 1: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
    ORA-01722: numero no valido
    Record 2: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
    ORA-01722: numero no valido
    Record 3: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
    ORA-01722: numero no valido
    Record 4: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
    ORA-01722: numero no valido
    Record 5: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
    ORA-01722: numero no valido
    Table PLANELEC.PEMVX_DATOSCOMPDOM:
    0 Rows successfully loaded.
    5 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 254504 bytes(58 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 5
    Total logical records rejected: 5
    Total logical records discarded: 0
    Run began on Thu Mar 06 07:50:46 2008
    Run ended on Thu Mar 06 07:50:49 2008
    Elapsed time was: 00:00:02.95
    CPU time was: 00:00:00.02
    Please,
    would you help me ? is very important.
    a lot of thanks...
    cesar

Maybe you are looking for

  • Invoking a webservice as an "application process"

    Hello there, I have setup a web service successfully and I can invoke it as a "Page Process", get the response in a collection , and do a few validation based on it. However, I will need this validation for most of my pages in the application, so I t

  • IDOC to and from eternal system

    Hi All, I've following scenario: Sender SAP R/3 system is sendind IDOC of type say A to XI system, XI system is mapping IDOC of type A to say IDOC B, then finally XI is sending IDOC B to receiver SAP R/3 system [External system} Note: Reverse scenari

  • Nokia Lumia 1320 data coonection problem!

    since update to 8.1 i can't use data connection on phone, but internet sharing works. so APN works no problems with calls, wifi, just data connection on phone! I do not want hard reset!!! Nokia Lumia 1320 OS v.: 8.10.12393.890 firm.: 3058.50000.1424.

  • Cannot copy acrobat pro 9 app folder to applications directory

    have uninstalled acrobat pro 9 because of failure to recognize new scanner.  Now cannot copy app folder from DVD into applications folder.

  • Windows 7 64 bit,CS5 64bit or 32 bit and 32 bit plugins

    Hello Is there a list of 32 bit plugins that will work with Windows7 64 bit and CS5 64 and 32bit? I use Xenofex2 KPT3 KPT6 KPT Collection Eye Candy 3.1 Andromeda 3D deluxe Flo's Undistort Redfield Plugins Mike Engles