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
What are the uses of synonyms?
Explain the blob datatype?
What is raw datatype?
How to create a stored program unit?
How to convert characters to numbers in oracle?
What is the difference between a hot backup and a cold backup in oracle?
What is tns service name?
What do you mean by group by clause?
HI Friends Myself Manoj,i am from bengaluru.i have 1 yr of exp in PLSQL but not upto the mark..now attending interviews but m not able to clear even 1 round..i have attended 3 interviews till today.purpose of writing this query is,i want to know the intreview topics that interviewer going to ask frequently,mainly SCENARIO based questions.IF anybody have any PLSQL projects please give it to me,it will helps me alot.Thanks for your patience.
What happens to the current transaction if a ddl statement is executed?
What are data pump export and import modes?
Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?
How to create a new table in oracle?
 How to use an oracle sequence generator in a mapping?
How to resolve name conflicts between variables and columns?