|
Given that you know the lower and upper limits then if the SQL statement said something like: select * from j4pp1 where key1 >= ('1') and key1 <= char(:count) Then the cursor wouldn't need to be closed every time.. Cheers, Stu -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James Rich Sent: Friday 23 July 2004 10:55 To: Midrange Systems Technical Discussion Subject: RE: SQL vs. traditional I/O? On Thu, 22 Jul 2004, Joe Pluta wrote: > c for x = 1 to count > c eval mykey = %char(count) > c/EXEC SQL declare c cursor for select * from j4pp1 where key1 = :mykey > c/END-EXEC > c/EXEC SQL open c > c/END-EXEC > c/EXEC SQL fetch from c into :j4pp1 > c/END-EXEC > c/EXEC SQL close c > c/END-EXEC > c enddo Can this be restructured in such a way that it doesn't required opening and closing the cursor for every iteration through the loop? That seems awful wasteful and could be responsible for a large amount of the performance difference. Maybe SQL is still slower, but it seems like this opening/closing of the cursor needs to be removed from the loop in order to make an appropriate comparison. If they can't be removed, this seems like another example of the shortcomings of the way SQL is used within RPG more than a problem with SQL itself. If you are not the intended recipient, please notify the sender by return email and then delete the message from your computer. The Skandia UK Group reserves the right to monitor e-mail communications through its networks. No contract may be concluded on behalf of the Skandia UK Group by email. Skandia Life Assurance (Holdings) Limited Skandia Life Assurance Company Limited Skandia MultiFUNDS Limited, Skandia Investment Management Limited. Registered Nos: 1606702, 1363932, 1680071, 4227837, England Registered Office: Skandia House, Portland Terrace, Southampton SO14 7EJ, United Kingdom Royal Skandia Life Assurance Limited Registered No : 24916 Isle of Man Registered Office: Skandia House, King Edward Road, Onchan, Isle of Man IM99 1NU, British Isles Skandia Life Assurance Company Limited, Skandia MultiFUNDS Limited, Skandia Investment Management Limited and Royal Skandia Life Assurance Limited are authorised and regulated by the Financial Services Authority for UK investment business. Internet: www.skandia.co.uk
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.