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 / garima
SELECT (case when a_id > b_id then 'Greater' else 'Lesser'
end), a_id, b_id
FROM (SELECT ROWNUM r_a, account_id a_id
FROM customer) a,
(SELECT ROWNUM r_b, account_id b_id
FROM customer) b
where r_a = r_b+1;
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can we write dml statement in function in oracle?
How to call a stored function in oracle?
How do I escape a reserved word in oracle?
What is a trigger and what are its types?
What is the sid in oracle?
What is the difference between the Oracle ODBC driver and a Microsoft ODBC (Open Database Connectivity) Driver?
How to generate query output in html format?
How to import one table back from a dump file?
An automatic job running via DBMS_JOB has failedKnowing only that its failed, how do you approach troubleshooting this issue?
What do you mean by cdb and pdb in oracle 12c?
Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).
How to assign query results to variables?
What is an oracle database table?
How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?
How to drop a tablespace?