Compare CLOBs in a query

Hi Guys
How is it possible to compare CLOBs (as a column data) coming in query result and further filter the same query to excluding the excatly similar CLOBs.
Cheers
Shabar
Edited by: shabar on Jun 15, 2011 12:47 AM

you could use dbms_lob.compare().
Something like this:
SQL> create table clob_test
  2   (
  3    clb1 clob, clb2 clob
  4   ) ;
Table created.
SQL> insert
  2  into clob_test values
  3   (
  4    'matching', 'matching'
  5   ) ;
1 row created.
SQL> insert
  2  into clob_test values
  3   (
  4    'matching', 'not matching'
  5   ) ;
1 row created.
SQL> select *
  2  from clob_test
  3  Where Dbms_Lob.Compare(Nvl(Clb1,'NULL'),Nvl(Clb2,'NULL')) = 0;
CLB1                  CLB2
matching              matching
1 row selected.Vivek L

Similar Messages

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • Compare two characteristics in Query

    Hi Experts,
    I have to compare two characteristics in Query fields like (A)Approved Level of Job(contain values like 01,02,03,04) and (B)Required Level of Job(contain values like 01,02,03,04).
    Now I have to do these calculations
    If A>B =1
    If A<B =0
    And also in other case
    If A=b  then value 1
    Of A =/= B then value 0
    Please let me know how I can achieve this.
    These values could be in A,B,C,D instead of 01,02,03,04 then in that case how I will calculate these comparison.
    Thanks
    Take care
    Vishal sharma

    Hi,
    i need the solution in this format on the comparison two characteristics in Query:
    0=false
    1=true
    Approved Level of Job(A)     Required Level of Job(B)      A=B         A not equal  B     A>B               A<B
         1                                                         3                                       0                         1                      0                 1
         4                                                         2                                       0                         1                      1                 0
         3                                                         3                                        1                         0                      1                 1
         5                                                         4                                       0                         1                      1                 0
         1                                                         2                                       1                         1                      0                 1
    count(A):5                        Count(B)5                                 sum 2                 sum 4           sum 3         sum 3
    so my CKF will be
    A>B/5 means 3/5=60%
    I also need to know how i am going to count A and B too.
    thanks
    take care
    vishal sharma

  • Can we compare CLOB (xml received from upstream sources)

    can we compare CLOB ( xml received from upstream sources) for particular business date's CLOB data with another business date in OBIEE.

    Not sure, have to verify.Checkout the below link for a workaround in 10g
    http://oraclebizint.wordpress.com/2007/11/12/oracle-bi-ee-101332-working-with-clob-fields/
    Rgds,
    Dpka

  • Comparing clob columns in two tables

    I need to copy the clob data from one table to another. However, I need to remove duplicates while doing so. When I run the following query, it loads all of the rows, whether they are duplicates or not.
    INSERT INTO L_COMMENTS
    SELECT comments_key.NEXTVAL, 'ASSOCIATECOMMENTS', ASSOCIATECOMMENTS
    FROM TABLE1 A
    WHERE ASSOCIATECOMMENTS IS NOT NULL
    AND NOT EXISTS
    (select 1
    from L_COMMENTS C
    where COMMENT_TYPE = 'ASSOCIATECOMMENTS'
    AND dbms_lob.compare(C.COMMENTS, A.ASSOCIATECOMMENTS) = 0)
    Any idea on how to do this load? I have several similar loads to do.

    If I did that, for any column that has a duplicate, neither one would be included.

  • Compare characteristics in a query

    Hello,
    we have an InfoCube for FI transactional data and a Master data InfoObject for 'Terms of Payment'. We would like to create a query which compares the 'Terms of Payment' values in the transactional data, as booked by users, with the 'should-be' values of 'Terms of Payment' in the master data, i.e. how the value was posted compared to the value that should be posted.
    Using an infoset our query lists the data of the infocube and infoobject for characteristic 'Terms of Payment'.
    However, we would only like to see the values that are not equal to eachother. If 'Terms of Payment' was a keyfigure, we could use conditions or exceptions but the field in question is a characteristic.
    We could run a macro in Excel and run the report in BEx but the requirement is for web.
    Has anyone an idea how we can compare the characteristic values in a query so that only the unequal values are displayed?
    Thank you,
    Florian

    Hi Florian,
    In that case you will have to use virtual Key figure. Include it in the cube. Since, it is populated at query runtime, no need to refresh data in the cube.
    In the BADI u can check the terms of payment from transaction data and master data and if found equal u can set the virtual KF as 1. And then u can apply a condition in the query not to show records where the KF is 1.
    Best Wishes,
    Mayank

  • Options to control display performance of CLOBs, etc. in Query Result view?

    Whenever I attempt to query a table that contains LOBs (e.g. a CLOB or XMLTYPE), the lack of performance pretty much makes the "Query Result" view (from F9) unusable. Any time I attempt to scroll the results, SQL developer apparently continues to query the database for the additional characters to populate the view.
    Resizing the columns containing the LOB to only a few characters almost solves the issue. Unfortunately, the size of the columns showing the LOBs apparently attempt to resize to the length of the LOB, making the column several pages long - and the same performance issue prevents resizing it smaller.
    Ideally, there would be some way to resize a column to a given or even a predefined and small size, without having to drag the resize handle the entire width of the desired resize amount. Alternatively, there could be a user preference to never set default column widths above a given number of pixels or characters. Another option would be a user preference to disable the in-line display of LOB contents, displaying only and requiring a click on the "..." (or pencil icon) button to open the "View Value" dialog. Ideally, all 3 of these options could be implemented.
    One crude work-around I'm using for now is to exclude the LOB columns from the results, requiring me to make secondary queries to see the LOB contents when necessary, and doesn't allow for scrolling through and viewing the LOB contents at all. Another work-around is to run the query as a script (F5) instead of a query (F9), and view the results in the "Script Output" view instead.
    I'm currently using SQL Developer 2.1.0.63, but experienced this same issue with all previous versions, including 1.5.5.
    Thanks!

    I agree.
    When I requested to auto-width the columns, I said to build in a maximum, but apparently they didn't.
    I suggest you log 2 feature requests on the SQL Developer Exchange; 1 for the maximum width, 1 for the CLOB contents/performance. Like this others can vote too and add weight for future implementation (I will).
    Have fun,
    K.

  • Comparing two characteristics in query.

    Hi,
    In my CKF, I want to compare two different characteristics. Field 1 contains the value 'Y' and 'N' while Field 2 contains the value 'SP' and 'MP'. I tried to create a formula variable using key but the dimension ID supports does not give option of char.
    In the query i am trying to compare both the fields:
    ((Field 1 == 'Y')AND(Field 2 =='SP'))* (20 - X)+ ((Field 1 == 'Y')AND(Field 2 =='MP'))* (30 - X)
    Can anyone kindly suggest what can be done in this case. Any suggestion would be of gr8 help to me.
    Thanks
    Palak Vyasa

    i think its alomost not possible what you are trying to achieve (no idea if there is a way)..
    but i have an idea..why don't you try out with restricted KeyFigures?
    Create two dummy RKFs and hide them.
    RKF1: combination of Field1=Y,Field2=SP,and any Base KF.
    RKF2: combination of Field1=Y,Field2=MP,and same Base KF.
    Then try this formula:
    (RKF1<>0)(20 - X)+(RKF2<>0)(30 - X)
    One of these RKFs must be zero always then only you get desired result..isnt it?
    as both RKFs are restricted by same KF and Same Field1 but different Field2,one them should be zero always.

  • Comparing dates in select query.

    Hi Experts,
    I need to select data from one table such that the date field of the table should be either today's date or earlier date.
           How can I write such comparison statement in select query.

    hi,
    select * from <your_table>
                   where <date_field> <= sy-datum.
    endselect .
    regards,
    burak

  • Comparing string in select query

    Hi,
    select single *
           from mara
           where <b>matnr = wa-matnr</b>.
    Here matnr is char18. Can we compare string like this?
    When <b>wa-matnr</b> is in <b>lower case</b> it is setting sy-subrc = 4, even though the matnr exists in mara. When converted to upper case and used it is setting sy-subrc = 0.
    Is there any other solution for the problem? I have checked out with matnr's conversion routine. It is also not working.

    just try  dat way...
    <b>ex...</b>
    data:wa_matnr like mara-matnr.
    data:wa_matnr1 like mara-matnr.
    data: gv_matnr like mara-matnr.
    wa_matnr = 'comptest'.
    CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
      EXPORTING
       LANGU                     = SY-LANGU
        TEXT                     = wa_matnr
    IMPORTING
       TEXT_UC                   = wa_matnr1
    EXCEPTIONS
      NO_LOCALE_AVAILABLE       = 1
      OTHERS                    = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    select single matnr
    from mara into gv_matnr
    where matnr = wa_matnr or matnr = wa_matnr1.
    write : gv_matnr.

  • Problem in date comparing with db2 database,query is not executing

    hi everyone
    i have one jsp page two text box
    1. one for start date
    2.second for end date
    and for date selection have used datepicker
    user selects the start date and end date .then clicks on view button
    then i am retrieving these two dates on next jsp page .uptp here is ok
    here i want display related data from db2 databse between these two dates(start date and end date)on next jsppage
    but it is giving error my db2 dtabse uses the format of YYYY-MM-DD
    the query i am not able execute
    String strsql ="select voucher_master.VOUCHER_TYPE,voucher_master.VOUCHER_NO,dd_master.CHQ_DD_NO,dd_master.DD_DATE from voucher_master,dd_master Where voucher_master.VOUCHER_ID = dd_master.VOUCHER_ID and dd_master.DD_DATE >=" + fromdate + " and dd_master.DD_DATE <=" + todate + "";
    it is giving error
    please help me

    Mutlipost: http://forum.java.sun.com/thread.jspa?threadID=5224616
    Why aren't you checking your earlier posts for replies? Don't multipost, it's irritating and wastes times and energy.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • How to compare MoM using MDX Query

    Hello,
    I have a cube which I want to use  to compare MoM. 
    Example:
    Start Date : Jan 1 2015
    End Date : Jan 31 2015
    compare again Dec 1 2014 and Dec 31 2014
    Report will look like like:
                              Sales
                              Jan 1 - Jan 31 2015            Dec 1 - Dec 31 2014     Variance              % Variance
    Product A               100                                       200                  
         -100
    Product B                50                                         40              
                10
    Wondering how this can be achieved SSAS.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hello,
    Thanks for the reply. I is surely helpful but here is the next challenge I have in this:
    Just to give a run down, let's say user want to run a data for following date and want multiple comparison based on the date:
    For example date entered by user is Jan 14, 2015 and he want to see the data
    Jan 01 - Jan 14th  for the MTD For Jan 2015
    Dec 01 - Dec 14th for previous month
    Oct 16 2014 to Jan 14 2015 (previous 90 days from Jan 14 2015)
    Sep 15 2014 to Dec 14 2014 (previous 90 days from last date of previous month which is Dec 14th in this case)
    Just wondering if this kind of date range can be calculated on fly to get the data.
    Thanks,
    P
    mark it as answer if it answered your question :)

  • Converting in varchar2 to clob in select query

    Hi All,
    Help me in displaying vachar2 data and clob data one below the other. Following steps i had taken but failed to achieve any results on ora9.2.0.1.0.
    create table temp_ajay
    ename varchar2(20)
    create table temp_ajayx
    ename clob
    select to_clob(ename) from temp_ajay
    union
    select ename from temp_ajayx
    above gave
    select to_clob(ename) from temp_ajay * ERROR At line 1: Ora-00932: incoherent types of data: - waited; CLOB obtained
    as error.
    How do i resolve this? Pls help
    rgds,
    Ajay

    select to_nchar(ename) from temp_ajay
    union
    select to_nchar(ename) from temp_ajayx;
    or
    select to_char(ename) from temp_ajay
    union
    select to_char(ename) from temp_ajayx;Message was edited by:
    Jameel

  • Benefits of SAP Business Warehouse Reporting compared with the Query-tools?

    Hello experts,
    I've been creating reports with SAP Query tools, but been faced with few problems. First of all, there are restricted possibilities in terms of joining tables, and thus I cannot include all the data required for the report.
    One solution for this would have been to create separate queries and join the data together in Excel. The problem with this is that there exists no common field that would make sense as for a selection criterion. If the selection criterion is different in different queries, there is the danger of combining false data together, which would eventually result with distorted data. 
    So I was wondering, could anyone briefly tell me if SAP Business Warehouse reporting would solve these problems? And what other benefits would it provide compared with the SAP Query? I'd urgently need to know if it would be a beneficial investment for the company, since I haven't found solutions for the problems occurred in the creation of reports.
    Thank you in advance for you help!
    Maria

    The answers are yes - and thousands of companies have gone down this route
    Puttingin BW is a strategic aim of the comapny and not to be thought about and discussed in a BI forum such as this
    The costs of implementation and hardware will no doubt make your eyes water.
    To be quite honest SAP BI is a "no brainer" as most of the new e-SOA and new R3 modules reply on BW for their reporting needs

  • Data compare

    Hi
    I would like to run below query on all tables, however it doesnt work on clob and long datatypes
    select * from owner.table_name
    minus
    select * from owner.table_name@remote_db;
    from dba_tables
    where owner in ( '....');
    ORA-00932: inconsistent datatypes: expected - got CLOB
    How can I compare the data of clob and long datatypes using dblink ?

    you can not pass clob data over a dblink. you can use plsql to help if it is necessary. you can create a package and describe a cursor in it, then write a function which will return next 4000 char of clob and you can get all clob data using this. why do you want to compare clobs ? what is your purpose, what data is in clob ?

Maybe you are looking for

  • Jabber Client for Windows. Desk phone control trouble.

    Good day! I have CUCM - version 9.1.1.20000-5, JFW version 9.2.3 build 4417 and Microsoft AD server. I have configured: 1. LDAP directory in CUCM using SSL connection 2. LDAP authentication in CUCM using SSL connection (port 636) too. All other confi

  • Report gives stock in unit of issue

    Hi, Mb52 gives stock in basic unit of measure . Is any other report where i want stock in unit of issue with list of material. Regards, Rajendra D. Sawant

  • Accidentally Deleted a Custom Setting

    Today I accidentally hit delete on a custom Compressor setting and for some reason there's no "undo delete" option available. I can't find the setting in my OS Trash, and have no idea if there's any way to recover it. The setting was created by anoth

  • How to make sure frames are present

    i am trying to open two web pages in a single window , but while browsing i am not able to keep my frames , when i press some links the frames r lost. What should i do to keep my frames in place and open pages without losing any frames i have used al

  • Save pics to SD card in 4G LTE

    >>Duplicate post removed for cross-posting violation of the Verizon Wireless Terms of Service     See 4 G LTE - save pictures to second sim card?  for original message<< Message was edited by: Verizon Moderator