-- 建立以10開始的序列-- create sequence my_sequence start with 10; -- 查詢序列中接下來的最高值 select my_sequence.nextval from dual; -- create create table student(n varchar(10)); -- insert insert into student values('a'||lpad(student_seq.nextval,9,'0')); -- select select * from student; -- execute execute immediate 'set constraints all deferred'; --alert ALTER TABLE student ADD UPDATETIME VARCHAR2(20); ALTER TABLE student DROP COLUMN UPDATUSERID; --2017/09/25 -- oracle 日期經常使用函數 (SYSDATE,yyyy/MM/dd) -- TO_CHAR 是把日期或數字轉換爲字符串,不能指定字符串長度 -- 例如:TO_CHAR(salary,’$99,999.99’) SELECT * FROM acct_work_register WHERE workflag='1' AND areatype='Land' AND curdate<to_char(sysdate,'yyyy/MM/dd') ORDER BY curdate DESC; --2017/09/26 11:09:57 SELECT to_char(SYSDATE,'YYYY/MM/DD HH24:MM:SS') FROM dual;