|
Birgitta---
On a side note, why does this matter for performance?
-Tom Stieger
IT Manager
California Fine Wire
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Tuesday, May 29, 2012 10:38 PM
To: 'RPG programming on the IBM i / System i'
Subject: AW: Embedded SQL with Coalesce
To me too!This line looks suspicious to me:
and A.artxyr = 2011 || :RPTTXYR
For performance issues you should avoid concatenating those things in
the SQL statement, calculate the variable value in your RPG and use it
as
follows:
MyVar = '2011' + RPTTXYR;
Select ...
Where a.ARTXYR = :MyVar
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars."
(Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Scott Klement
Gesendet: Tuesday, 29.5 2012 23:58
An: RPG programming on the IBM i / System i
Cc: Dave Boettcher
Betreff: Re: Embedded SQL with Coalesce
Hi Dave,
This line looks suspicious to me:
and A.artxyr = 2011 || :RPTTXYR
Are you truly trying to concatenate a number (2011) to a variable? If so, SQL will have to implicitly do some casting to make it work, which might be where the issue is.
The other thing that comes to mind is the FETCH statement -- I'm
mainly suspicious of the FETCH because you say it works in iNav, which
implies the issue is something you wouldn't have done in iNav (such as
a fetch)
It's possible that SQL is implicitly casting between a numeric/character data type in the fetch... maybe because the receiver data type doesn't match the database data type. Worth checking into...
-SK
On 5/29/2012 4:49 PM, Dave Boettcher wrote:
Kurt, Good guess. I still receive the error either way.--
Jonathan , You're right it was defined as character. I had great
hopes for this one but still receive the error. I should only need
the coalesce on the Declare statement not the fetch, right?
Tom, the phones are signed numeric and so I tried the + signs. It
seems that a zero shouldn't need to have a sign but it was worth a
shot.
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
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.