我有一个 CLOB 类型的“PHOTOIDS”列,其中有一个逗号分隔的数字列表。我需要查询其中包含一组“photoIds”的所有记录。查询 THE CLOB 列以获取数字列表的最佳方法是什么。
我正在寻找语义上相似的东西
SELECT * FROM TABLE_NAME WHERE PHOTOIDS IN (1,2,3)
I would suggest that you normalize your design and have a child table to hold the photoIds..then it would be efficient and easy
If you cant do that, then using a procedure/function or dynamic-sql would do the trick, let me know if you want more info on how to do it using one these two.
SELECT *
FROM table_name
WHERE dbms_lob.instr(photoids, '1') > 0
AND dbms_lob.instr(photoids, '2') > 0
AND dmbs_lob.instr(photoids, '3') > 0;
只要您想要搜索的数字列表相对有限,这就会起作用:)