This works for me
Exec SQL Select 1 Into :Needtocalcstatetax
where Stcmpy = :ParmCompany and
Ststate = :ParmState
fetch first row only;
Programmer/Analyst, Direct Response
"If you're going through Hell, keep going" - Winston Churchill
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dave
Sent: Tuesday, April 24, 2012 10:48 AM
To: RPG programming on the IBM i / System i
Subject: sqlrpgle question
I want to set the value of an indicator to *on if I find at least one record matching my search criteria and *off otherwise.
What's the best way?
indicator = *off;
Select '1' into : indicator
where ....err.. what goes here? what if there are many rows returned?
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,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l
Disclaimer: This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.