We need to compare two successive records of a table based
on a field. For example, if the table is CUSTOMER, and the
filed is Account_ID, To compare Account_IDs of record1 and
record2 of CUSTOMER table, what can be the query ?
Answer Posted / manikandan. s
WITH wt AS
(SELECT ROWNUM sl, a.Account_ID
FROM CUSTOMER a)
SELECT a1.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1
UNION
SELECT a2.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
How to loop through data rows in the implicit cursor?
What is oracle instant client?
How do I connect to oracle database?
What are ddl statements in oracle?
What is a dead lock in oracle?
How would you change old and new values in an insert, delete and update triggers?
Why do I get unexpected characters from 8-bit character sets in weblogic jdriver for oracle?
What is translate in oracle?
What is the difference between hot backup and cold backup in oracle?
What is literal?
How to define an oracle sub procedure?
What are the four Oracle system processes that must always be up and running for the database to be useable?
How remove data files before opening a database?
How to best split csv strings in oracle 9i?
What is oracle thin client?