ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Slightly Complicated Statement works one place not another

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Slightly Complicated Statement works one place not another

    So, I have the following SQL statement.
    PHP Code:
     EXEC SQL
         INSERT INTO ENTPART 
    (IRS#,ITEM#,OKAYTOUSE,HTS#1,HTS#2,HTS#3,
         
    DESC,UNT$,WGTLN,PCLS,PRDCD,COMM1,COMM2,COMM3,COMM4,COMM5,
         
    COMM6SELECT DISTINCT (SELECT IRS#CS FROM CUSTHEAD
         
    where CUS#CS = $S_CUSTF and B287CS = $S_OFFC
         
    FETCH FIRST ROW ONLY),
         
    ITEM#,OKAYTOUSE,HTS#1,HTS#2,HTS#3,
         
    DESC,UNT$,WGTLN,PCLS,PRDCD,COMM1,COMM2,COMM3,COMM4,COMM5,
         
    COMM6 from ENTPART join CUSTHEAD on IRS#=IRS#CS
         
    where ITEM#=:ITEM# and HTS#1=:HTS#1 and DESC=ESCR
         
    and CUS#CS=:CUSNUM and B287CS = :OFFC
         
    EXCEPT
         SELECT IRS
    #,ITEM#,OKAYTOUSE,HTS#1,HTS#2,HTS#3,DESC,UNT$,
         
    WGTLN,PCLS,PRDCD,COMM1,COMM2,COMM3,COMM4,COMM5,COMM6
         from ENTPART join CUSTHEAD on IRS
    #=IRS#CS
         
    where CUS#CS = $S_CUSTT and B287CS = $S_OFFC; 

    I also have set in the initialization for the SQLRPGLE program this is in Exec SQL set option commit = *none;

    SQLCODE is 0 however the copy does not occur in the program. If I use the same statement within STRSQL substituting the variable names with the literals that they hold, it works just fine.

    Any ideas?

    Thanks
Working...
X