Interesting workaround.
The more general answer is to use a cursor (even if the SELECT returns only one row):
SET sql_stmt = 'SELECT COUNT(*) FROM DM_JNJCHF_TEST WHERE PT_ID = ?' ;
DECLARE C1 CURSOR FOR S1;
PREPARE S1 FROM sql_stmt;
OPEN C1 USING t_random_num;
FETCH C1 INTO t_dups;
CLOSE C1;
↧