In Oracle 11g, how can I detect a null character (
select case when regexp_like (chr(0), '\0') then 1 else 0 end from dual;
select * from my_table where NOT regexp_like (my_column, '^[\s\0]+$');
It does not seem to be possible to identify just the null character within an Oracle regular expression. Oracle's Regular Expression reference documentation indicates what regular expressions are supported, and makes no mention of supporting a metacharacter or expression that would identify a null character (although a subset of other standard metacharacters are supported). My tests have confirmed this, as have some follow-up tests executed by others in this thread.
Although the answer to this question is that it's not possible, some of the other answers may help satisfy others' use cases. In particular, please see this answer suggesting the use of the
[[:cntrl:]] class. This will identify null characters in a regular expression, although it will also match on other characters in the class.