Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the query to find nth highest salary?
What is the use of cursors?

Answer Posted / suraj kedia

There are 3 ways to find out the nth highest salary in a
given table (e.g. emp) as below;

1) select distinct sal from emp e1 where &n=(select count
distinct sal from emp e2 where e1.sal <=e2.sal);


2) select empno,enaame,sal,deptno,rank () over (order by sal
desc) as ra from emp where ra=&n;

3) select empno,enaame,sal,deptno,dense_rank () over (order
by sal desc) as ra from emp where ra=&n;


All the above methods are tried n tested....it works
successfully.




What is a Cursor.

When a query is executed in oracle, a result set is produced
and stored in the memory. Oracle allows the programmer to
access this result set in the memory through cursors.

Why use a cursor?

Many times, when a query returns more than one row as a
result, we might want to go through each row and process the
data in different way for them. Cursor is handy here.

Types of cursors:

Oracle PL/SQL declares a cursor implicitly for all queries
and DML statements (including queries that return only one
row). But in most of the cases we don’t use these cursors
for queries that return one row. Based on this, there are 2
types of cursors

1. Explicit cursor
2. Implicit cursor

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

without table how to come first record only in oracle?

2220


How can we improve session performance in aggregator transformation?

1062


What is meant by active and passive transformation?

1071


Can we change Dynamic to Static or Persistent cache? If so what happens?

2164


waht type of interface is used for testing the data in informatica

2214


Where is metadata stored?

1067


How can we store previous session logs?

1012


What do you understand by SOA of Informatica?

951


What is the session task and command task?

1009


3.how will u get information about bugs how will u rectify the bugs in realtime whch tool we are using to rectify the bugs

2206


What is a node in Informatica?

1018


how to create user defined function (udf) in informatica

1268


How to improve the performance of a session using sorter transformation?

1115


design of staging area?

1986


Plz can any one say me how to get the informatica certification materials and dumps

2019