电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

to


发布日期:2019/9/22
 

如to_date函数中时间格式与当前时间格式相符可以不在函数中指定格式而完成隐式转换

select>BYS@bys>select sysdate from dual;

SYSDATE

// ::

select>BYS@bys>select to_date(// ::) from dual;

TO_DATE(//

// ::

当前日期格式下下面几种格式都可以隐式转换应该是日期间连接符使用特殊字符都没问题但是月与日小时分钟要能对上

不能使用&&表示传入变量不能使用数字或字母字符

select>BYS@bys>select to_date( ::) from dual;

TO_DATE(

// ::

select>BYS@bys>select to_date(# :+) from dual;

TO_DATE(#

// ::

select>BYS@bys>select to_date(a :+) from dual;

select to_date(a :+) from dual

*

ERROR at line :

ORA: literal does not match format string

select>BYS@bys>select to_date( :+) from dual;

select to_date( :+) from dual

*

ERROR at line :

ORA: literal does not match format string

select>BYS@bys>select to_date(@ :+) from dual;

TO_DATE(@

// ::

如果to_date函数中格式字段长度与系统的不符的几种情况

把最后的表示秒的字符省略可以正常显示

select>BYS@bys>select to_date(@ :) from dual;

TO_DATE(@

// ::

把最后的表示秒的字符及表示具体几号的字符省略报错

select>BYS@bys>select to_date(@ :) from dual;

select to_date(@ :) from dual

*

ERROR at line :

ORA: a nonnumeric character was found where a numeric was expected

只给出分和秒未给出代替

select>BYS@bys>select to_date(@ ) from dual;

TO_DATE(@

// ::

只给出日期的字段秒用来代替

select>BYS@bys>select to_date(@ ) from dual;

TO_DATE(@

// ::

只给出年未给几号报错

select>BYS@bys>select to_date( ) from dual;

select to_date( ) from dual

*

ERROR at line :

ORA: input value not long enough for date format

select>BYS@bys>select to_date($ ) from dual;

TO_DATE($

// ::

to_date函数中时间格式与当前时间格式不符需要在函数中显式指定时间格式来完成转换

select>BYS@bys>select sysdate from dual;

SYSDATE

OCT

注意列宽以免不能显示全

col>BYS@bys>col aa for a

select>BYS@bys>select to_date( ::yyyymmdd hh:mi:ss) aa from dual;

AA

FEB

不指定格式会报错

select>BYS@bys>select to_date( ::) from dual;

select to_date( ::) from dual

*

ERROR at line :

ORA: literal does not match format string

上一篇:将表空间升级为本地托管模式

下一篇:技术笔记-Forms的错误控制