Scott,
I always use cursors in SQL to return data.
I can not find the reference in the archives, but I *think* I recall a number of
posts a while ago where someone indicated the if you were using a cursor in
SQL you were doing something wrong.
I was just wondering what other method there was as I do not know of any other
than using SQL-CLI.
That was the only reason for that reference.
As I indicated, I was just curious as to how one could get get data into the
program without a cursor.
Thanks,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3
________________________________
From: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Thu, November 18, 2010 1:24:45 PM
Subject: Re: RPG SQL and Cursors
Hello Jeff,
I have seen it indicated in many posts in the past that if you are using
cursors
in SQL, you are doing something wrong.
Huh?! How do you read rows without a cursor?!! I wonder if you're
taking a comment out of context?
If I have only RPGLE and CL to work with and SQL-CLI is not an option, how
would
I select multiple rows for a set of conditions and return them in an ordered
condition using embedded SQL with a CURSOR?
Sorry -- are you asking how to do it _with_ a cursor? (This seems to
contradict your previous sentence, in which you said you shouldn't use a
cursor.)
Can you clarify what you're asking?
Also, you say CLI is not an option. CLI may be more complex than
embedded SQL (because there's no precompiler to do part of the work for
you) but why wouldn't it be an option? (CLI is part of the core OS,
it's always there...) Please understand that I'm *not* recommending CLI
at this time, merely pointing out that it's always an option. Embedded
SQL is usually an easier choice.
But to read multiple rows in an order with conditions, you will need to
use a cursor (in both embedded and CLI) and I don't understand why you
say a cursor is wrong.
And I'm not sure if you're asking how to use a cursor? Or what you're
asking?
As an Amazon Associate we earn from qualifying purchases.