Can I convert existing column BLOB to CLOB?

Hi ,
I need conversion of existing column from BLOB to CLOB. Kindly sueggest workaround. Table structure is as
{ desc tab1;
Name Null? Type
Name Null? Type
RECID NOT NULL VARCHAR2(255)
XMLRECORD BLOB}
I need to convert it from blob to clob. Kindly provide workaround.
Regards

Hi,
How can i use this function for my scenario
1. Table name is "test" and XMLRECORD column should be in CLOB without drop table. Kindly update this fuction as per my scenario and also provide all the steps
CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)
RETURN CLOB
AS
v_clob CLOB;
v_varchar VARCHAR2(32767);
v_start PLS_INTEGER := 1;
v_buffer PLS_INTEGER := 32767;
BEGIN
DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
LOOP
v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));
DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
v_start := v_start + v_buffer;
END LOOP;
RETURN v_clob;
END blob_to_clob;
]

Similar Messages

  • How can I convert "exists (select 1 from . ." into OWB

    Hello,
    I have sql statement that have to convert from PL/SQL to utilize OWB
    select a.1, a.2, b.1,b.2
    from a, b
    where a.1 = b.1
    and exists in (select 1 from c where a.3 = c.3)
    Thank you in advance.

    OWB does support EXISTS
    you can join tables a and b using simple joiner. from the output of this joiner , use a.3 to lookup on table c. select the business/primary key of table c from lookup operator and all other required fields from joiner into a filter. in the filter condition put condition
    c.businesskey is not null.
    Its like performing
    select a1,b1 from
    (SELECT
    c.businesskey bk,a.1 a1,b.1 b1
    FROM
    c lkp_tbl
    RIGHT OUTER JOIN a ON ( ( c.3 = a.3 ) )
    LEFT OUTER JOIN b ON ( ( b.1 = a.1 ))
    ) SUBQUERY
    WHERE
    SUBQUERY.bk is not null
    try it and let me know. I have tried not exists and it works in OWB fine

  • Can Mars convert existing PDF to PDFXML?

    Hello, I am trying to find a way to process the text content
    of PDF files inside an AIR app I'm building. So far, I haven't had
    any luck figuring out how to get the content of an existing PDF so
    that I can process it (essentially I want to search the text for
    specific regular expressions).
    I'm wondering if I could use Mars to convert an existing PDF
    into PDFXML -- which I could then process? Is this possible?
    Follow-up: can I do this all in-memory without having to
    write out the XML to disk temporarily? Any comments on the
    performance considerations of doing so? The PDF files vary in size
    from under 1MB to perhaps 10-15MB.
    Thanks in advance,
    Davis

    Hi Davis,
    Sorry for the delay in responding. I've been thinking a
    little about how this could be done, but at the moment, I would
    probably say it is not possible. Mars/PDFXML uses UCF for packaging
    its contents (UCF being a zip file with some restrictions, but is
    still a fully conformant ZIP file) and we use a separate UCF reader
    inside of the PDFXML plug-in (this is an Adobe created UCF
    library). This library abstracts out how we access the contents of
    the UCF package and how it is handled on disk. It also provides
    byte serving negotiation for web pages. What it doesn't do today is
    have any mechanism to keep everything in memory or to provide
    access to an external client to the data we are adding to it. Until
    we serialize this out to disk, it is pretty much inaccessible.
    If you had a PDFXML file, I think that accessing it through
    AIR/Flex would be a lot easier than accessing the contents of a PDF
    file. But there is no way to automate this directly from a source
    PDF.
    Matt

  • Can I convert existing regular CC membership to education?

    I have an existing Creative Cloud membership that is 4 months from renewal. I got a new job in an Educational Institution and want to convert my membership from regular to Educational. Is this possible?

    Hi mr-tony-liu,
    Please refer the article: http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html and contact our chat support in case of any issue.
    Regards,
    Romit Sinha

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

  • XMLTYPE column as BLOB, not CLOB?

    All the documentation says,
    "When you create an XMLType column in a table, you can choose to store the XML data in a CLOB column or object relationally." (Oracle9i SQL Reference Release 2 (9.2), "Datatypes" section.
    (We have db version 9.2.0.4 on aix 5.2)
    My question:
    Can we store XMLTYPE column in a BLOB? What are the implications?
    caveat: object relationally based on registered schema is not an option (not at all) because of existing Oracle bug regarding datetime. 10g is in the (not near) future for us.
    thanks in advance.

    No....

  • Error when Converts rows to columns dynamically in clob data type

    Hi
    I am using below pl/sql statement
    SELECT NO,
    MAX (DECODE (NAME, 'A', VALUE1, NULL)) AS A,
    MAX (DECODE (NAME, 'B', VALUE1, NULL)) AS B,
    MAX (DECODE (NAME, 'C, VALUE1, NULL)) AS C,
    MAX (DECODE (NAME, 'D', VALUE1, NULL)) AS D
    FROM ( SELECT NO,
    RTRIM (
    XMLAGG (XMLELEMENT (E, VALUE || ',')).EXTRACT ('//text()').
    GETCLOBVAL (),
    VALUE1,
    NAME
    FROM DA
    while i am execute for varchar type its as i expected. when i tried with clob data type i am getting follwoing error.
    ORA-00932: inconsistent datatypes: expected - got CLOB
    can any one pleas me?
    thanks
    Nagarajan.V

    Nagarajan Venu wrote:
    Thanks for your reply
    This is scenario.
    This is my table
    NO--name--value
    1--A--ASDF
    2--B--IOP
    all columns are clob type and i want the output like below.
    No--A
    1--ASDF
    2--IOP
    i just want to convert all rows to coulmns(clob type) dynamically.I don't get how you got that output from the data? What happened to "B"?
    Please post a suitable example and expected output using create table and insert statements as well as giving your database version and using {noformat}{noformat} tags as detailed in the FAQ: {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I convert an existing table to IOT

    Hi,
    My Oracle version is 10.2.0.4
    Below is my structure of my test_table .
    It has 1141580 rows.
    I want to convert this into index Organized table. It has no secondary indexes.
    How can I convert an existing table to IOT.
    CREATE TABLE test_table (
       Column1             NUMBER        NOT NULL,
       Column2             DATE          NOT NULL,
       Column3             VARCHAR2(100) NOT NULL,
       Column4             VARCHAR2(8)   NULL,
       Column5             VARCHAR2(40)  NOT NULL,
       Column6             VARCHAR2(3)   NULL,
       Column7             NUMBER        NOT NULL,
       Column8             NUMBER        NULL,
       Column9             VARCHAR2(32)  NULL,
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_pk2 PRIMARY KEY (
        Column1,
        Column2
      USING INDEX
        STORAGE (
          INITIAL   30720 K
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_cons1 FOREIGN KEY (
        Column1
      ) REFERENCES test_table2 (
        Column1
    /

    alter table doesn't allow to change the organization of a table.
    So the logical answer to your question is
    You can not
    and your question
    redundant.
    As most other questions here.
    So the answer should have been
    - create a new table
    - insert all rows
    - drop the old table
    - rename the new table
    Oracle is not about rocket science.
    Oracle is about reading documentation and using brains.
    If you do that, maybe, one day, you will be a bigboy.
    If you keep asking redundant questions you will remain a littleboy.
    Sybrand Bakker
    Senior Oracle DBA

  • Can I convert an existing html file to muse file?

    can I convert an existing html file to muse file?

    Hi,
    As of now Muse does not offer this option to convert an existing HTML file into a Muse file.
    However, I would request you to post this as a feature request on Ideas for features in Adobe Muse
    Regards,
    Rohit Nair

  • I use photoshop elements version 11 and just bought a nikon d750. Photoshop elements can't open/read the raw/NEF-file. Does a photoshop elements raw converter exist for Nikon d750 ??? And where can I get it ?

    I use photoshop elements version 11. I just bought a nikon d750. Photoshop elements can't read/open the raw/NEF-file.
    Does a raw converter exist for this camera and where can I find it ?
    Thanks for any help.
    erwing97792269

    You need Adobe camera raw version 8.7. Unfortunately your software pre-dates the camera. ACR 8.7 is only compatible with PSE13. But it is possible to download and install the free DNG converter to convert your raw files to the Adobe universal Raw format and the files will open in all versions of PSE (keep your originals as backups and for use in the camera manufactures software)
    Windows download (.exe file) click here DNG Converter 8.7
    Mac download (.dmg file) click here DNG Converter 8.7
    You can convert a whole folder of raw images in one click. See this quick video tutorial:
    You Tube click here for DNG Converter tutorial

  • How can I convert my existing tunes to work on an MP3 player?

    I have purchased a CBC radio show from Itunes and want to put it on an MP3 player. It appears the file format is not compatable. How can I convert the existing files to MP3 format??
    Thanks.

    If it has Apple FairPlay DRM on it, you can't simply "convert it" to MP3. You must first burn it to a CD, then import it again into iTunes. Make sure your import settings have MP3, and match the native bit-rate of the original track.
    If it's a regular AAC audio file, then simply change your import settings to MP3, then right-click the file and choose "Create MP3 Version."
    Bryan

  • Function convertion from blob to clob

    Plesae need help,to make function convert from blob to clob
    i have function but not work when coulmn of blob is vey large
    =========================================================================================
    CREATE OR REPLACE PACKAGE BODY "SHB_PACKAGE"
    AS
    FUNCTION blob2clob (l_blob BLOB)
    RETURN CLOB
    IS
    l_clob CLOB;
    l_src_offset NUMBER;
    l_dest_offset NUMBER;
    l_blob_csid NUMBER := DBMS_LOB.default_csid;
    v_lang_context NUMBER := DBMS_LOB.default_lang_ctx;
    l_warning NUMBER;
    l_amount NUMBER := dbms_lob.lobmaxsize;
    BEGIN
    IF l_blob is null
    THEN
    return null;
    ELSE
    DBMS_LOB.createtemporary (l_clob, TRUE);
    l_src_offset := 1;
    l_dest_offset := 1;
    l_amount := NVL(DBMS_LOB.getlength (l_blob),0);
    DBMS_LOB.converttoclob (l_clob,
    l_blob,
    l_amount,
    l_src_offset,
    l_dest_offset,
    0,
    v_lang_context,
    l_warning
    RETURN l_clob;
    END IF;
    END;
    END SHB_package;

    thanks,function is working fine
    issue duo to i used under informatice and bug in informatica
    Edited by: user8929623 on Jan 17, 2010 1:39 AM

  • One can create an index on a non-existent column in a table

    I am using Oracle 10.2.0.3 on Windows 2003. I wanted to create an index on columnb of
    Tablea. When I use statement like:
    Create index index1 on tablea (‘columnb’) …
    Oracle created index: index1. However, when I looked tat the column in user_ind_columns it had some weird colculn like SYS_NCxxxx. For sometime, I had
    No idea what was going on. My index was not being used in queries at all. Then it dawned on me that I should not put single quotes around columnb. Once I removed quotes, things worked as expected.
    But why does Oracle allow index on a non-existent column?

    we cannot create the index on nonexistent column of table We can. Its called a function-based index. Here's how we do it.
    Also read Howard's reply, right above yours.
    SQL> desc t
    Name                                      Null?    Type
    OWNER                                     NOT NULL VARCHAR2(30)
    OBJECT_NAME                               NOT NULL VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                 NOT NULL NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                   NOT NULL DATE
    LAST_DDL_TIME                             NOT NULL DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL> create index t_idx on t( substr(object_name, 1, 5));
    Index created.
    SQL> select column_name from user_ind_columns where index_name = 'T_IDX';
    COLUMN_NAME
    SYS_NC00014$
    SQL> select index_type from user_indexes where index_name = 'T_IDX';
    INDEX_TYPE
    FUNCTION-BASED NORMAL
    SQL>

  • Converting a blob to clob

    Hi,
    Has anybody been successful in using the DBMS_LOB.ConvertToClob procedure. It's giving me "invalid lob locator specified" error.
    here's my code
    create or replace function convert_blob_to_clob(p_file in varchar2) return clob is
    v_file_blob blob;
    v_file_clob clob;
    v_file_size integer := dbms_lob.lobmaxsize;
    v_dest_offset integer := 1;
    v_src_offset integer := 1;
    v_blob_csid number := dbms_lob.default_csid;
    v_lang_context number := dbms_lob.default_lang_ctx;
    v_warning integer;
    begin
    select a.blob_content into v_file_blob
    from txt_files a
    where name = p_file;
    dbms_lob.convertToClob(v_file_clob, v_file_blob,v_file_size,
    v_dest_offset, v_src_offset, v_blob_csid,
    v_lang_context, v_warning);
    if v_warning = 0 then
    return v_file_clob;
    end if;
    end;
    Any help would be greatly appreciated
    Thanks.

    I figured it out...
    here 's the new code..
    create or replace function convert_blob_to_clob(p_file in varchar2) return clob is
    v_file_blob blob;
    v_file_clob clob;
    v_file_size integer := dbms_lob.lobmaxsize;
    v_dest_offset integer := 1;
    v_src_offset integer := 1;
    v_blob_csid number := dbms_lob.default_csid;
    v_lang_context number := dbms_lob.default_lang_ctx;
    v_warning integer;
    begin
    select a.blob_content into v_file_blob
    from txt_files a
    where name = p_file;
    -- the following line solved it
    DBMS_LOB.CREATETEMPORARY(v_file_clob, TRUE);
    dbms_lob.convertToClob(v_file_clob, v_file_blob,v_file_size,
    v_dest_offset, v_src_offset, v_blob_csid,
    v_lang_context, v_warning);
    if v_warning = 0 then
    return v_file_clob;
    end if;
    end;

  • How can I converting long raw in clob on Apex when I'm creating a view?

    I need some help. I'm creating a view and I need converting long raw fields in clob, varchar2, or char when I create a view.
    Thanks for your help.

    What error did you get when using the functions in a SELECT on a view? If that did not work, identify the table the view is based on and write the SELECT statement directly against that table and not the view.
    I do not understand, "I try and they are rights".
    Mike

Maybe you are looking for

  • Printing Barcode in Dot Matrix Printer

    Dear Experts, We have developed Smart form to print Barcode and it's printing fine in LaserJet printer & readable by the scanner,  We need it on Dot Matrix printer for (multiple copies) and tried the same with Dot Matrix printer it use to print but n

  • The bookmarks button does not appear in my browser

    The button is supposed to be next to the home button, but it is not there

  • Will this external drive work??? HELP

    Hi all, I wanted to know if there is any way that this hard drive works with OS X? I've read reviews that it doesnt work with Macs, but some websites state that its Mac-compatible. http://shop3.outpost.com/product/5239637 Anyone have this drive? Is t

  • W520 beeps 4 times every two minutes

    This morning I started up my computer from its sleeping mode, and it beeped four times. It keeps on happening consistently every two minutes. Basically, it does this, within two seconds: beepbeep...beepbeep...beepbeep...beepbeep It is incredibly anno

  • How to import an mp3 to GB3?

    Hi, I have an .mp3 that I would like to remix in GB3, but I don't know how to. Everytime I bring it to GB3, it runs at its own speed, ignoring the BPM that GB is set to. How doI fix this to be able to keep all the instruments I want to add in synch?