×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Eric,

I'm thinking it may be something else because the iSeries does support
the use of a substr in the "Order by..." clause, I've used this a number
of times before, i.e. "order by '    ' || ltrim(a.yaoemp)" and "order by
substr(rtrim(excmd), 1, 20)" both work on our V5R3M0.

Douglas Belcher
KV Pharmaceutical
St Louis, MO
Opinions expressed are not necessarily those of my employer


-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx]
On Behalf Of DeLong, Eric
Sent: Tuesday, February 20, 2007 3:59 PM
To: Websphere Development Studio Client for iSeries
Subject: Re: [WDSCI-L] How Come

Hmm, your order by uses substr....  I'd probably change this to ORDER BY
1, which refers to the first column in the result set....  I know that
order by works with ordinal values.....  I didn't think you could do
expressions in the order by clause.....

-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx
[mailto:wdsci-l-bounces@xxxxxxxxxxxx]On Behalf Of Bill Barnes
Sent: Tuesday, February 20, 2007 11:48 AM
To: wdsci-l@xxxxxxxxxxxx
Subject: [WDSCI-L] How Come




P Decl_Saexpom    B

      /FREE

       EXEC SQL

        Declare SAEXPOM

        Cursor for

         SELECT SUBSTR(SAEXPO,1,4) AS STORE, 

                SUBSTR(SAEXPO,5,8) AS DATE, 

                SUBSTR(SAEXPO,13,4) AS CODE, 

                SUBSTR(SAEXPO,15,2) AS Codesfx,

                SUBSTR(SAEXPO,17,12) AS AMOUNT

         FROM SAEXPOM

         WHERE SUBSTR(SAEXPO,13,4)
IN('1250','1260','1450','1460','2050','2060','2450','2460')

           AND SUBSTR(SAEXPO,1,4) >= ' 100'

SQL0104 Token SUBSTR was not valid. Valid tokens: ) ,

         ORDER BY SUBSTR(SAEXPO,1,4);

 

 

The above is strange and happens fairly regularly.  The statement is not
in error and executes just fine.  How come?

Thanks

Bill Barnes

The above works if I change it to fixed form.  Obviously another RPG/SQL
problem.  Is it just me or is IBM having a lot of issues with embedded
SQL and they have spilled over into RSE?

--
This is the Websphere Development Studio Client for iSeries  (WDSCI-L)
mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/wdsci-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2026 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.