Link to home
Start Free TrialLog in
Avatar of RSchnabel
RSchnabelFlag for United States of America

asked on

DB2 delete one table constrained by another run from CL

I have a simple delete query with a subselect

Delete from Table1 T1 where F1 in (Select F2 from Table2 T2 where T1.F1 = T2.F2 and T2.F3 =  'constantvalue')

I have done this many times and interactively it works fine, but when I try to execute the sql from a CL with RUNSQLSTM SRCFILE(XX/YY) SRCMBF(ZZZZ) it fails to run with the following error:

SQL7008 Position 1 Table1 in XX not valid for operation

I know that uncorrelated sub-selects can cause issues when running from a CL but that is not the case here, any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Member_2_2484401
Member_2_2484401
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial