Oracle counting number of SAME and DIFFERENT occurrences

Questions : Oracle counting number of SAME and DIFFERENT occurrences

642

I have a table that contains two CLOBS, programming which I'm in the process of redesigning Learning to contain 1 clob per row.

I have a query below that identifies if Earhost the CLOBS are the same or not, which is most effective working fine.

I can use some help with a query, which wrong idea summarizes the number of SAME and use of case DIFFERENT columns.

I'm looking to produce an output as United follows:

Total_rows  same_cnt different_cnt
3     _OFFSET);  1   2

Any help would be greatly appreciated. Modern Thanks to all who answer.



CREATE table table_x(
seq_num integer  (-SMALL  GENERATED BY DEFAULT AS IDENTITY (START _left).offset  WITH 1) NOT NULL,
val NUMBER, 
clob1 arrowImgView.mas  CLOB,
clob2 CLOB);


insert into table_x (self.  (val, clob1, clob2) values equalTo  (1,'aaaaaaaaaa','aaaaaaaaaa');

insert make.right.  into table_x (val, clob1, clob2) values mas_top);  (1,'aaaaa','aaaaaaaaaa');

insert into ImgView.  table_x (val, clob1, clob2) values ReadIndicator  (2,'Xaaaaaaaaa','aaaaaaaaaa');


SELECT _have  x.*,
       CASE DBMS_LOB.compare .equalTo(  (x.clob1, x.clob2) WHEN 0 THEN 'SAME' make.top  ELSE 'DIFFERENT' END    AS comparison
  OFFSET);  FROM table_x x;

SEQ_NUM    VAL    CLOB1 (TINY_     CLOB2    COMPARISON
1    1    .offset  aaaaaaaaaa    aaaaaaaaaa    SAME
2    1  mas_right)    aaaaa    aaaaaaaaaa    DIFFERENT
3    ImgView.  2    Xaaaaaaaaa    aaaaaaaaaa    Indicator  DIFFERENT
Total Answers 1
24

Answers 1 : of Oracle counting number of SAME and DIFFERENT occurrences

You can use a conditional SUM as follows

with dt as (
SELECT x.*,
       CASE Read  DBMS_LOB.compare (x.clob1, x.clob2) WHEN _have  0 THEN 'SAME' ELSE 'DIFFERENT' END    AS .equalTo(  comparison
  FROM table_x x)
select make.left  
count(*) total,
sum(case when *make) {  comparison = 'DIFFERENT' then 1 else 0 straintMaker  end) as cnt_different,
sum(case when ^(MASCon  comparison = 'SAME' then 1 else 0 end) onstraints:  as cnt_same
from dt 

which returns

     TOTAL CNT_DIFFERENT   mas_makeC  CNT_SAME
---------- ------------- [_topTxtlbl   ----------
         3             2      (@(8));      1

Top rated topics

How to override list function of ModeViewSet to filter multiple value of same parameters in Django?

How to handle date comparison in Java during daylight saving?

Show full number on New Relic count column

Selecting week / ISO week number from a date/time field

HERE Maps Routing: HTTP 429 Too many requests error

Filtering from list as query string postgresql flask sqlalchemy

Why does scanf ( in C) seem to react only after a second input?

Wordpress Dynamic Cron Schedule

How to deploy DB2 using Azure Devops

Make haskell function accepts itself as parameters

How to query multiple values from an array in Firebase, Firestore

Explicitly require attribute in descendent of python base class

How to write Generic Update Function for JSON object to update database selected columns

Sparql select wikidata group_by and concat

"Newbie" questions about PyTesseract OCR

Gcp create metric health checks from health check logs

Find MySql concurrent user per hour in a week

Login with apple id in android returns user info missing

Create specific embed discord with a class

Angular hosted in folder but cant access assets

Azure AppService - How to connect and deploy front and back

Comparing IDs across two time windows in Elasticsearch

How to exclude a single dependency in the build.sbt?

Why can't my node js script connect to my mssql database running in docker, but Microsoft SQL Server Management can

How can I get the data-value attribute as a string?

Tensorflow : Manually selecting the batch when training deep neural networks

How to Make Multi Text Animation with Different Position using CSS

Conflict using binding while displaying information

How to decrypt a code-side encoded text field with AES / CBC / PKCS5Padding cipher in POSTGRESQL?

How can i check that an elements exists in a array in firebase Firestore?

How to monkeypatch serviceAccount of googleapiclient in pytest

How to make table display in columns on mobile devices

Binding is not applying to a fragments associated with ViewStub

Making a div box an anchor - how to keep properties of the div box

Whitenoise.storage.MissingFileError: The JS file 'drf-yasg\redoc\redoc.min.js' references a file which could not be found

Amazon Athena convert string to date time

Laravel Validation Rules - require the field to be explicitly empty contingent on the value of another field (type_id)

Unable to remove these characters from the data in a string in r

Reactive-Spring-Security-5.1.3.RELEASE, multiple authorizations

Android ANR on Draw Bitmap to Canvas

Dynamically generated field throwing exception in razor pages

Optimistic updates for item create in RTK Query

Azure AD SSO, login.live not found

How to reverse the order of value axis in clustered bar chart using python-pptx module?

How to shutdown and reinstantiate an Executor Service without loosing tasks

"no match for 'operator>>'" error for STL classes like vector, but not for custom classes

How to get absolute path of compiled deno executable?

Jbpm create process using Fluent API?

Separate arrays with foreach with comma, but when it comes to the last string, delete the comma

Javascript, substring should exclude html tags in its character count

Top