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
How to elaborate powercenter integration service?
Clarify the utilization of aggregator cache record?
What is standalone command task?
How to create a non-reusable instance of reusable transformations?
Name the different lookup cache(s)?
What is the maplet?
How do you set a varible in incremental aggregation
What is informatica powercenter repository?
What is a transaction control transformation?
Hi, I saw one mapping implemented by my seniors . In Expression transformation they implemented following logic. That is iif(is_date(in_UC_DATINV,'YYYYMMDD'),to_date(in_UC_DATINV,'Y YYYMMDD'),'Inventory Date is either invalid or null') Inventory_Date is validated only for is_date() But not validated for notisnull() . But error says “ either invalid or null “ why? Whether is_date() also check for not isnull() ? or in this logic something is different ? Please answer me . Advance thanks
What are the validations that you can perform in oracle and in informatica ? Advance Thanks
Tell me can we override a native sql query within informatica? Where do we do it? How do we do it?
What is a snowflake schema?
Why can't we connect source qualifier and aggrigator transformation to an expression ? Why they resticted to conncet 2 active trasformations to an passive transformation ?
can we override a native sql query within informatica? How do we do it?