×

Good News Everybody!

The new search engine is LIVE!

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




Hi

What is the value of SQLCOD? The value you gave us looks like SQL state.

Or even better, what is the message in your joblog? I believe the SQLCOD is -305, and the message is SQL0305 - in that message you should see which host variable needs the indicator variable. So please find that SQL0305 message and put it here.

Regards
Vern

On 6/12/2024 5:43 AM, gio.cot via RPG400-L wrote:
Hi all

In a RPG program execute SQL : below what i do:

when i run the program i receive SQL Error 22002 An indicator variable is
required.


Where am i wrong ? how can solve this error ?




Dcl-Ds MainDs;

xAnnoc Char(2);

xMesec Char(2);

xImpo Packed(30:9);

End-Ds;



mainStatement = ' SELECT '

+ ' Substr(xdtr, 1, 2), '

+ ' Substr(xdtr, 3, 2), '

+ ' SUM((xqty * (prc - xsc) ) * §CSEG ) AS impo '

+ ' FROM myfile m '

+ ' left join myile 2 t '

+ ' on xcax = §cax '

+ ' Group by substr(xdtr, 1, 2) , substr(xdtr, 3, 2)'

+ ' order by substr(xdtr, 1, 2) , substr(xdtr, 3,2)';


ExEC SQL

FETCH NEXT FROM mainCursor INTO :MAINDS ;





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-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.