DXP
DXP

Reputation: 1

AS400 SQL Dynamic Delete issue

Some background... I have 20 + Files.
I read these file names from a prebuilt table building a subfile screen. I select 1 file then build another screen with the contents of file selected. I then select the record I want to delete, so far so good...

eval      MySQL  = stat3 + %trimr(scrwcrd) + STAT3B   

my SQL Statement which reads in debug

MySQL =  DELETE FROM FILESEL WHERE K00001 = ? with NC 

PREPARE STAT3 from :MYSQL

EXECUTE STAT3 using :PROD   

where :prod is the variable supplied from Screen selection

My sqlcod ends up at 100 with sqlstt = 2000 after the EXECUTE indicating ROW not found for Delete. Now for a fact this is not the case. I see the record on the file selected and I see the value of PROD using debug any ideas...

Upvotes: 0

Views: 590

Answers (1)

James Allman
James Allman

Reputation: 41188

What datatypes and length are the K00001 field and :PROD host variable?

Equality could be an issue. If they are character fields you may need to TRIM/%TRIM the values in order to match.

Upvotes: 1

Related Questions