常用sql0926-TO_CHAR()
时间:2021-07-01 10:21:17
帮助过:17人阅读
创建以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;
常用sql0926-TO_CHAR()
标签:star set deferred enc exec char tar update tab