parameterized update

UDA
Enthusiast

parameterized update

Hey, I am running the explain(F6) on the below update command and am getting error 3939: There is a mismatch between the number of parameters specified and the number of parameters required.

I cannot see the error but I am new to teradata and have not seen this error in other db architectures.
I just want to p****(explain) this correctly for the moment. Please advise.

UPDATE "DEV_DATA_T"."MISRE_Threshold"
SET "ThresholdType" = ?, "ThresholdValue" = ?, "Threshold_Flag" = ?, "Actual" = ?, "Fail"
= ?, "Category" = ?, "ID1" = ?
WHERE (("ThresholdType" = ?) AND ("ThresholdValue" = ?)
AND ((? = 1 AND "Threshold_Flag" IS NULL) OR ("Threshold_Flag" = ?))
AND ("Actual" = ?) AND ("Fail" = ?)
AND ((? = 1 AND "Category" IS NULL) OR ("Category" = ?))
AND ((? = 1 AND "ID1" IS NULL) OR ("ID1" = ?)))
1 REPLY
Enthusiast

Re: parameterized update

Use this syntax for your Update in SQL Assistant:

EXPLAIN
USING ThrType (CHAR(2)),
ThrValue (DECIMAL(3)),
<<< finish defining a variable with the correct data type for each "?" in the update statement >>>
UPDATE "DEV_DATA_T"."MISRE_Threshold"
SET "ThresholdType" = ?, "ThresholdValue" = ?, "Threshold_Flag" = ?, "Actual" = ?, "Fail"
= ?, "Category" = ?, "ID1" = ?
WHERE (("ThresholdType" = ?) AND ("ThresholdValue" = ?)
AND ((? = 1 AND "Threshold_Flag" IS NULL) OR ("Threshold_Flag" = ?))
AND ("Actual" = ?) AND ("Fail" = ?)
AND ((? = 1 AND "Category" IS NULL) OR ("Category" = ?))
AND ((? = 1 AND "ID1" IS NULL) OR ("ID1" = ?)))

You have to define a variable in the USING clause for each "?" that you use. Then, you will be able to do the explain.