# index disabled when using variable

**URL:** <https://forums.percona.com/t/index-disabled-when-using-variable/4547>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [November 25, 2015, 10:46am UTC](https://forums.percona.com/t/index-disabled-when-using-variable/4547 "2015-11-25T10:46:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaoxiaolin](https://avatars.discourse-cdn.com/v4/letter/x/ce7236/32.png) [@xiaoxiaolin](https://forums.percona.com/u/xiaoxiaolin)\
**Post date:** [November 25, 2015, 10:46am UTC](https://forums.percona.com/t/index-disabled-when-using-variable/4547/1 "2015-11-25T10:46:04Z")

</div>

Hi all 🙂  
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
