plsql- | oracle sql跳脫字元
定義跳脫字元,可以解決需要特殊字元變為一般的字元。利用escape可以指定我們自定義的跳脫字元。例如下面的兩段SQL,出來結果是一樣的。下面第一段SQL,定義的字元是「」,所以「_」就變成一個文字,而不是任意字元下面第二段SQL,定義的字元是「-」,所以「_」就變成一個文字,而不是任意字元selectsegment1,descriptionfrommtl_system_items_b whereorganization_id=111 and descriptionlike%0\_%escape;selectsegment1,descriptionfrommtl_system_items_b whereorganization_id=111 and descriptionlike%0-_%escape-;結果: ...
定義跳脫字元,可以解決需要特殊字元變為一般的字元。利用escape可以指定我們自定義的跳脫字元。例如下面的兩段SQL,出來結果是一樣的。下面第一段SQL,定義的字元是「」,所以「_」就變成一個文字,而不是任意字元下面第二段SQL,定義的字元是「-」,所以「_」就變成一個文字,而不是任意字元
select segment1,description from mtl_system_items_b where organization_id=111 and description like %0\_% escape ; select segment1,description from mtl_system_items_b where organization_id=111 and description like %0-_% escape -; 結果: segment1 description ---------- ---------------------------- a01-001 鍵盤,型號A0_001 a01-002 鍵盤,型號A0_002