Query to get max and second max in oracle in one query ?
Answer Posted / rohit
The below query will provide the max and second max in
oracle in one query
select * from emp e
where 0 = (select count(sal) from emp
where e.sal < sal)
or 1 = (select count(sal) from emp
where e.sal < sal);
Is This Answer Correct ? | 17 Yes | 8 No |
Post New Answer View All Answers
> CREATE OR REPLACE FUNCTION FACTORIAL_1(factstr varchar2 ) 2 RETURN NUMBER AS 3 new_str VARCHAR2(4000) := factstr||'*' ; 4 fact number := 1 ; 5 BEGIN 6 7 WHILE new_str IS NOT NULL 8 LOOP 9 fact := fact * TO_NUMBER(SUBSTR(new_str,1,INSTR(new_str,'*')-1)); 10 new_str := substr( new_str,INSTR(new_str,'*')+1); 11 END LOOP; 12 13 RETURN fact; 14 15 END; explanation Above program?
What are the limitations oracle database 10g xe?
What is a cognitive schema?
Explain drop constraint oracle?
How to enter a new row into a table interactively?
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.
How do I call oracle stored procedures that take no parameters?
What is query image?
What is an external table?
How to delete multiple rows from a table in oracle?
What is the use of file param in imp command?
How to manage transaction isolation level?
Explain oracle’s server parameter file.
How do I recompile a procedure in oracle?
What are the attributes that are found in a cursor?