Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
> Fetching Data from a table in a loop from the range of row
Debo1345
post Mar 23 2012, 12:23 AM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 23-March 12
Member No.: 46,971



Hi,
I have dcs_sku table .The record count is 50 thousand in that table.My requirement is to fech every row,create an xml out of it and post the data to some third party.
As the count is very huge,I can't select the entire record and do the operation at a time.
Can some one please suggest an way by which I will run the sql query in a loop,which will fetch 1st from rown 1 to row 1000,next 1001 to 2000,2000 no 'n' row...


I tried the below query:
select * from dcs_sku where rownum between 1 and 200...This gave me the 1st 200 rows and worked fine.
but the moment I changed the query to :
select * from dcs_sku where rownum between 201 and 300:::No result was coming up.

Please helppppppppppppppppppppppppppppppppppppppppppppppppp sad.gif sad.gif sad.gif sad.gif sad.gif I am very new to sql and this is a very very imp thing that I have to deliver to client asap.

So please helppppppppppppppppppppppppppppppppppppppppppppppp
Thanks
Debosree
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 1)
burleson
post Mar 23 2012, 05:16 AM
Post #2


Advanced Member
***

Group: Members
Posts: 11,714
Joined: 26-January 04
Member No.: 13



Hi Debosree,

>> am very new to sql and this is a very very imp thing that I have to deliver to client asap.

First off, it's PL/SQL you need, not SQL!

Second, if you are not qualified to do your job, you need to tell your boss; it will only be a matter of time until you are exposed and it will be embarassing for you . . . .

********************************************
>> Fetching Data from a table in a loop from the range of row

Here is how to perform a nested loop jin in PL/SQL, what you are describing:

http://www.dba-oracle.com/t_plsql_join_tables_together.htm

For XML formatting, see here:

http://www.rampant-books.com/art_otn_vj_jain_11g_xml.htm

*******************************************
>> select * from dcs_sku where rownum between 201 and 300

You cannot chuk out data with rownum, you need a symbolic key instead.

If you want to learn Oracle fast, get the Easy Oracle pack:

http://www.rampant-books.com/menu_six_packs_bundles.htm#easy

Good Luck!


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th November 2014 - 08:17 PM