Oracle PL/SQL:如何过滤SELECT中的空白?

Oracle PL/SQL:如何过滤SELECT中的空白?,select,plsql,whitespace,Select,Plsql,Whitespace,我有一个表mytable,它有一列ngram,这是一个VARCHAR2。我只想选择那些ngram不包含任何空格(制表符、空格、下线等)的行。我应该用什么替换下面的 SELECT ngram FROM mytable WHERE <COND>; 从mytable中选择ngram,其中; 谢谢 您可以使用regexp_instr(或类似regexp_的函数,或其他regexp函数),请参见示例 where regexp_instr(ngram, '[ '|| CHR(10) |

我有一个表
mytable
,它有一列
ngram
,这是一个
VARCHAR2
。我只想选择那些
ngram
不包含任何空格(制表符、空格、下线等)的行。我应该用什么替换下面的

SELECT ngram FROM mytable WHERE <COND>;
从mytable中选择ngram,其中;

谢谢

您可以使用regexp_instr(或类似regexp_的函数,或其他regexp函数),请参见示例

  where  regexp_instr(ngram, '[ '|| CHR(10) || CHR(13) || CHR(9) ||']') = 0
在此处管理空白
'['

  • chr(10)=线路馈电
  • chr(13)=回车
  • chr(9)=制表符

您可以使用regexp\u instr(或类似regexp\u的,或其他regexp函数),请参见示例

  where  regexp_instr(ngram, '[ '|| CHR(10) || CHR(13) || CHR(9) ||']') = 0
在此处管理空白
'['

  • chr(10)=线路馈电
  • chr(13)=回车
  • chr(9)=制表符

您可以使用regexp\u instr(或类似regexp\u的,或其他regexp函数),请参见示例

  where  regexp_instr(ngram, '[ '|| CHR(10) || CHR(13) || CHR(9) ||']') = 0
在此处管理空白
'['

  • chr(10)=线路馈电
  • chr(13)=回车
  • chr(9)=制表符

您可以使用regexp\u instr(或类似regexp\u的,或其他regexp函数),请参见示例

  where  regexp_instr(ngram, '[ '|| CHR(10) || CHR(13) || CHR(9) ||']') = 0
在此处管理空白
'['

  • chr(10)=线路馈电
  • chr(13)=回车
  • chr(9)=制表符

您可以使用CHRINSTR函数对要筛选的字符进行ASCII编码,例如,对于特殊字符,where子句可以如下所示:

 INSTR(ngram,CHR(the ASCI CODE of special  char))=0
或者条件可以是这样的:

where 
and ngram not like '%'||CHR(0)||'%' -- for null
.
.
.
and ngram not like '%'||CHR(31)||'%' -- for unit separator
and ngram not like '%'||CHR(127)||'%'-- for delete

您可以在此处获取所有代码,例如,对于特殊字符,where子句可以如下所示:

 INSTR(ngram,CHR(the ASCI CODE of special  char))=0
或者条件可以是这样的:

where 
and ngram not like '%'||CHR(0)||'%' -- for null
.
.
.
and ngram not like '%'||CHR(31)||'%' -- for unit separator
and ngram not like '%'||CHR(127)||'%'-- for delete

您可以在此处获取所有代码,例如,对于特殊字符,where子句可以如下所示:

 INSTR(ngram,CHR(the ASCI CODE of special  char))=0
或者条件可以是这样的:

where 
and ngram not like '%'||CHR(0)||'%' -- for null
.
.
.
and ngram not like '%'||CHR(31)||'%' -- for unit separator
and ngram not like '%'||CHR(127)||'%'-- for delete

您可以在此处获取所有代码,例如,对于特殊字符,where子句可以如下所示:

 INSTR(ngram,CHR(the ASCI CODE of special  char))=0
或者条件可以是这样的:

where 
and ngram not like '%'||CHR(0)||'%' -- for null
.
.
.
and ngram not like '%'||CHR(31)||'%' -- for unit separator
and ngram not like '%'||CHR(127)||'%'-- for delete

在这里,您可以获得所有代码

这应该与ngram匹配,在ngram中,它不包含任何空格字符,方法是使用所有空格字符的\s速记法。我仅通过在VARCHAR2列的字符串中插入制表符进行测试,然后将其排除在外:

where regexp_instr(ngram, '\s') = 0;

通过对所有空白字符使用\s速记,这应该与不包含空白字符的ngram匹配。我只通过在VARCHAR2列的字符串中插入制表符进行了测试,然后将其排除在外:

where regexp_instr(ngram, '\s') = 0;

通过对所有空白字符使用\s速记,这应该与不包含空白字符的ngram匹配。我只通过在VARCHAR2列的字符串中插入制表符进行了测试,然后将其排除在外:

where regexp_instr(ngram, '\s') = 0;

通过对所有空白字符使用\s速记,这应该与不包含空白字符的ngram匹配。我只通过在VARCHAR2列的字符串中插入制表符进行了测试,然后将其排除在外:

where regexp_instr(ngram, '\s') = 0;

…对于通过空白条件的每个特殊字符多次…对于通过空白条件的每个特殊字符多次…对于通过空白条件的每个特殊字符多次…对于通过空白条件的每个特殊字符多次…对于通过空白条件的每个特殊字符多次总工程师。