oracle 函数使用

来源:互联网 发布:情趣内衣淘宝 编辑:程序博客网 时间:2024/06/10 14:51

oracle :

decode函数

oracle decode函数使用方法



时间函数:

字符串转时间类型:

select to_date('2017-01-01','yyyy-mm-dd') from dual

时间类型格式化:

select TO_char(sysdate, 'yyyy-mm-dd')  from dual


oracle判断字段类型(数值型或者字符型):

1、创建一个isNumber函数

 create or replace function isNumber(p in varchar2)
return number
is
result number;
begin
result := to_number(p);
return 1;
exception
when VALUE_ERROR then return 0;
end;
注:此函数仅返回1/0;
2、使用isNumber返回值 ,例如
case isNumber(字段) when 1 then 是数值执行的操作 when 0 then 字符执行的操作;




原创粉丝点击