[Show all top banners]

Obie Trice
Replies to this thread:

More by Obie Trice
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Oracle SQL question
[VIEWED 5081 TIMES]
SAVE! for ease of future access.
Posted on 07-16-07 1:57 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hello,
this might be very basic question for you. I have a SQL statement that returns more than 150,000 tuples. I want to break the result to process. I mean I want to process the first 100,000 records first, then rest. Is there anyway I can break this by SAMPLING... I am using Oracle 8i PL/SQL.. Any help would be appriciated.

TY
 
Posted on 07-16-07 3:43 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I am kinda doing this within stored proc... something like if counter < 50000 then process... It's working, but i want to know if there is any way to embed code within SQL... might be dumb question
 
Posted on 07-16-07 3:47 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

yea that's a pretty dumb question
 
Posted on 07-16-07 9:21 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Is this for School or work related?
 
Posted on 07-16-07 9:43 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Bob,
does it matter if it is school or work related? I had to generate an extract file, which got really long, so i was thinking of processing by breakin up. Anyways I already figured out, so chill out
 
Posted on 07-17-07 10:03 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hey Orbie,
Cna/ Do you use Perl script at all? Just a thought, U could call the stored proc within the perlscript and split the output file into multiple files.
 
Posted on 07-17-07 10:16 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

This might be a good idea.

Since you have so much data why don't you break it apart.
In a Stored Procedure , Create 3 temp table
Create table #TempTable1
(col1 int,col 2 int,col3 money.....)
then insert the data like 50000 in one temp table 1, another 50000 in temptable2 and so on.
insert into #TempTable1 (col1, col2, col3,....) values (select col1, col2, col3, ...from OriginalTable where .....(i think here you might wanna counter < 50000)
so now you break the data into 3 part. now all you need to do is selete from those temp tables and create a file. for select, use
Select * from #TempTable1


this might work.
let me know if there is any issue..

KEEP DIGGIN......Keep Programmin......
 
Posted on 07-17-07 10:25 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Obie Trice , how did u do it
 
Posted on 07-17-07 9:22 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

In Oracle, use ROWNUM column...
WHERE ROWNUM < 50000 but you cannot use ROWNUM > 50000 in Oracle 8i or 9i. I am not sure... it didn't work for me So I used MINUS operator. Your logic could work too.

For eg.
SELECT * FROM TAB1
MINUS
SELECT * FROM TAB1 WHERE ROWNUM < 50

I think in SQL server, they use key word LIMIT I think. BTW, how many of you work in Oracle? I know there are bunch of guys in SQL server.
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 365 days
Recommended Popular Threads Controvertial Threads
शीर्षक जे पनि हुन सक्छ।
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
What are your first memories of when Nepal Television Began?
Sajha Poll: नेपालका सबैभन्दा आकर्षक महिला को हुन्?
ChatSansar.com Naya Nepal Chat
NRN card pros and cons?
TPS Re-registration case still pending ..
Basnet or Basnyat ??
TPS Re-registration
निगुरो थाहा छ ??
Nas and The Bokas: Coming to a Night Club near you
Toilet paper or water?
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
अमेरिकामा छोरा हराएको सूचना
ढ्याउ गर्दा दसैँको खसी गनाउच
Sajha Poll: Who is your favorite Nepali actress?
Problems of Nepalese students in US
nrn citizenship
TPS EAD auto extended to June 2025 or just TPS?
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
Nas and The Bokas: Coming to a Night Club near you
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters