Text string gets SQL0406 via AS/400 RUNSQLSTM but works interactively

Tags:
AS/400
iSeries
SQL
I am doing an insert into a table and it works perfectly when run interactively on the iSeries but gets "SQL0406 229 Position 1 Conversion error on assignment to column BUDSPERSON". The field is Character, length 35.
 The query is: insert into
slsbudter (
SELECT ALLNUMS.BU, ALLNUMS.BUSUNIT, ALLNUMS.PL, ALLNUMS.PRODLINE,
ALLNUMS.MAINACCT, ALLNUMS.CUSTOMER, ALLNUMS.MO, ALLNUMS.YR,
ALLNUMS.BUDE, ALLNUMS.BUDS, ALLNUMS.BUDM, ALLNUMS.SLSE,
ALLNUMS.SLSS, ALLNUMS.SLSM,

case when (allnums.mainacct=42 and hldln is not null) then left(trim(hldfn)||' '||trim(hldln)|| ' ',35) else LEFT(TRIM(FIRSTNAME)||' '||TRIM(LASTNAME)|| ' ',35) end

FROM allnums left join DMHOLDACTS on HLDBU=allnums.bu left join terrtbl on left(allnums.bu,1)=terrtbl.bu AND allnums.mainacct= terrtbl.cmcust );
I separated out the case statement that builds the field properly in interactive (strsql) mode, but fails with RUNSQLSTM.
Anyone else have error like this and find a fix?  It's very frustrating.


Software/Hardware used:
iSeries V6R4
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Is that the full statement? I do not see BUDSPERSON referenced anywhere? How were the tables created, via DDS or CREATE TABLE?
    132,950 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: