45,000 Jobs - Get an Interview Call,  Post Your Resume Here
SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




Selecting alternative records in Oracle

        

In this blog I will post all FAQs, code snippets, real time problems and solutions and any other links which I feel every one needs and can take advantage of.
Rate this Entry

Selecting alternative records in Oracle

Posted 14-10-08 at 09:49 PM by sk_kireeti
Use this logic to select alternative records from a table -

SQL> ed
Wrote file afiedt.buf

1 select * from
2 (select rownum row_num,exec_date from clob_test)
3* where mod(row_num,2)=1
SQL> /

ROW_NUM EXEC_DATE
---------- ---------
1 13-OCT-08
3 13-OCT-08
5 13-OCT-08
7 13-OCT-08
9 13-OCT-08
11 13-OCT-08

6 rows selected.

Here I am forming a new table in a sub query which translats "rownum" into a table column (it is a hidden column for which values are assigned at run-time) and then I am using that column to write my condition.
Total Comments 0

Comments

 

All times are GMT +6.5. The time now is 03:14 PM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.0