WHERE IN condition not accepting String value

前端 未结 4 1805
耶瑟儿~
耶瑟儿~ 2020-11-28 17:15

I am dynamically constructing a string with name user_data in PL/Sql procedure by appending USERNAMEs, single quotes(\') and commas(,) of the form

4条回答
  •  猫巷女王i
    2020-11-28 17:32

    Your select statement

    SELECT * FROM table_name WHERE USERNAME IN (user_data)

    will be treated as

    SELECT * FROM table_name WHERE USERNAME = 'abc123','xyz456','pqr789'

    which is not correct.

    One alternative is

    SELECT * FROM table_name WHERE INSTR(user_data, USERNAME) > 0

提交回复
热议问题