好象不行 因为我用 insert into aaa(thedate,aaa) values(sysdate,'sjfal;');结果是2004-8-6 18 'sjfal 只能显示到小时
那你就把sysdate的格式设置以下 alter session set nls_date_formate='yyyy-mm-dd hh:mm:ss'
SQL>alter session set nls_date_formate='yyyy-mm-dd hh:mm:ss'; 结果是: alter session set nls_date_formate='yyyy-mm-dd hh:mm:ss'ORA-00922: missing or invalid option 为什么?
alter session set nls_date_format='yyyy-mm-dd hh:mm:ss'
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'
insert into aaa(thedate,aaa) values(to_date('2004-08-06 19:21:21','yyyy-mm-dd hh24:mi:ss'),'sjfal;'); 就可以了
不管当前的格式是什么,都可以使用转换的方式来实现> insert into table values(...,to_date('2004-0801 18:08:08','yyyy-mm-dd hh24:mi:ss',...)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual, 来实现日期格式的转换.
因为我用
insert into aaa(thedate,aaa)
values(sysdate,'sjfal;');结果是2004-8-6 18 'sjfal
只能显示到小时
alter session set nls_date_formate='yyyy-mm-dd hh:mm:ss'
结果是:
alter session set nls_date_formate='yyyy-mm-dd hh:mm:ss'ORA-00922: missing or invalid option
为什么?
values(to_date('2004-08-06 19:21:21','yyyy-mm-dd hh24:mi:ss'),'sjfal;');
就可以了
insert into table values(...,to_date('2004-0801 18:08:08','yyyy-mm-dd hh24:mi:ss',...)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual,
来实现日期格式的转换.