seshu


{ City } guntur
< Country > india
* Profession * manager
User No # 83095
Total Questions Posted # 0
Total Answers Posted # 8

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 89
Users Marked my Answers as Wrong # 54
Questions / { seshu }
Questions Answers Category Views Company eMail




Answers / { seshu }

Question { IBM, 29281 }

how to check the 3rd max salary from an employee table?


Answer

1)SELECT MAX(SAL) FROM EMP WHERE LEVEL=3 CONNECT BY PRIOR
SAL>SAL
2)SELECT E.SAL FROM
(SELECT SAL,DENSE_RANK() OVER(ORDER BY SAL DESC)R FROM EMP)
E WHERE E.R=3

9966112520

Is This Answer Correct ?    10 Yes 5 No

Question { Oracle, 16031 }

there are 2 variables called x and y ,x contains 1,2 and y
contains 3,4 we have to swap the values from x to y and y
to x with out using dummy variables and it can be done only
by using a single statement ? how?


Answer

YES SMITA I HAVE ONE DOUBT IN YOUR QUESTION. X CONTAIN 1,2
HOW ONE VARIABLE CAN HOLD TWO VALUES AT A TIME. TRY TO BE
MORE SPECIFIC IN YOUR QUESTION

Is This Answer Correct ?    3 Yes 0 No


Question { iFlex, 14516 }

While inserting 10 rows using procedure, if 3rd entry is
having some error, what will be the output? How u will
handle that error?


Answer

WHEN YOU TRAP THE ERROR TILL THAT ROW THE ROWS WILL BE
INSERTED SUCCESSFULLY
IF YOU DONT HANDLE THE ERROR NO ROWS WILL BE INSERTED.
IF YOU ISSUE COMMIT AFTER EACH ROW THE FIRST TWO ROWS WILL
BE INSERTED SUCCESSSFULLY
IF YOU ISSUE COMMIT AT THE END NO ROWS WILL BE INSERTED

Is This Answer Correct ?    12 Yes 0 No

Question { 7856 }

write a query to delete similar records in different tables
with same structure


Answer

while creating table and giving foreign key constraint give
the key word 'on delete cascade'.automatically when the
record in the master table is delated the relaeted record
in the detail table will also be deleted.

Is This Answer Correct ?    3 Yes 3 No

Question { HCL, 50040 }

When we give SELECT * FROM EMP; How does oracle respond?


Answer

when we fire select * from emp; first oracle engine checks
the data dictionary called user_tables. if the table emp
existed then it checks all permissions then contacts the
data dictionary called user_tab_columns, and according to
the given condition the sql statement will be executed

Is This Answer Correct ?    9 Yes 2 No

Question { Accenture, 10219 }

Dear All,



Question for this Week



Find out possible error(s) (either at compile
time or at runtime) in the following PL/SQL block. State
the reason(s) and correct the errors.



Declare

Cursor C1 is select ename, sal, comm from emp;

Begin

For i in C1 Loop

If i.comm between 299 and 999 then

Dbms_output.put_line(i.Ename || ‘
** Good Commission’);

Elsif i.comm > 999 then

Dbms_output.put_line(i.Empno || ‘
** Very Good Commission’);

close C1;

Else

Dbms_output.put_line(i.Ename || ‘
** ’ ||nvl(i.comm,‘O’));

End if;

End Loop;

End;


Answer

WHEN YOU ARE USING CURSOR WIH FOR LOOP NO NEED TO SPECIFY
CLOSE CURSOR.
SINGLE CORES ARE LOOKING AS IF THEY ARE SINGLE CORES, BUT
THEY ARE SPECIAL CHARACTERS.
YOU ARE USIGN NVL FUNCTION IN THIS. YOU GAVE FIRST ARGUMENT
AS NUMBER DATATYPE, AND SECOND IS CHARACTER DATA TYPE. 0
AND O LOOK LIKE SAME JUST IT IS TO CONFUSE THE CANDIDATES.

Is This Answer Correct ?    0 Yes 0 No

Question { Yardi, 319579 }

how to find the second highest salary from emp table?


Answer

select max(sal) from emp where level=2 connect by prior
sal>sal group by level;

Is This Answer Correct ?    17 Yes 22 No

Question { Yardi, 319579 }

how to find the second highest salary from emp table?


Answer

second method is
select sal from emp e1 where 2=(select count(distinct(sal))
from emp e2 where e1.sal<=e2.sal);

Is This Answer Correct ?    35 Yes 22 No