首页 > 代码库 > oracle
oracle
====================序列
//查询当前用户序列
select
*
from
user_sequences
//查询所有序列
select * from all_sequences;
//创建序列
语法:create sequence 表名_sequence increment by 1 start with 1 nomaxvalue nocycle;
eg:
create sequence third_party_merchant_sequence increment by 1 start with 1 nomaxvalue nocycle;
//查询该序列的下一个值
select THIRD_PARTY_MERCHANT_SEQUENCE.Nextval from dual;
删除序列:
drop sequence third_party_merchant_sequence;
========================check约束
//查询当前用户约束
select * from user_constraints;
//创建表时添加约束
create
table
test
(id
int
,
name
varchar2(10),
sex varchar2(10)
check
(sex
in
(
‘男‘
,
‘女‘
))
);
//为表添加约束
alter table THIRD_PARTY_MERCHANT
add constraint constraint_yn
check(yn in(1,2))enable validate;
oracle
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。