index disabled when using variable

Hi all :slight_smile:
When using the stored procedure, I passed the cursor to the SQL and found that the SQL was unable to use the index.

You can reproduce this when using session variables,For example

Correct use index:
1.SELECT count(1) FROM T_E4S_BU_ECA_FAIL_UNCONT where FAIL_NO=‘H2923LFR001690’ ;

Index disabled,full table scan:
2.set @FAIL_NO=‘H2923LFR001690’ ;
SELECT count(1) FROM T_E4S_BU_ECA_FAIL_UNCONT where FAIL_NO=@FAIL_NO ;

How can i do? thx