oracle id 自增
oracle让id自动增长(insert时不用手动插入id)的办法,像Mysql中的auto_increment那样
创建序列
create sequence emp_seq
increment by 1
start with 1
nomaxvalue
nocycle
cache 10
DAO引用序列
insert into emp
values(emp_seq.nextval,'aaa')
修改序列(不能修改启始值)
alter sequence emp_seq
increment by 10
maxvalue 10000
相关文档:
SQL Server里的 ISNULL 与 Oracle 中的 NULLIF不同:
SQL Server 中有两个参数,语法:
ISNULL(check_expression, replacement_value)
check_expression 与 replacement_value 数据类型必须一致
如果 check_expression 为 NULL,则返回 replacement_v ......
Oracle 用户及角色 介绍 收藏
一. 用户管理
1.1 建立用户(数据库验证)
CREATE USER DAVE IDENTIFIED BY pwd
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp ......
create table test1 as select 1 id,'create table test2(id number,name varchar2(200));insert into test2 values(1,''a'');' sqltext from dual
2 union all select 2,'truncate table test2;' from dual
3 union all select 3,'insert into test2 select rownum,dbms_random.string(''l'', ......
Oracle 的rownum 原理和使用
在Oracle 中,要按特定条件查询前N条记录,用个rownum 就搞定了。
select * from emp where rownum <= 5
而且书上也告诫,不能对rownum 用">",这也就意味着,如果你想用
select * from emp where rownum > 5
则是失败的。要知道为什么会失败,则需要了解rownum 背后的机制� ......
练习:
drop table Employee;
create table Employee(
id number primary key,
  ......