Skip to content
plsql
--select  * from   orders_users;



yyyy-MM-dd HH24:mm:ss

select to_date('1979-12-18 16:55:13', 'yyyy-MM-dd HH24:mi:ss')  from   dual

delete from  orders_users where createDate is null;

select distinct  to_char(createDate,'yyyy') from  orders_users 




PARTITION BY RANGE (sale_date) (
  PARTITION sales_q1 VALUES LESS THAN (TO_DATE('01-APR-2023', 'DD-MON-YYYY')),
  PARTITION sales_q2 VALUES LESS THAN (TO_DATE('01-JUL-2023', 'DD-MON-YYYY')),
  PARTITION sales_q3 VALUES LESS THAN (TO_DATE('01-OCT-2023', 'DD-MON-YYYY')),
  PARTITION sales_q4 VALUES LESS THAN (TO_DATE('01-JAN-2024', 'DD-MON-YYYY'))
);



alter table  orders_users  add PARTITION

drop table ORDERS_USERS_2;
CREATE TABLE ORDERS_USERS_2 
   (	ID NUMBER  PRIMARY KEY, 
    NAME VARCHAR2(1000), 
    ADDRESS VARCHAR2(1000), 
    TEL VARCHAR2(1000), 
    GENDER VARCHAR2(1000), 
    EMAIL VARCHAR2(1000), 
    CREATEDATE TIMESTAMP , 
    CONTRACTNO VARCHAR2(100)
   )
  
  PARTITION BY RANGE (CREATEDATE) INTERVAL (numtoyminterval(1, 'year')) (
    PARTITION ORDERS_USERS_his VALUES LESS THAN (TO_DATE('2000-01-01', 'yyyy-MM-dd')),
    PARTITION ORDERS_USERS_his2 VALUES LESS THAN (TO_DATE('2010-01-01', 'yyyy-MM-dd')),
    PARTITION ORDERS_USERS_his3 VALUES LESS THAN (TO_DATE('2015-01-01', 'yyyy-MM-dd')),
    PARTITION ORDERS_USERS_his4 VALUES LESS THAN (TO_DATE('2020-01-01', 'yyyy-MM-dd'))
  );



insert into ORDERS_USERS_2  select * from ORDERS_USERS;


select * from ORDERS_USERS_2;

https://www.cnblogs.com/jinanxiaolaohu/p/17717520.html