开发过程中遇到个需求,用户要提取的数据列中不包含 YF.ZF.JD的字符串, 方法1:select * from table where order_no not like '%YF%' and order_no not like '%ZF' and order_no not like '%JD%' 感 觉方法1有点笨,想到REGEXP_LIKE 可以实现包含多个,在前面加上 not 就可以实现不包含功能,方法如下: 方法2:select * from table where not reg
declare v_cnt number; begin select count(*) into v_cnt from dba_tab_columns where table_name='T_IDC_FUNCTION' and column_name='TEST1'; then execute immediate 'alter table t_idc_function add test1 varchar(40)'; null;--IF语句里面必须至少一行SQL语句,所以当没有任何语句的时候,可以
方法1: --Oracle 根据字段值查询其所在的表.字段 DECLARE CURSOR cur_query IS SELECT table_name, column_name, data_type FROM user_tab_columns; a NUMBER; sql_hard VARCHAR2(); vv NUMBER; BEGIN FOR rec1 IN cur_query LOOP a:=; IF rec1.data_type ='VARCHAR2' OR rec1.data_type
判断字段是否为null select * from table where c is null select * from table where c is not null 判断字段是否为空 select * from table where c='' select * from talbe where c<>''
--SQL 判断字段值是否有中文 create function fun_getCN(@str nvarchar(4000)) returns nvarchar(4000) as begin declare @word nchar(1),@CN nvarchar(4000) set @CN='' while len(@str)>0 begin set @word=left(@str,1) i
原文地址:SQL 判断字段中指定字符出现的次数 原理:将指定字符转换为空,原长度减去转换后的长度就是指定字符的次数. 在做数据处理时遇到一个SQL操作的问题就是有一列关键词字段,字段中包含各种乱七八糟的字符,其中有一个双引号“ 是关键词中不需要的,所以需要去掉,而一般只有带两个”的才需要去除,所以首先得先找到含有双引号的且双引号出现两次的值,然后删除.这里提取指定符串在 字段中的出现次数SQL为: select * from google_keyword where len