CLOB data type

Problem in firing 'IF' statement which is checking whether a clob variable is NULL in a database trigger, which fires when a record is inserted thru the forms. The NOT NULL is working fine and updating but the NULL condition is not working, the trigger goes like this:
Create or replace trigger Tri_desc
after insert .....
declare
a_var CLOB;
b_var CLOB;
cursor c1_desc is
select desc
from tab1
where ..... = .....;
cursor c2_desc is
select desc
from tab1
where ..... = .....;
Begin
open c1_desc;
fetch c1_desc into a_var;
close c1_desc;
open c2_desc;
fetch c2_desc into b_var;
close c2_desc;
IF a_var is NULL then
update tab2
set description = b_var
where ... = ...;
elsif a_var is not null then
update tab2
set description = a_var
where ... = ...;
end if;
exception
end;
Got any idea or suggetions?
null

Use the alter table command and move_table_clause option. Fore more information refer Oracle SQL Reference.
The move_table_clause lets you relocate data of a nonpartitioned table into a
new segment, optionally in a different tablespace, and optionally modify any of its
storage attributes.
You can also move any LOB data segments associated with the table using the LOB_
storage_clause and varray_col_properties clause. LOB items not
specified in this clause are not moved.

Similar Messages

  • Error while loading data into clob data type.

    Hi,
    I have created interface to load data from oracle table into oracle table.In target table we have attribute with clob data type. while loading data into clob field ODI gave below error. I use odi 10.1.3.6.0
    java.lang.NumberFormatException: For input string: "4294967295"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
    Let me know if anyone come across and resolved this kind of issue.
    Thanks much,
    Nishit Gajjar

    Mr. Gajjar,
    You didnt mention what KMs you are using ?
    have a read of
    Re: Facing issues while using BLOB
    and
    Load BLOB column in Oracle to Image column in MS SQL Server
    Try again.
    And can you please mark the Correct/Helpful points to the answers too.
    Edited by: actdi on Jan 10, 2012 10:45 AM

  • Using CLOB data type - Pros and Cons

    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;
    - bind variables cannot be assigned CLOB value;
    - dynamic SQL cannot use CLOBs;
    - temp tables don't work very well with CLOBs;
    - fuzzy logic search on CLOBs is ineffective;
    - not all ODBC drivers support Oracle CLOBs
    - UNION, MINUS, INTERSECT don't work with CLOBs
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?

    848428 wrote:
    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;They can be stored inline too. Depends on requirements.
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;Toad is a developer tool so that shouldn't matter. What should matter is how you display the data to end users etc. but that will depend on the interface. Some can handle CLOBs and others not. Again, it depends on the requirements.
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;Why would they struggle? 18,000 characters is only around 18k in file size, that's not that big to a web page.
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;Who's caching them in memory? What are you planning on doing with these CLOBs? There's no real reason they should impact performance any more than anything else, but it depends on your requirements as to how you plan to use them.
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;You can manipulate CLOBs in SQL too, using the DBMS_LOB package.
    - bind variables cannot be assigned CLOB value;Are you sure?
    - dynamic SQL cannot use CLOBs;Yes it can. 11g supports CLOBs for EXECUTE IMMEDIATE statements and pre 11g you can use the DBMS_SQL package with CLOB's split into a VARCHAR2S structure.
    - temp tables don't work very well with CLOBs;What do you mean "don't work well"?
    - fuzzy logic search on CLOBs is ineffective;Seems like you're pulling information from various sources without context. Again, it depends on your requirements as to how you are going to use the CLOB's
    - not all ODBC drivers support Oracle CLOBs not all, but there are some. Again, it depends what you want to achieve.
    - UNION, MINUS, INTERSECT don't work with CLOBsTrue.
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?You may have more hassle if you "need" to accept more than 4000 characters and you are splitting it into seperate columns or rows, when a CLOB would do it easily.
    It seems as though you are trying to find all the negative aspects of CLOBs and ignoring all the positive aspects, and also ignoring the negative aspects of not using CLOB's.
    Without context you're assumptions are just that, assumptions, so nobody can tell you if it will be right or wrong to use them. CLOB's do have their uses, just as XMLTYPE's have their uses etc. If you're using them for the right reasons then great, but if you're ignoring them for the wrong reasons then you'll suffer.

  • Pl/sql Procedure is Not Creating With the CLOB data Type

    Hi,
    I am Using Oracle 10g Express Edition Release2.... My Doubt is While creating a table With CLOB Data Type the table is created successfully,but while Creating a Procedure With the CLOB Data type i am getting an Error Message
    2667/5 PL/SQL: Statement ignored
    2667/24 PLS-00382: expression is of wrong type
    then i tried With the Varchar2(30000) the Procedure is Created Successfully note i have not changed any thing in my code except the data type.
    I am Just Confused ......Why the Procedure is not Created with CLOB Data type?
    Please advice ...
    Thank U
    SHAN

    hi,
    Thanks for reply....Another Example
    CREATE TABLE USER_MAS (USER_ID     VARCHAR2 (20 Byte),MAIL_ID     VARCHAR2 (255 Byte));
    set serveroutput on
    declare
    atable varchar2(64) := 'USER_MAS';
    acolumn varchar2(64) := 'MAIL_ID';
    avalue varchar2(64) := 'NEWYORK' ;
    dyn_sql clob;
    begin
    dyn_sql := 'update '||atable||' set '||acolumn||' = '''||avalue|| '''' ;
    dbms_output.put_line(dyn_sql);
    execute immediate dyn_sql;
    end;
    commit ;
    Error at line 2
    ORA-06550: line 9, column 23:
    PLS-00382: expression is of wrong type
    ORA-06550: line 9, column 5:
    PL/SQL: Statement ignored
    When i Changed the Data type to varchar2(64)
    update USER_MAS set MAIL_ID = 'NEWYORK'
    PL/SQL procedure successfully completed.
    Commit complete.
    I like to Know the Reason Why the Procedure is Not Created in Oracle 10g XE DB
    Note :the Same Script i used in 11g DB the Procedure is Created Successfully....
    Why you need use CLOB or VARCHAR2 in your temp_num variable as you sending parameters as number?
    In the Procedure we are create some run time queries while executing the procedure. There are around 10 run time queries created.
    The size of each query is more than 4000 characters . We then add all the queries using union all after each query  to the clob variable as the normal varchar will not support.
    Please Advice
    Thank U
    SHAN

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

  • UNION for Columns of CLOB data type does not work

    Hi,
    I have two tables Encounter & Encounter_History. They have same columns. One column is of type CLOB. My requirement is to retrieve all the distinct records from both the tables with order by a date column. But problem is, UNION does not work in case of CLOB data type.
    I know it will work if I use UNION ALL, but it returns duplicate records.
    Please give me suggestion, how to solve this problem.
    For example: The following query does not work since column1 is a CLOB data type
    select column1 from table1
    union
    select column1 from table2
    Thanks

    But for sufficiently small clobs you can try:
    michaels>  SELECT TO_CLOB ('abc') cl
      FROM DUAL
    UNION
    SELECT TO_CLOB ('abc')
      FROM DUAL
    Error at line 1
    ORA-00932: inconsistent datatypes: expected - got CLOB
    michaels>  SELECT TO_CHAR (TO_CLOB ('abc')) cl
      FROM DUAL
    UNION
    SELECT TO_CHAR (TO_CLOB ('abc'))
      FROM DUAL
    CL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
    abc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    1 row selected.

  • Clob data type oracle to oracle issue

    Hi Guys
    i am unable to load clob data type and am getting the following error
    " java.lang.NumberFormatException: For input "string: "4294967295"
    i also have checked for clob data type in topology manager -- technology -- oracle -- data type
    and it is available.
    i have added the following statement in my parameter file
    set ODI_ADDITIONAL_JAVA_OPTIONS=%ODI_ADDITIONAL_JAVA_OPTIONS% " -Doracledatabasemetadata.get_lob_precision=false";
    but i don't see any statement like the one below after which i have to add the above statement.
    set ODI_ADDITIONAL_JAVA_OPTIONS="-Djava.security.policy=server.policy";
    please let me know how to make the clob data type work
    Regards
    janakiram

    Hi Sutirtha
    Yes i am able to view source data with clob data type by Right click onto your source datastore ---> View data
    I have checked metalink
    it says
    1. Oracle recommends the setting of the "get_lob_precision" flag to FALSE to avoid this message when dealing with LOB family datatypes (CLOB, BLOB, NCLOB, BFILE...).
    i have used the follwoing setting
    set ODI_JAVA_OPTIONS="-Djava.security.policy=server.policy"
    set ODI_ADDITIONAL_JAVA_OPTIONS=%ODI_ADDITIONAL_JAVA_OPTIONS% "-Doracledatabasemetadata.get_lob_precision=false"
    2. checked the internal id of CLOB data type and it ends with 999
    but still i have the same problem
    Regards
    janakiram

  • Oracle 10g XE and CLOB data type

    I am using Oracle 10.2.0.1.0 Express Edition and I wish to store large amounts of data in a CLOB column. I have created my table using a "standard" SQL statement similar to the following:
    CREATE TABLE LotsofData(
    id INT NOT NULL,
    data CLOB);
    The table is created successfully, so far so good.
    And I used a "standard" insert SQL statement to insert large amount of data into the before mentioned table, similar to the follwing:
    INSERT INTO LotsofData VALUES('4043', 'The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog <insert more iterations>');
    The data being inserted takes up 4043 bytes. Now when attempting, using among other programs the handy web interface, to execute the insert statement I get this error:
    Error starting at line 1 in command:
    INSERT INTO LotsofData VALUES('4043', 'The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog <insert more iterations>');
    Error at Command Line:1 Column:38
    Error report:
    SQL Error: ORA-01704: string literal too long
    Now if I reduce the size of the data to be inserted to 4000 bytes or below there is no problem. I have performed searches on google groups, google search engine, the oracle site, this forum but not found a way to solve it... I have found documentation stating that there is support for 4gb of user data, but well that doesn't really help.
    I have been on the trail of TABLESPACE and working with that, but with no luck. The data type BFILE will not work as I need to be able to change the data after it has been inserted into the table.
    Is the 4000 bytes a limitation in the Express Edition and I should just forget it, or is there a way I configure the database to accept large amounts of data. Should I be creating the table using a different SQL statement?
    kind regards
    Chris Nilsson

    Right... I found out how you can solve this, well not through the web interface... but oh well it is possible though...
    the error I was getting was: ORA-01704:     string literal too long.
    the keyword/phrase is "bind variables"... Did a little more searching and found this site:
    http://www.akadia.com/services/ora_bind_variables.html
    So basically you use bind variables to insert data which fills more than 4000 bytes...
    Since the data I will be inserting will be inserted via Java/.NET application I found the section called "Bind Variables in VB, Java and other applications" the most interesting... During my testing and I had neglected to use PreparedStatements in Java, and according to the site, using PreparedStatement provided an easier solution as the API does most of the work for you. My solution was to create a small program which read the large amounts of data from a file then feed this to a PreparedStatement, setObject or setASCIIStream/setCharacterStream, then execute it.
    Well I hope this helps other people who get the same error code.

  • Refresh fails on materialized view with CLOB data type

    Hi,
    Hope somebody can help me with this issue.
    Some materialized views get status broken on refreshment, but only sometime. When I try to refresh them manually I get following message: "ORA-01400: cannot insert NULL into...". But I know for sure that there are no NULL values in the master table, MV and master tables are declared in the same way and all columns in master tables are NOT NULL columns. Another ting is that this error I get only on columns with data type CLOB.
    Please, help!
    /Julia

    hi,
    I cant upgrade to 11g.Also i cant change the table structure.
    Here is a sample of xmltype field content:
    RECID      XMLRECORD
    D00009999      <row id='D100009999'><c2>10000</c2><c3>xxxxx</c3><c5>xxxx..
    And i need to extract in the mv the data from c2, c3 and so on.
    Still waiting for a hint.
    Thank you.

  • How to read the data from a column that is in clob data type (but XMLdata)

    Hi ,
    I have a table XYZ which has a column RESPONSE_XML in clob datatype format.we can convert it to XMLTYPE(RESPONSE_XML) to read the data in XML format.
    Now this is the DynamicXML schema file. Here I want to see all the COMMONNAME, ResourceDescribedby_VALUE into column_A, ResourceDescribedby_ResourceSpecCharacteristic_Name tags into column_B
    How can I do that .. any suggestions please ..
    Here is a sample XML:
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    _- <soap:Body>
    - <SearchResourceResponse xmlns="http://www.google.com/google.xsd">
    - <MessageElements xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    <MessageStatus>SUCCESS</MessageStatus>
    - <MessageAddressing>
    <from>gmail</from>
    <to>Gmail SOAPTester</to>
    <messageId>1234</messageId>
    <action>SearchResource</action>
    <transactionId>OR</transactionId>
    <ServiceName>SearchResource</ServiceName>
    <ServiceVersion>1.1</ServiceVersion>
    </MessageAddressing>
    </MessageElements>
    -<SearchResponseDetails xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    - <SubNetwork>
    - <Pipe xsi:type="icl:Trail" xmlns:icl="http://www.www.google.com/google.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <CommonName>318-223-4675</CommonName>
    <objectID>91535716980514105329</objectID>
    <SourceSystem>MARS</SourceSystem>
    - *<ResourceDescribedBy> <value>RDSSLA</value>* *<ResourceSpecCharacteristic> <name>*CentralOfficeCode</name>   </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceRelationship>
    - <Resource xsi:type="icl:Trail">
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>AssignLocationExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalInternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>+</value> - <ResourceSpecCharacteristic> <name>PairVerticalSign</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>RDSSLA</value> - <ResourceSpecCharacteristic> <name>CentralOfficeCode</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>B</value>- <ResourceSpecCharacteristic> <name>EntityType</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceType>FeederCircuit</ResourceType>
    - <LogicalPhysicalResource>
    - <PhysicalResource xsi:type="icl:PhysicalConnector">
    <usageState>S</usageState>
    - <ResourceDescribedBy> <value>25.392</value> - <ResourceSpecCharacteristic> <name>CableLength</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    </PhysicalResource>
    </LogicalPhysicalResource>
    - <TerminationPoint xsi:type="icl:TrailTerminationPoint">
    <CommonName>1000/34A</CommonName>
    - </Resource>
    </ResourceRelationship>
    <lrStatus>W</lrStatus>
    </Pipe>
    </SubNetwork>
    </SearchResponseDetails>

    you don't appear to have posted valid XML, so I can't reproduce using your example, but you will need to look at something like this:
    select xtab.common_name
      from your_table yt
          ,xmltable('/SearchResourceResponse'
              passing xmltype(yt.response_xml)
              columns
                  common_name varchar2(20) path 'SearchResponseDetails/CommonName'
          ) xtab
    ;

  • DB Link between Oracle 10g and Oracle 9i for CLOB data type

    How do I transport XMLType or CLOB from oracle 9i to Oracle 10G using DBLink?
    Is any restrction to DBLink, while transfering CLOB with XML data from oracle 9i to Oracle 10G?
    Please let me know how i resolve this issue.
    Thanks in advance.
    DK

    Well... it depends on what type of link you wish to create.
    If you have same user with same password on both databases (9i and 10G), then you can create a public database link as
    CREATE PUBLIC DATABASE LINK dblink USING 'dbalias';
    Note: dbalias is the value from your TNSNAMES.ORA. The database from which you are creating the db link has to have the entry in TNS for other database.
    Other method is to create a private db link
    CREATE DATABASE LINK dblink CONNECT TO user IDENTIFIED by pwd using 'dbalias';
    The number of open connections from a particular database is governed by init parameter DB_LINKS (this was in 8i.. not sure about higher versions)
    HTH...
    Message was edited by:
    satishkandi

  • NVL Function on CLOB data type

    Hi all,
    I am not able to use the NVL function over clob..please suggest me a way to do the data validation of the CLOB in sql ....
    below is the query i was using...
    select t1.pic_name,t2.pic_name
    from table1 t1,table2 t2
    where nvl(t1.picture_message,'X') <> nvl(t2.picture_message,'X');i am getting the following error....
    ORA-00932: inconsistent datatypes: expected - got CLOBThanks
    Rede

    Your problem is not NVL but rather comparing CLOBs:
    SQL> desc tbl1
    Name                                      Null?    Type
    ID                                                 NUMBER
    X                                                  CLOB
    SQL> desc tbl2
    Name                                      Null?    Type
    ID                                                 NUMBER
    X                                                  CLOB
    SQL> select  nvl(x,'NULL CLOB')
      2    from  tbl1
      3  /
    NVL(X,'NULLCLOB')
    NULL CLOB
    SQL> select  *
      2    from  tbl1,
      3          tbl2
      4    where tbl1.x = tbl2.x
      5  /
      where tbl1.x = tbl2.x
    ERROR at line 4:
    ORA-00932: inconsistent datatypes: expected - got CLOB
    SQL> SY.

  • Question related to CLOB data type in Oracle 11g

    Hi,
    I'm trying to assign a string value to a CLOB variable but it is giving me an error as described below. Can someone please let me know what am I missing here? As far as I know, in 11g a CLOB variable can store upto 4GB of data and all i'm trying to use is only 7K of data.
    DECLARE
    v_sql1 CLOB;
    v_sql2 CLOB;
    BEGIN
    DBMS_OUTPUT.ENABLE(1000000);
    v_sql1 := 'BLAH-BLAH-BLAH.........'; --> this string is actually more than 4000 characters.
    v_sql2 := TO_CLOB('BLAH-BLAH-BLAH.........'); --> this string is actually more than 4000 characters.
    dbms_output.put_line(v_sql1);
    dbms_output.put_line(v_sql2);
    END;
    When I try to execute the above script, I get the error message: ORA-06502: PL/SQL: numeric or value error:character string buffer too small.
    I even tried to use TO_CLOB function as shown above but it is failing as well.
    NOTE: The string to assign is not coming from any table but mainly a SQL statement used for sys_refcursor.
    Thanks.

    John Spencer wrote:
    Unless I missed something in the 11g new features, the maximum line length in DBMS_OUTPUT.Put_Line is still 255 characters.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> set serveroutput on
    SQL> exec dbms_output.put_line(lpad('X',512,'X'));
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Help needed in extracting pipe delimited fields in a CLOB data type

    hi
    i Had a table with clob field as shown below.
    CREATE TABLE TRANSACTION_INFO
      TRASACTION_ID  CLOB,
      LOG_ID  NUMBER
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
    Values
       ('354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123);
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
    Values
       ('354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456);
    COMMIT;As you can see Clob field is a pipe delimited data.Now i am able to extract the first two fields using the below querry.But it may be the right solution as
    substring function fails if there is missing character in any on the fields.
    Also when there is a null value in any of the fields,how can i be able to get as null value ? Basically i want to get the values in a delimited manner.
    how can we do this ?
    Select Substr (TRASACTION_ID, 1, Instr (TRASACTION_ID, '|')-1) field1,
            Substr (TRASACTION_ID, 17, Instr (TRASACTION_ID, '|')+2) field2              
      From TRANSACTION_INFO;
    output should be like as shown
       FIELD1          FIELD2          FEILD3                 FEILD4
    354502002020910     000000610214609663                  09/27/09 08:02:37
    354599892020910     000000610214609663                  09/27/10 08:12:47Thanks
    Rede

    hi Michael
    Thanks for the solution and its my bad not mention that there is a possibility of having a null value at the start of the record also which RPLACE function no longer works for this case.
    For example
    with transaction_info (trasaction_id, log_id)
         as (
    select '354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123 from dual union all
    select '354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual union all
    select '|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual
    select trim(regexp_substr (trasaction_id, '[^|]+', 1, 1)) f1,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 2)) f2,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 3)) f3,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 4)) f4,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 5)) f5
      from (select replace (trasaction_id, '||', '| |') trasaction_id from transaction_info)
    F1                   F2                   F3                   F4                   F5                 
    354502002020910      000000610214609663                        09/27/09 08:02:37    RNEW               
    354599892020910      000000610214609663                        09/27/10 08:12:47    SOLD  
    000000610214609663                        09/27/10 08:12:47    SOLD Now the last record is wrongly created....

  • How to make an insert script for CLOB data types?

    I need to have an insert script for Oracle 11g where I insert large texts into a CLOB field
    I exported data from a source table using TOAD's export dataset and the insert statements option, so it generates a script of just simple insert into statements with the clob strings in the values clause within single quotes.
    While most of the inserts succeed, several fail with the error: string literal too long
    How can I insert long texts into clobs?
    One workaround I was considering, is maybe breaking up those inserts which are too big, so that it inserts a chunk, and then does an update to append additional chunks? not sure if that would work either
    first wanted to get any ideas from the oracle experts here in case there is a much easier, non-manual labor intensive way.

    Thank you for that informative link, Raj
    I wouldn't be able to use SQL Loader for this though, this is something that gets submitted to a DBA in a request and it must be in a script that can be run in Sql Plus, and it cannot pull it from a table or file.

Maybe you are looking for