Topic: SQL*Plus and PL/SQL >> Alternate rows retrieval
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Title: Alternate rows retrieval |
| Babu |
Posted: Feb 16, 2007 07:41:33 AM |
Total Post: 3
Joined: Jan, 2007
|
Hiiii Gurus,
can anyone tell me how to retrieve the alternate rows from a table.(.eg-1,3,5,7........rows)
Thanx and regds
Arup
|
|
|
Oracle Virus |
| Posted: Feb 16, 2007 08:19:30 AM | |
|
Total Post: 50
Joined: Jan, 2007
|
Hi Babu,
I believe you can do that using the Rownum and Rowid -- great gift provided by oracle. These are internal and you can query it normally. For the alternate rows, write a loop using those.
I can't give you the code as "I Cam Smell Friday!! Can You???"
Regards,
Aneel Kanuri
|
|
|
|
|
sudha |
| Posted: Feb 18, 2007 05:14:45 PM | |
|
Total Post: 15
Joined: Jan, 2007
|
hi guru
try this one
select oddnum from (select rownum oddnum,mod(rownum,2) chkk from tablename)where chkk=1;
bye
sudha
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 333 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|