oracle中有无'在1个字符串中查找非数字'的函数
意思就是,在1个字符串中,能否判断出该字符串中含有非数字的字符
一种方法就是采用ORACLE 10G的正则表达式
select * from emp where REGEXP_LIKE(empno,’^[:punct:]|[0-9]+$’)
是判断有非数字的字符?还是要取出来?
SQL code:
Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
Connected as billing
---大于0代表是非法的数字,等于0代表是数字字符
SQL> select regexp_instr('121212adfazxczxc111111sdfasdsadf','[^[:digit:]]') from dual;
REGEXP_INSTR('121212ADFAZXCZXC
------------------------------
7
SQL> select regexp_instr('1111111111232323','[^[:digit:]]') from dual;
REGEXP_INSTR('1111111111232323
------------------------------
0
SQL> select regexp_instr('aaaaa1111111111232323','[^[:digit:]]') from dual;
REGEXP_INSTR('AAAAA11111111112
------------------------------
1
SQL>
我的ORACLE版本是8.1.7.0.1 的,好象用不了
只要判断该字符串没有非数字字符就为真,否则为假
写个函数
使用to_number转换,如遇异常则有非数字,没有则没有
用decode函数,不过:不知道ORACLE版本是8.1.7.0.1中是否有这个函数!
{{
相关问答:
各位oracle高手,请教一下为什么oracle 10g在安装到百分之八十五的时候就报错不能继续安装?
内存多大? 重新下个数据库安装试试..
引用
各位oracle高手,请教一下为什么oracle 10g在安装到百分之八十五的时 ......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
我是在toad中输入下段sql
declare
TYPE test_rec IS record(
code varchar(10),
name varchar(30)
);
v_book test_rec;
......
我有两个表(A表和B表),机构完全相同:A 表建立触发器
当insert into A(id,name) values('1','zhangsan'); 我只想将name=zhangsan的时候将insert语句插入到B表中而A表不执行操作这个触发器应该怎么实现呢?
如: ......
SQL code:
declare
v_deptno number(2);
v_dname varchar2(14);
begin
dbms_output.put_line('请输入部门号和部门名:');
v_deptno:=&deptno;
v_dname:='&dname';
insert into dept01(deptno,dnam ......