oracle如何插入timestamp資料
SQL> select * from t_timestamp;
A
--------------------------------------------------------------------------------
14-11月-12 10.46.24.195000 上午
SQL> show parameter time
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
cursor_space_for_time boolean FALSE
ddl_lock_timeout integer 0
distributed_lock_timeout integer 60
log_checkpoint_timeout integer 1800
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
parallel_min_time_threshold string AUTO
resumable_timeout integer 0
timed_os_statistics integer 0
timed_statistics boolean TRUE
SQL> alter session set nls_time_format='yyyy-mm-dd hh24:mi:ss.ff';
alter session set nls_time_format='yyyy-mm-dd hh24:mi:ss.ff'
ORA-01821: 日期格式無法識別
A
--------------------------------------------------------------------------------
14-11月-12 10.46.24.195000 上午
SQL> show parameter time
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
cursor_space_for_time boolean FALSE
ddl_lock_timeout integer 0
distributed_lock_timeout integer 60
log_checkpoint_timeout integer 1800
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
parallel_min_time_threshold string AUTO
resumable_timeout integer 0
timed_os_statistics integer 0
timed_statistics boolean TRUE
SQL> alter session set nls_time_format='yyyy-mm-dd hh24:mi:ss.ff';
alter session set nls_time_format='yyyy-mm-dd hh24:mi:ss.ff'
ORA-01821: 日期格式無法識別
SQL> conn as sysdba
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as SYS
SQL> show parameter nls
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_calendar string
nls_comp string BINARY
nls_currency string
nls_date_format string
nls_date_language string
nls_dual_currency string
nls_iso_currency string
nls_language string AMERICAN
nls_length_semantics string BYTE
nls_nchar_conv_excp string FALSE
nls_numeric_characters string
nls_sort string
nls_territory string AMERICA
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as SYS
SQL> show parameter nls
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_calendar string
nls_comp string BINARY
nls_currency string
nls_date_format string
nls_date_language string
nls_dual_currency string
nls_iso_currency string
nls_language string AMERICAN
nls_length_semantics string BYTE
nls_nchar_conv_excp string FALSE
nls_numeric_characters string
nls_sort string
nls_territory string AMERICA
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
SQL> alter system set nls_date_format='yyyy-mm-dd' scope=spfile;
System altered
sql> shutdown immediate
sql>startup
sql>startup
SQL> show parameter nls
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_calendar string
nls_comp string BINARY
nls_currency string
nls_date_format string yyyy-mm-dd
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_calendar string
nls_comp string BINARY
nls_currency string
nls_date_format string yyyy-mm-dd
SQL> conn
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as scott
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as scott
SQL> alter session set nls_timestamp_format='yyyy-mm-dd hh24:mi:ss.ff';
Session altered
Session altered
SQL> select * from t_timestamp;
A
--------------------------------------------------------------------------------
2012-11-14 10:46:24.195000
SQL> insert into t_timestamp values('2012-12-01 09:21:13.1');
1 row inserted
SQL> select * from t_timestamp;
A
--------------------------------------------------------------------------------
2012-11-14 10:46:24.195000
2012-12-01 09:21:13.100000
小結;1,nls_timestamp_format與nls_date_format關聯,必須先配置後者
不然會報ORA-01821: 日期格式無法識別
2,timestamp資料可以用to_timestamp自定義格式插入資料,道理
和to_date一樣
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-749182/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- C#插入Oracle中Timestamp型別資料C#Oracle型別
- ORACLE TIMESTAMP資料型別Oracle資料型別
- oracle批量插入資料Oracle
- Oracle 插入大量資料Oracle
- 如何提取oracle timestamp列一個範圍的資料Oracle
- ORACLE資料庫中如何插入生僻字Oracle資料庫
- Oracle中的TIMESTAMP資料型別Oracle資料型別
- oracle 大資料量資料插入Oracle大資料
- oracle插入隨機資料Oracle隨機
- Oracle插入Blob資料的方法Oracle
- MySQL 如何實現資料插入MySql
- MySQL中如何批次插入資料MySql
- python如何將資料插入資料庫Python資料庫
- mybatis插入資料、批量插入資料MyBatis
- oracle資料庫插入行更快方法Oracle資料庫
- oracle資料型別date和timestamp的轉化Oracle資料型別
- Oracle TimestampOracle
- Oracle批量插入資料insert all into用法Oracle
- Oracle批次插入測試資料的方法Oracle
- oracle中date資料型別與timestamp資料型別的轉換Oracle資料型別
- oracle將表中date資料型別修改為timestamp資料型別Oracle資料型別
- 如何快速安全的插入千萬條資料
- mysql 資料型別TIMESTAMPMySQL 資料型別
- Sqlserver:timestamp資料型別SQLServer資料型別
- timestamp資料型別求差資料型別
- Oracle timestamp_to_scn and scn_to_timestampOracle
- oracle-資料庫- insert 插入語句Oracle資料庫
- 檔案插入 Oracle資料庫 Blob型別Oracle資料庫型別
- mybatis oracle資料庫批次插入資料,忽略主鍵重複MyBatisOracle資料庫
- ORACLE DATE和TIMESTAMP資料型別的比較(一) (轉)Oracle資料型別
- ORACLE DATE和TIMESTAMP資料型別的比較(二) (轉)Oracle資料型別
- mongodb 插入資料MongoDB
- MYSQL timestamp NOT NULL插入NULL的報錯問題MySqlNull
- 關於timestamp資料型別資料型別
- mongodb資料庫中插入資料MongoDB資料庫
- Oracle 11g 向表中大欄位插入資料Oracle
- 利用oracle job定時向某個表插入資料Oracle
- oracle 匿名儲存過程插入大量測試資料Oracle儲存過程