UNION ALL in VARCHAR and CLOB data types

Hi all

I want to execute the below query, but the Oracle is throwing a single error.

Select the comments as cm_comments from table1

Union of all the

Select text_action from table2

Union of all the

Select the notes to table 3

Union of all the

Select null from table 4

Error I got: ORA-01790: expression must have the same type of data, matching expression

Here, all columns have the data type of the CLOB except the 'notes' column in the table "table3." I know that this is the reason for the error, but I need a work around that. One solution I know is that cast varchar of clob type, but in this case, there is a chance to cut the data if the CLOB column contains data whose length is greater than the maximum data length for a VARCHAR column.

Please help me in this case to find a solution to this problem.

Your timely help is well appreciated.

Thanks in advance.

Try the below with TO_CLOB

Select the comments as cm_comments from table1

Union of all the

Select text_action from table2

Union of all the

Select TO_CLOB (notes) in table3

Union of all the

Select null from table 4

Tags: Database

Similar Questions

  • How can I justify the difference between varchar and varchar2 data type

    Hi all

    How can I justify the difference between the data type varchar and varchar2 on any table for space management.
    Is there any query to justify this.


    Concerning
    Girish

    Published by: boujemaa on February 2, 2011 21:23

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14220/datatype.htm#sthref3780


    The VARCHAR data type

    The VARCHAR data type is synonymous with the VARCHAR2 data type. To avoid any changes in behavior, always use the VARCHAR2 data type to store strings of variable length.

  • I have a xml stores and clob data type. I want to add a ' $', if there is any digit.

    "<? XML version = "1.0" encoding = "UTF - 8"? >

    benefits <>

    <>benefits-categories

    < code advantage-category = "generalDetails" >

    <>benefits-services

    < advantage-service id = "maximumOopMedicalDrugEhbBenefitsTotalIndividual" >

    < name of advantage-service-value = "inNetworkTier1" >

    < value > 6850 < / value >

    < / advantage-service-value >

    < name of advantage-service-value = "outOfNetwork" >

    Does not < value > < / value >

    < / advantage-service-value >

    < / service advantage >

    < advantage-service id = "maximumOopMedicalDrugEhbBenefitsTotalFamily" >

    < name of advantage-service-value = "inNetworkTier1" >

    < value > 6850 < / value >

    < / advantage-service-value >

    < name of advantage-service-value = "outOfNetwork" >

    < value > not applicable < / value >

    < / advantage-service-value >

    If you see the above xml code. You can see

    < name of advantage-service-value = "inNetworkTier1" >

    < value > 6850 < / value >

    < / advantage-service-value >

    I add $ before the digit 6850. It should be

    < name of advantage-service-value = "inNetworkTier1" >

    < value >$ 6850 < / value >

    < / advantage-service-value >

    I did the below, but does not work:

    update of the advantages of the set-Plan = to_clob (updateXML (xmltype (benefits),'/ / benefit-service-value [@name = "inNetworkTier1" ""] / value / text () ',' $' |)) extractValue (xmltype (benefits),'/ / benefit-service-value [@name = "inNetworkTier1" ""] / value/text () ')))

    where regexp_like (extractValue (xmltype (benefits),'/ / benefit-service-value [@name = "inNetworkTier1" ""] / value / text () '), ' ^ [[: digit:]]')

    Please notify

    Maybe just

    with

    data in the form of

    (select

    q' |

     

     

     

     

     

     

      6850

     

     

      Does not apply

     

     

     

     

      6850

     

     

      does not apply

     

    |' the_clob

    of the double

    )

    Select regexp_replace (the_clob,' > (\d+)<','>\1 $<') "$=""> )

    from the data

    $ added
    $6850 Not Applicable $6850 not applicable

    Concerning

    Etbin

  • VLD-2550 and 2551: CLOB data type errors

    Hi all

    I tried to solve thi sproblem, but have not been able to find a solution.
    Basically I have a Col1 (of A table) of the clob data type that is to be mapped to Col2 (table B).
    But when I validate the card I get the error:

    VLD-2550: BLOB, CLOB or NBLOB of the remote source data cannot be transformations (control Details: If you have any CLOB, BLOB as a remote data source, it must be directly mapped to a target feature)
    and
    VLD-2551: BLOB LCOB or NBLOB remote data source must be set based ON a SET of generation mode.

    My card has a mapping one between the passes of the tables A and B. Col1 is directly related to Col2 (if that is what is meant by any of the transformations of type CLOb)

    Thank you very much

    Hello

    If your source table (which the CLOB) is in the remote computer then you must set the mapping mode basic SET and you need to connect directly the source column of the target column.

    If you still get this kind of validation waring and simple not then ignore them.
    This is a defect of OWB. See Bug 5989066 : card VALIDATION WITH BLOB OBJECTS JETTÉ VLD-2550 AND VLD-2551 WARNINGS, which has yet to be fixed.

    Thank you
    Fati

  • Insert/update the column with the clob data type

    Hi all

    ORCL Version: 11g.

    I have a table with the clob data type.

    Test12

    (col1 clob);

    I'm trying to insert/update to update the column with more than 4000 characters.

    But due to the limitation of tank 4000, I could not Insert/Update.

    Need your help in resolving this issue.

    THX

    Rod.

    The limit of 4000 characters is incorrect.  That pertains only to the varchar2 data type.  A clob can hold more than 4 G.

    Here is an example that shows how to insert it, I found...

    Otherwise, here is a way 'dirty' to do.

    insert into your_table (COLA, COLB)

    values

    (PRIMARY_KEY, PART 1 OF DATA)

    ;

    Update your_table

    Define COLB = COLB | PART 2 OF BIG DATA

    where COLA = PRIMARY_KEY;

    Update your_table

    Define COLB = COLB | PART 3 OF BIG DATA

    where COLA = PRIMARY_KEY;

    .. and so on...

    I don't know that I personally recommend the second style...  But he could do the job.

  • Simple question of CLOB data type

    declare
    r clob;
    begin
      r := lpad('0',32768,'0');
    end;
    

    ORA-06502: PL/SQL: digital or value error: character string buffer too small

    ORA-06512: at line 4 level

    06502 00000 - "PL/SQL: digital error or the value of %s.

    So that tells me that an in PL/SQL CLOB data type cannot be as big as a VARCHAR2, correct? A variable in a PL/SQL can be greater than this?

    Thank you!

    So that tells me that an in PL/SQL CLOB data type cannot be as big as a VARCHAR2, correct?

    NO - that tells you that LPAD works with VARCHAR2 and function is what the limit.

  • Full table scan without sweeping particular column (CLOB data type column)

    I want to select the online_bank table. This table with a column of type CLOB data. I want to select all the columns in the table, except the column type of clob data. but oracle full table, including the column analysis server type CLOB data when the query is run. It took a long time to complete the table. Please give me a solution of full table scan without analysis the CLOB data type column. How to avoid the time scanning CLOB data type column... ?

    878728 wrote:
    I want to select the online_bank table. This table with a column of type CLOB data. I want to select all the columns in the table, except the column type of clob data. but oracle full table, including the column analysis server type CLOB data when the query is run. It took a long time to complete the table. Please give me a solution of full table scan without analysis the CLOB data type column. How to avoid the time scanning CLOB data type column... ?

    We do not have your table.
    We do not have your data.
    Therefore, we have no answer to your apparent mystery.

  • Problem with the CLOB data type.

    Greetings,

    I am facing a problem with the CLOB data type. I know that the CLOB data type is 4 GB (I use Oracle 9i). But in the Pl Sql procedure, I can only store 34305 size for a CLOB variable character data.

    This is the test script that I am trying to run.

    DECLARE
    -Local variables here*.
    I have INTEGER;
    C_1 CLOB.
    BEGIN
    FOR Rec IN (SELECT
    *
    ACCORDING TO THE TABLE)
    LOOP
    C_1: = c_1 | Rec.Clo_1;
    END LOOP;
    EXCEPTION
    WHILE OTHERS THEN
    Dbms_Output.put_line (SQLERRM);
    END;


    Here variable C_1 range value 34305 good character regardless of type CLOB. Now the above script fails if query my buckle - huge number of return values. It is throwing the exception "error during transfer of files ORA-06502: PL/SQL: digital error or value."

    He would be grateful if someone can help me on this.

    Thank you.

    You are probably better off using DBMS_LOB.append, instead of the concatenation of varchar2 (|).

    And... take off your when-other Manager exceptions, please...

  • Problem with the length of a CLOB data type

    Hello

    In my application, I have a page with an interactive report of written blogs - on this page, you can add a new blog (text box - CLOB data type), discovered a blog or edit a blog.
    There is something going wrong with the size of the blog text. I know APEX cannot accept that 32K text and I've seen the great value saving thread, but this isn't the solution to my problem.

    The problem is that when I add a blog with say about 4000 characters, it is saved in the database, but the interactive report, when I click on the view or edit icons for this blog, the blog text field appears empty. For small items (< 4000 characters), there is no problem.
    Anyone know why this is happening and how to fix this?
    Thank you!

    There seems to be a bug in the calculation of the value of the element Source when the Source Type is a SQL query and the data type of the selected column is CLOB. I'll file a bug for this. For now, I have demonstrated how you can use a type of function PL/SQL source instead. Please see point P3_TEXT:

    beginfor c1 in (select blog_textfrom blogwhere blog_id = :P3_BLOG_ID) loop  return c1.blog_text;end loop;return null;end;
    

    Scott

  • Hello. I have perchased the new iphone, and I gave my old iphone to my little brother. I erased all the content and the date in the settings menu. This will automatically delete all my photos data old messages etc. thanks

    Hello. I recently perchased the new iphone, and I gave my old iphone to my little brother. I erased all the content and the date in the settings menu. This will automatically delete all my photos data old messages etc. thanks

    Follow the directions here: what to do before you sell or give away your iPhone, iPad or iPod touch - Apple Support before giving the phone to your brother. -AJ

  • Add a new node to an existing XML (CLOB) data type

    Hi guys,.

    I have a table with one of his field as a CLOB data type that stores a XML here, now I need to add an additional node to the XML.

    <?xml version="1.0" encoding="UTF-8"?><alert>
     
         <tab0 comment="section in XSL component" name="Initial Information">
              <details>     
                   <Priority>0001</Priority>
                   <DateVRUClaimInitiated>2010-06-29</DateVRUClaimInitiated>
              
              </details>
              <contacts comment="grid in XSL component">
                   many child nodes here
              </contacts>               
         </tab0>
     
         <tab1 comment="section in XSL component" name="Additional Information">
              <details comment="list collection in XSL component">
                   <Channel1>123</Channel1>
              </details>
              <IPAddresses>
                   Many child nodes here
              </IPAddresses>          
              <ANIPhones>
                   Many child nodes here
              </ANIPhones>
         </tab1>
    </alert>
    Here, in this xml file, I need to add this node < / canal2 >... so my xml should look like
    <?xml version="1.0" encoding="UTF-8"?><alert>
     
         <tab0 comment="section in XSL component" name="Initial Information">
              <details>     
                   <Priority>0001</Priority>
                   <DateVRUClaimInitiated>2010-06-29</DateVRUClaimInitiated>
              
              </details>
              <contacts comment="grid in XSL component">
                   many child nodes here
              </contacts>               
         </tab0>
     
         <tab1 comment="section in XSL component" name="Additional Information">
              <details comment="list collection in XSL component">
                   <Channel1>123</Channel1></Channel2>
              </details>
              <IPAddresses>
                   Many child nodes here
              </IPAddresses>          
              <ANIPhones>
                   Many child nodes here
              </ANIPhones>
         </tab1>
    </alert>
    I can do using an update or something?

    but it converts my CLOB to ORAXML.

    then use getclobval():

    select insertchildxml(xml, '/alert/tab1/details', 'Channel2' ,xmltype('')).getclobval() xml from t
    
  • Help needed to extract the pipe-delimited fields in a CLOB data type

    Hello

    I had a table with clob field as indicated 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 the field Clob is a pipe delimited data. Now I'm 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 lack of character in all fields.
    Also when there is a null value in all the areas, how can I be able to get as a null value? Basically, I want to get the values in a defined way.

    How can we achieve 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:47
    Thank you
    Rede
    SQL> 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 regexp_replace(replace (trasaction_id, '|', '| '),'^\|', ' |') trasaction_id from transaction_info)
    /
    F1                   F2                   F3                   F4                   F5
    -------------------- -------------------- -------------------- -------------------- --------------------
    354502002020910      000000610214609663                        09/27/09 08:02:37    RNEW
    354599892020910                                                000000610214609663
                         000000610214609663                        09/27/10 08:12:47    SOLD                
    
    3 rows selected.
    
  • Import XML and bad data type

    Hi all!

    I have a form, I want to import xml data.

    In the xml data file: when I put a string in a numeric field (error) and the i value import data in my form:

    Acrobat don't tell me there is an error in 'format', but rather the value 0 (zero) value is put is the field.

    Is there a way (early event) to detect a data format error in the xml file?

    Thank you

    Not that I know of... .He is trying to bind the to imbound field in the form field and if it can you see your data... otherwise it will not appear.

    It is assumed that the incoming data was validated against the schema before importation is made so avoid data type mismatches.

    Paul

  • order of varchar and digital data

    Hello

    I use the apex of oracle 10g 3.2

    I am using an sql query in a region. I want to make sure he by setting col.parameter column is varchar2 (1000).
    The values can be of a character or the format of number of characters.
    as
    format ABC or def - 1

    Now, I want to use the order by clause in there.

    But when I have data like
    ABC-1, abc-2 11 - abc

    His comes as
    ABC-1
    ABC-11
    ABC-2

    instead of abc - 1
    ABC-2
    ABC-11

    the query is

    Select distinct
    p.Parameter Test
    of T_RESULTS t, M_PARAMETERS p where p.parameter_id = t.parameter_id and
    t.service_registration_id =: P43_SERVICE_REGISTRATION_ID
    order to decode (instr(p.parameter,'-'), 0, p.parameter, to_number (substr (p.parameter, instr(p.parameter,'-') + 1)))

    So, what should I do?

    Thank you

    Hello

    with t as (select 'abc-1' col1 from dual union all
    select 'abc-11' col1 from dual union all
    select 'abc-2' col1 from dual)
    select col1
    from   t
    order by case instr(col1,'-') when 0 then col1 else substr(col1,1,instr(col1,'-')-1) end,
                 case instr(col1,'-') when 0 then 0 else to_number(substr(col1,instr(col1,'-')+1)) end
    

    The first element will sort the alphanumeric characters, the other numbers if they exist.

    Herald tiomela
    htendam.WordPress.com

  • How to convert clob data type varchar2.

    Hello
    If select below questioning the data type must be varchar2 but I want to convert the text to a clob.


    Select 'World' of double;


    Kind regards
    Fame
    SQL> Select 'My_name is rajuvan' Vrchr,
    2       TO_CLOB('My_name is rajuvan') clb
    3      from dual; 
    
    VRCHR                          CLB
    ------------------------------ ------------------------------
    My_name is rajuvan             My_name is rajuvan
    
    SQL>
    

Maybe you are looking for