0

I want to use unhex function for each item in the string seperated by comma. In this string this binary id as string sent by front end.

select * from table where id in
('5534B753765411E6B3FA0021004B111C,1668309A6E6F11E6B405F819928F1AD1,4FE75C954EEB11E6BB970F782D79D6C8')

I want to use this like

select * from table where id in (unhex('5534B753765411E6B3FA0021004B111C'),unhex('1668309A6E6F11E6B405F819928F1AD1'),unhex('4FE75C954EEB11E6BB970F782D79D6C8'))
1

2 Answers 2

1

IN's also support SELECT statements, so you could try using that functionality like so:

SELECT *
FROM table WHERE id IN
(SELECT UNHEX('5534B753765411E6B3FA0021004B111C')
UNION ALL
UNHEX('1668309A6E6F11E6B405F819928F1AD1')
UNION ALL
UNHEX('4FE75C954EEB11E6BB970F782D79D6C8'));
Sign up to request clarification or add additional context in comments.

3 Comments

code is not working. actually I have to call this inside stored procedure and all above string values will be inside parameter.
It's no fault of pachonk that this example is not working, it's yours for not disclosing full information.
If this isn't working, please provide the proper information in the question.
0
select * from table where 
     FIND_IN_SET(id,'5534B753765411E6B3FA0021004B111C,
     1668309A6E6F11E6B405F819928F1AD1,4FE75C954EEB11E6BB970F782D79D6C8');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.