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

Similar Messages

  • 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

  • Help Required in Converting datatype from Microsoft SQL To Oracle

    I Have one Table in Microsoft SQL,
    Create Table sk_a(number(1000,1));
    Now I want to create the same table with similar column in Oracle,
    but Oracle datatype precision is only max 38, so please let me know the best way to do it,
    Thanks,
    Sunil . N

    You want a 1000 numbers as precision? Wow.... huge numbers...
    How would you call a number like that?
    111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.1

  • [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

  • Batch convert tracks from 440 to 442, how?

    Hi,
    I'm a piano/vocalist playing along to backing tracks that I make using synths and vsti's, these are all done at 440hz.
    I've come to do a job where the piano is tuned to 442hz, it's been recommended to me to change all my tracks (over 400 of them) to 442.
    Is it possible in compressor and how would I do it?
    I've only seen the options of format not actual tuning, and I'm not sure how to get it to 442.
    Thanks
    C.

    XI Pro is better, the algorithm that fixes a PDF so it passes the compliance check is better. Not foolproof but much more likely to succeed than the one in Acrobat X.
    As Test Screen Name says you can automate saving to the untagged versions of PDF/A (such as PDF/A-1b) using an Action, simply by creating a new 'empty' action and changing the Save step options. In most cases it'll work, but if the input file is wildly out of compliance it can still throw an error. The biggest problems tend to originate with font embedding and when the PDF has comments applied.
    PDF/A versions with tagging (e.g. PDF/A-1a) are horrendous to create after the fact as you will almost certainly be hit with a long list of things you have to manually correct. Acrobat can't automate the fixes this time as it has no way to understand the semantics of each page. It's very strongly advised that those types of file are created directly in the authoring application (though Adobe has yet to implement that idea in InDesign, you can do it in MS Office).

  • Error while converting schema from oracle to SQL server

    Hello,
    I am getting following error while converting schema from oracle to SQL server using SSMA.
    I get Errors 1-3 while migrating procedures and error 4 while migrating a table.
    1- O2SS0050: Conversion of identifier 'SYSDATE' is not supported.
    2- O2SS0050: Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.
    3- O2SS0050: Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported.
    4- O2SS0486: <Primary key name> constraint is disabled in Oracle and cannot be converted because SQL Server does not support disabling of primary or unique constraint.
    Please suggest.
    Thanks.

    The exact statement in oracle side which causing this error (O2SS0050:
    Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.) is below:
    dStartDate:= to_date(sStartDate,'MON-YYYY');
    Statement causing error O2SS0050:
    Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported is below.
    nCount2:= length(regexp_replace(sDataRow,'[^,]'));
    So there is no statement which is using to_date(VARCHAR2,
    CHAR) and regexp_replace(VARCHAR2, CHAR) in as such. 'MON-YYYY'  and '[^,]'
    are CHAR values hence SSMA is unable to convert it from varchar2 to char.
    Regarding SYSDATE issue, you mean to put below code in target(SQL) side in SSMA ?
    dDate date := sysdate;
    Thanks.

  • How to convert  from  varchar to blob ?

    How to convert from varchar to blob ?
    thanks

    Here is a small PL/SQL block that we have used to convert varchar2 to blob.
    declare
    cursor get_blob is
    select blob_statement
    from report
    where report_id = 205
    FOR UPDATE OF blob_statement;
    v_loc blob;
    v_raw_buffer raw(32767);
    v_amount binary_integer := 32767;
    v_offset binary_integer := 1;
    v_buffer VARCHAR2(32767);
    begin
    open get_blob;
    fetch get_blob into v_loc;
    close get_blob;
    v_buffer := 'Sample text';
    v_raw_buffer := utl_raw.cast_to_raw(v_buffer);
    v_amount := utl_raw.length(v_raw_buffer);
    dbms_lob.write(v_loc, v_amount, v_offset, v_raw_buffer);
    commit;
    end;

  • Converting an image as a blob content from .gif format to .jpg format

    Hi
    Does anyone know how to convert a blob content from .gif format to .jpg format?
    I've tried looking at the process-method of intermedia, but I can't figure out how it's supposed to work... I'm on a 10.2.0.2 standard edition database
    I simply have a blob containing a gif-image, and I want it to be convertet to a jpg-image for further use
    Can anyone help?
    Thank you
    /Klaus Mogensen

    Hi
    Does anyone know how to convert a blob content from
    .gif format to .jpg format?
    I've tried looking at the process-method of
    intermedia, but I can't figure out how it's supposed
    to work... I'm on a 10.2.0.2 standard edition
    database
    I simply have a blob containing a gif-image, and I
    want it to be convertet to a jpg-image for further
    useWhat OS is the database running on? If it is a *nix flavour, you can call out to image magick convert utility (it is pre-installed on most linux variants, and you can compile it from source for other unixes). So you would probably store the blob into a temp file on the database server, call out to the shell to execute convert, and then load a blob from the converted file. See http://imagemagick.org for more information.
    If that is not an option, you might be able to use Java Advanced Imaging API from a Java stored proc to convert between those image formats. See http://java.sun.com/products/java-media/jai/downloads/download-1_1_2.html
    gojko adzic
    http://gojko.net

  • I have converted a pdf to word. How can I access the Word file from my online account?

    I have converted a pdf to word. How can I access the Word file from my online account? When it says 'download the converted file' I choose a location on my PC and click, but nothing happens. It seems that it can only save the converted file to my online account. I went to my online account but I see no way to look for the file

    Hey Fabrizio,
    You might need to sign up at "https://cloud.acrobat.com/exportpdf" using your Adobe ID credentials to convert your PDF file to Word.
    Do you get the 'download' prompt?
    Also, you can find the converted files by clicking at the 'Files' tab. 
    Please try the same using a different browser and check.
    Hope to hear from you.
    Regards,
    Anubha

  • TS3577 I want to erase the new Garage band and convert to my old one. As soon as it downloaded, I Lost all of my songs from the previous Sessions,HOW DO I GET THEM BACK?

    I want to erase the new Garage band and convert to my old one. As soon as it downloaded, I Lost all of my songs from the previous Sessions,HOW DO I GET THEM BACK?

    MacBook Pro, iOS 7.0.6
    Your signature lists both, Mac and iOS device - are you asking about GarageBand on your Mac or your iPhone/iPad?
    If you are asking about the upgrade from GarageBand '11 to GarageBand 10.0 on your Mac, the old GarageBand version should still be installed. The installer will have moved GarageBand '11 to a separate folder "GarageBand 6.0.5" in your Applications folder. Open this folder and click "GarageBand".  Does this version still see your old projects?  If not, type ".band" into the Spotlight searchfield in the upper right corner of your screen. Does that sfind your missing projects?
    If you are asking about GarageBand on iPad/iPhone, there it is not possible to restore the previous version after you upgraded. And I do not see, how this upgrade could have deleted your projects. Have they completely vanished, or can you not open them any longer? If your projects have vanished, restore your device from your backup: See:  iCloud: Backup and restore overview
    -- Léonie

  • How can I convert Pdf from RGB to CMYK, keeping font color 100% K while working in Illustrator?

    How can I convert Pdf from RGB to CMYK, keeping font color 100% K while working in Illustrator?
    When I try to open the document in Illustrator and I convert to CMYK the black font converts to rich black, but to set up for Offset printintg I need the text to be only in Black (100%K).
    The original source of the document is a Microsoft Word file, I have converted the Word file to Pdf in order to setup for OFfset Printing.
    Thanks

    I have tried that way, but the downside is that the fonts are set in gray not in a 100%K, also I have to deal with other fonts that are composites and meant to stay Full Color. I could select text by text and convert to gray but, its a 64 page document and I wouldn't want to make a expensive mistake.

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • How to I convert data from oracle database into excel sheet

    how to I convert data from oracle database into excel sheet.
    I need to import columns and there datas from oracle database to microsoft excel sheet.
    Please let me know the different ways for doing this.
    Thanks.

    asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
    You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
    Justin

  • How do I save the file after I have converted it from pdf to word

    HOW DO I SAVE A FILE AFTER I HAVE CONVERTED IT FROM PDF TO WORD

    Hi,
    After converting your file a box will appear on top of the window showing 'Download' option.
    When click on that your file will be downloaded and it will show the notification at the bottom.
    Click on arrow -> 'Show In Folder'.
    It will direct you to the location where your file has saved.
    Regards,
    Florence

  • How to convert value from exp. value to double/float???

    Hi all,
    I am fetching values from database, which is of type double / float.
    eg. values will be like -22,777,548 will be stored in database.
    NOw if i use
    float a= rs.getFloat(1);
    out.println("a="+a);
    I get output as a= -2.2777548E7
    I want to remove "E" from out put value and display as it was given in DB.
    How to solve this problem?
    Please Help!
    Regards
    Ashvini

    What do you mean - 'how does it work' ? All format classes (MessageFormat, DecimalFormat , SimpleDateFormat etc) are used to convert data from one form to other. Go through the java.text.* api. They work based on some pattern searches, pattern matches etc - dont know in detail :)
    As for the other things, thanks :)
    cheers,
    ram.

Maybe you are looking for