× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I've used the following article several times as a reference: http://www.itjungle.com/fhg/fhg052009-story01.html
I've never had to do a select count prior to doing the fetch.
Mitch


On Monday, September 14, 2015 1:58 PM, "Koester, Michael" <mkoester@xxxxxxxxxxxxx> wrote:


Charles,

Would be nice if you could use SELECT INTO along with FETCH FIRST XX
ROWS...

After getting the count (select count(*) into :resultCount from...), and declaring and opening a cursor, I can successfully use

    exec sql
    fetch MyCursor for :resultCount rows
      into :ArrayDS;
                       
But there apparently are no shorter shortcuts.

Michael Koester

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles
Wilt
Sent: Monday, September 14, 2015 1:47 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Loading arrayDS from sql select into statement?

Always a good idea to fact check anything on the net...

The manual says: "The SELECT INTO statement produces a result table
consisting of at most one row, and assigns the values in that row to
variables."

SELECT INTO :MYDS is a commoning recommended solution.  But there's no
array there.

Would be nice if you could use SELECT INTO along with FETCH FIRST XX
ROWS...

Charles

On Mon, Sep 14, 2015 at 1:33 PM, Koester, Michael <mkoester@xxxxxxxxxxxxx>
wrote:

Thanks Alan.
So the people on this list that have suggested to others that they use
a "select into :arrayDS" have never actually tried that?
My faith has been shaken.

Michael Koester


--


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.