oracle 根據虛擬列建立以周幾為單位的分割槽表
SQL> create table t2(rid number,rname varchar2(20),rdate date,week_num number generated always as (to_char(rdate,'d'))) 2 partition by list(week_num) 3 ( 4 partition rdate1 values (1), 5 partition rdate2 values (2), 6 partition rdate3 values (3), 7 partition rdate4 values (4), 8 partition rdate5 values (5), 9 partition rdate6 values (6), 10 partition rdate7 values (7) 11 ); Table created. SQL> insert into t2(rid,rname,rdate) values(5,'thursday',sysdate); 1 row created. SQL> insert into t2(rid,rname,rdate) values(6,'friday',sysdate+1); 1 row created. SQL> insert into t2(rid,rname,rdate) values(7,'saturday',sysdate+2); 1 row created. SQL> insert into t2(rid,rname,rdate) values(1,'sunday',sysdate+3); 1 row created. SQL> insert into t2(rid,rname,rdate) values(2,'monday',sysdate+4); 1 row created. SQL> insert into t2(rid,rname,rdate) values(3,'tuesday',sysdate+5); 1 row created. SQL> insert into t2(rid,rname,rdate) values(4,'wednesday',sysdate+6); 1 row created. SQL> commit; Commit complete. SQL> select * from t2; RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 1 sunday 31-JAN-21 1 2 monday 01-FEB-21 2 3 tuesday 02-FEB-21 3 4 wednesday 03-FEB-21 4 5 thursday 28-JAN-21 5 6 friday 29-JAN-21 6 7 saturday 30-JAN-21 7 7 rows selected. SQL> select * from t2 partition(rdate1); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 1 sunday 31-JAN-21 1 SQL> select * from t2 partition(rdate2); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 2 monday 01-FEB-21 2 SQL> select * from t2 partition(rdate3); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 3 tuesday 02-FEB-21 3 SQL> select * from t2 partition(rdate4); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 4 wednesday 03-FEB-21 4 SQL> select * from t2 partition(rdate5); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 5 thursday 28-JAN-21 5 SQL> select * from t2 partition(rdate6); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 6 friday 29-JAN-21 6 SQL> select * from t2 partition(rdate7); RID RNAME RDATE WEEK_NUM ---------- -------------------- ------------ ---------- 7 saturday 30-JAN-21 7
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28572479/viewspace-2754210/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 11g 分割槽表建立(年月日周時分秒)Oracle
- Oracle分割槽表基礎運維-04列表分割槽Oracle運維
- Oracle分割槽表基礎運維-07增加分割槽(3列表分割槽)Oracle運維
- oracle將表配置為分割槽表Oracle
- oracle分割槽表和分割槽表exchangeOracle
- oracle分割槽表和非分割槽表exchangeOracle
- [oracle] expdp 匯出分割槽表的分割槽Oracle
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- oracle 線上重新定義,普通表改變分割槽表,分割槽表可以更改型別、分割槽欄位等Oracle型別
- SAP RETAIL 如何根據分配表查到根據它建立的採購訂單?AI
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- OceaBase 分割槽表建立技巧
- ORACLE分割槽表梳理系列Oracle
- Oracle drop分割槽表單個分割槽無法透過閃回恢復Oracle
- 對oracle分割槽表的理解整理Oracle
- oracle 普通表-分割槽表改造流程Oracle
- Oracle分割槽表基礎運維-07增加分割槽(2 HASH分割槽)Oracle運維
- Oracle分割槽表基礎運維-06分割槽表索引Oracle運維索引
- 週六直播充電:探究Oracle分割槽表建立和使用Oracle
- Linux 分割槽擴容(根分割槽擴容,SWAP 分割槽擴容,掛載新分割槽為目錄)Linux
- Oracle12c:建立主分割槽、子分割槽,實現自動分割槽插入效果Oracle
- Oracle 12C新特性-線上把非分割槽錶轉為分割槽表Oracle
- Oracle分割槽表基礎運維-09刪除分割槽Oracle運維
- Oracle分割槽表基礎運維-05組合分割槽Oracle運維
- Oracle分割槽表基礎運維-02範圍分割槽Oracle運維
- Oracle分割槽表基礎運維-03HASH分割槽Oracle運維
- django | 根據 model 建立對應的表Django
- Oracle分割槽表基礎運維-07增加分割槽(1範圍分割槽)Oracle運維
- Oracle分割槽表基礎運維-01分割槽表分類Oracle運維
- 教程:如何使用DataLakeAnalytics建立分割槽表
- Oracle SQL調優之分割槽表OracleSQL
- 增加表分割槽時,為local分割槽索引指定不同表空間的方法索引
- oracle分割槽表的分類及測試Oracle
- fdisk 更改分割槽容量遇到問題,還以為是oracle asm的問題OracleASM
- PG的非分割槽表線上轉分割槽表
- 如何使用Data Lake Analytics建立分割槽表
- ORACLE刪除-表分割槽和資料Oracle
- 建立sawp分割槽