安排
-
drop table everyday_interval;
-
CREATE TABLE everyday_interval
-
(
-
time_seconds number,
-
car_no VARCHAR2(20),
-
addr VARCHAR2(200),
-
birthday DATE
-
)
-
PARTITION BY RANGE( time_seconds )
-
INTERVAL (86400) STORE IN (users)
-
(
-
PARTITION part1 VALUES LESS THAN(1659369600) -- 2022-8-1
-
);
-
-
insert into everyday_interval values(1659369600,'1111','aaaaaa',sysdate);
-
insert into everyday_interval values(1659542400,'2222','bbbbbb',sysdate-5);
-
insert into everyday_interval values(1661961600,'3333','cccccc',sysdate-1);
-
insert into everyday_interval values(1661961600,'5555','hhhhh',sysdate-6);
-
commit;
-
-
SELECT TO_NUMBER(TO_DATE('2022-08-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 p0801 FROM DUAL;
-
SELECT TO_NUMBER(TO_DATE('2022-08-02 00:00:00', 'YYYY-MM-DD HH24:MI:SS') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 p0802 FROM DUAL;
-
SELECT TO_NUMBER(TO_DATE('2022-08-03 00:00:00', 'YYYY-MM-DD HH24:MI:SS') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 p0803 FROM DUAL;
-
SELECT TO_NUMBER(TO_DATE('2022-08-04 00:00:00', 'YYYY-MM-DD HH24:MI:SS') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 p0804 FROM DUAL;
-
SELECT TO_NUMBER(TO_DATE('2022-09-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 p0901 FROM DUAL;
-
-
日期转秒
-
SELECT TO_NUMBER(sysdate - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 FROM DUAL;
-
秒转日期
-
SELECT TO_DATE('1970-1-1 8:0:0','YYYY-MM-DD HH24:MI:SS')+(1659369600/(3600*24)) FROM DUAL;
exec dbms_stats.gather_table_stats('a','everyday_interval')
-
set lin 200
-
col TABLESPACE_NAME for a12
-
col table_name for a20
-
col PARTITION_NAME for a20
-
col HIGH_VALUE for a20
-
col PARTITION_POSITION for 999
-
select TABLE_NAME,PARTITION_NAME,HIGH_VALUE,PARTITION_POSITION,TABLESPACE_NAME,NUM_ROWS from DBA_tab_partitions where TABLE_NAME=upper('everyday_interval');
阅读(472) | 评论(0) | 转发(0) |