ORA-30078報錯的兩種解決方案
最近在嘗試建立分割槽表時遇到了ORA-30078報錯,提示“ORA-30078: 分割槽界限必須是 TIME/TIMESTAMP WITH TIME ZONE 文字”,很納悶兒為什麼會報錯。
首先我建立一個測試表hoegh1,其中包含一個date型別的時間欄位,並以該欄位做範圍分割槽,建立成功;
緊接著,嘗試建立測試表hoegh2,其中包含一個timestamp型別的時間欄位,並以該欄位做範圍分割槽,建立失敗,遇到了ORA-30078報錯。
過程如下:
點選(此處)摺疊或開啟
鑑於timestamp型別的時間精度比date型別的要高,因此不能修改列的型別。那怎麼辦呢?在這兒列出兩種解決方案。
二、PARTITION value 型別更改為timestamp'2015-06-01 00:00:00.000000'
雖然問題得到了順利解決,但是為什麼會報錯還是沒弄明白,如果有了解原理的朋友還望不吝賜教。
~~~~~~~ the end~~~~~~~~~
hoegh
2016.07.12
首先我建立一個測試表hoegh1,其中包含一個date型別的時間欄位,並以該欄位做範圍分割槽,建立成功;
緊接著,嘗試建立測試表hoegh2,其中包含一個timestamp型別的時間欄位,並以該欄位做範圍分割槽,建立失敗,遇到了ORA-30078報錯。
過程如下:
點選(此處)摺疊或開啟
-
SQL>
-
SQL> select * from v$version;
-
-
BANNER
-
----------------------------------------------------------------
-
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
-
PL/SQL Release 10.2.0.4.0 - Production
-
CORE 10.2.0.4.0 Production
-
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
-
NLSRTL Version 10.2.0.4.0 - Production
-
-
SQL>
-
SQL>
-
SQL> create table hoegh1
-
2 (
-
3 id NUMBER,
-
4 time date
-
5 )
-
6 partition by range(time)
-
7 (
-
8 partition p_201505 values less than(to_date('20150601','yyyymmdd')),
-
9 partition p_201506 values less than(to_date('20150701','yyyymmdd')),
-
10 partition p_201507 values less than(to_date('20150801','yyyymmdd')),
-
11 partition p_201508 values less than(to_date('20150901','yyyymmdd')),
-
12 partition p_201509 values less than(to_date('20151001','yyyymmdd')),
-
13 partition p_201510 values less than(to_date('20151101','yyyymmdd')),
-
14 partition p_201511 values less than(to_date('20151201','yyyymmdd')),
-
15 partition p_201512 values less than(to_date('20160101','yyyymmdd')),
-
16 partition p_201601 values less than(to_date('20160201','yyyymmdd')),
-
17 partition p_201602 values less than(to_date('20160301','yyyymmdd')),
-
18 partition p_201603 values less than(to_date('20160401','yyyymmdd')),
-
19 partition p_201604 values less than(to_date('20160501','yyyymmdd')),
-
20 partition p_201605 values less than(to_date('20160601','yyyymmdd')),
-
21 partition p_201606 values less than(to_date('20160701','yyyymmdd')),
-
22 partition p_201607 values less than(to_date('20160801','yyyymmdd'))
-
23 );
-
-
表已建立。
-
-
SQL>
-
SQL>
-
SQL> create table hoegh2
-
2 (
-
3 id NUMBER,
-
4 TIMESTAMP TIMESTAMP(6)
-
5 )
-
6 partition by range(TIMESTAMP)
-
7 (
-
8 partition p_201505 values less than(to_timestamp('20150601','yyyymmdd')),
-
9 partition p_201506 values less than(to_timestamp('20150701','yyyymmdd')),
-
10 partition p_201507 values less than(to_timestamp('20150801','yyyymmdd')),
-
11 partition p_201508 values less than(to_timestamp('20150901','yyyymmdd')),
-
12 partition p_201509 values less than(to_timestamp('20151001','yyyymmdd')),
-
13 partition p_201510 values less than(to_timestamp('20151101','yyyymmdd')),
-
14 partition p_201511 values less than(to_timestamp('20151201','yyyymmdd')),
-
15 partition p_201512 values less than(to_timestamp('20160101','yyyymmdd')),
-
16 partition p_201601 values less than(to_timestamp('20160201','yyyymmdd')),
-
17 partition p_201602 values less than(to_timestamp('20160301','yyyymmdd')),
-
18 partition p_201603 values less than(to_timestamp('20160401','yyyymmdd')),
-
19 partition p_201604 values less than(to_timestamp('20160501','yyyymmdd')),
-
20 partition p_201605 values less than(to_timestamp('20160601','yyyymmdd')),
-
21 partition p_201606 values less than(to_timestamp('20160701','yyyymmdd')),
-
22 partition p_201607 values less than(to_timestamp('20160801','yyyymmdd'))
-
23 );
-
partition p_201505 values less than(to_timestamp('20150601','yyyymmdd')),
-
*
-
第 8 行出現錯誤:
-
ORA-30078: 分割槽界限必須是 TIME/TIMESTAMP WITH TIME ZONE 文字
-
-
- SQL>
一、PARTITION value 型別更改為to_date('20150601','yyyymmdd')
點選(此處)摺疊或開啟-
SQL>
-
SQL> create table hoegh2
-
2 (
-
3 id NUMBER,
-
4 TIMESTAMP TIMESTAMP(6)
-
5 )
-
6 partition by range(TIMESTAMP)
-
7 (
-
8 partition p_201505 values less than(to_date('20150601','yyyymmdd')),
-
9 partition p_201506 values less than(to_date('20150701','yyyymmdd')),
-
10 partition p_201507 values less than(to_date('20150801','yyyymmdd')),
-
11 partition p_201508 values less than(to_date('20150901','yyyymmdd')),
-
12 partition p_201509 values less than(to_date('20151001','yyyymmdd')),
-
13 partition p_201510 values less than(to_date('20151101','yyyymmdd')),
-
14 partition p_201511 values less than(to_date('20151201','yyyymmdd')),
-
15 partition p_201512 values less than(to_date('20160101','yyyymmdd')),
-
16 partition p_201601 values less than(to_date('20160201','yyyymmdd')),
-
17 partition p_201602 values less than(to_date('20160301','yyyymmdd')),
-
18 partition p_201603 values less than(to_date('20160401','yyyymmdd')),
-
19 partition p_201604 values less than(to_date('20160501','yyyymmdd')),
-
20 partition p_201605 values less than(to_date('20160601','yyyymmdd')),
-
21 partition p_201606 values less than(to_date('20160701','yyyymmdd')),
-
22 partition p_201607 values less than(to_date('20160801','yyyymmdd'))
-
23 );
-
-
表已建立。
-
- SQL>
二、PARTITION value 型別更改為timestamp'2015-06-01 00:00:00.000000'
點選(此處)摺疊或開啟
-
SQL>
-
SQL> drop table hoegh2 purge;
-
-
表已刪除。
-
-
SQL> create table hoegh2
-
2 (
-
3 id NUMBER,
-
4 TIMESTAMP TIMESTAMP(6)
-
5 )
-
6 partition by range(TIMESTAMP)
-
7 (
-
8 partition p_201505 values less than(timestamp'2015-06-01 00:00:00.000000'),
-
9 partition p_201506 values less than(timestamp'2015-07-01 00:00:00.000000'),
-
10 partition p_201507 values less than(timestamp'2015-08-01 00:00:00.000000'),
-
11 partition p_201508 values less than(timestamp'2015-09-01 00:00:00.000000'),
-
12 partition p_201509 values less than(timestamp'2015-10-01 00:00:00.000000'),
-
13 partition p_201510 values less than(timestamp'2015-11-01 00:00:00.000000'),
-
14 partition p_201511 values less than(timestamp'2015-12-01 00:00:00.000000'),
-
15 partition p_201512 values less than(timestamp'2016-01-01 00:00:00.000000'),
-
16 partition p_201601 values less than(timestamp'2016-02-01 00:00:00.000000'),
-
17 partition p_201602 values less than(timestamp'2016-03-01 00:00:00.000000'),
-
18 partition p_201603 values less than(timestamp'2016-04-01 00:00:00.000000'),
-
19 partition p_201604 values less than(timestamp'2016-05-01 00:00:00.000000'),
-
20 partition p_201605 values less than(timestamp'2016-06-01 00:00:00.000000'),
-
21 partition p_201606 values less than(timestamp'2016-07-01 00:00:00.000000'),
-
22 partition p_201607 values less than(timestamp'2016-08-01 00:00:00.000000')
-
23 );
-
-
表已建立。
-
- SQL>
雖然問題得到了順利解決,但是為什麼會報錯還是沒弄明白,如果有了解原理的朋友還望不吝賜教。
~~~~~~~ the end~~~~~~~~~
hoegh
2016.07.12
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30162081/viewspace-2121903/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- C語言中幾種報錯型別的解決方案C語言型別
- 安裝sass報錯解決方案
- 解決跨域的兩種方案JSONP和CORS跨域JSONCORS
- Django(21)migrate報錯的解決方案Django
- ORA-01756報錯的解決方案
- Laravel安裝horizon報錯解決方案Laravel
- win安裝wordcloud報錯解決方案Cloud
- electron npm install 報錯解決方案NPM
- minio報錯SignatureDoesNotMatch解決方案
- 關於Support for password authentication 報錯的解決方案
- TNS-12555報錯的解決方案
- ORA-03206報錯的解決方案
- Server Application Error報錯資訊的解決方案ServerAPPError
- Please do not register multiple Pages in undefined.js 小程式報錯的幾種解決方案UndefinedJS
- 詳解MVCC以及儘可能解決幻讀的兩種方案MVC
- npm install 安裝報錯解決方案NPM
- Android Studio 報錯解決方案 一Android
- CentOS 6安裝Oracle報錯解決方案CentOSOracle
- 無痕模式下localstorage報錯解決方案模式
- MySQL 啟動服務報錯解決方案MySql
- vue tsx 原生屬性報錯解決方案Vue
- Unity3D啟動報錯的解決方案Unity3D
- R語言的各種報錯及其解決方法R語言
- 將input file的選擇的檔案清空的兩種解決方案
- 跨域請求?兩種解決方案CORS與JSONP跨域CORSJSON
- 糅合兩種開發模式的快速開發平臺解決方案模式
- vue移動端的自適應佈局的兩種解決方案Vue
- 分享兩種實現Winform程式的多語言支援的解決方案ORM
- Oracle 條件索引 case when 報錯解決方案Oracle索引
- matplotlib中文報錯問題及解決方案
- 兩種解決powerdesigner概念模型轉物理模型報欄位重複錯誤的方法模型
- SS報錯的解決
- svn的操作,報錯,和解決方案 一。
- 跨域的幾種解決方案跨域
- Percona Toolkit工具連線MySQL 8報錯的解決方案MySql
- Python報錯:PermissionError: [Errno 13] Permission denied解決方案PythonError
- 【安裝Android Studio報錯之解決方案】Android
- 執行create table as 報ora-600的錯誤的解決方案