Statement to create sequence (example)
create sequence seq_course minvalue 1 maxvalue 999999999999999999 start with 1 increment by 2 cache 20;
Query the size of the next value of a sequence using a sequence in conjunction with a table
SELECT seq_course.nextval FROM dual;
--Using sequences to realize the self-increment operation of the primary key
INSERT INTO TEST values(seq_course.nextval ,'aa','cc','ss');
transaction commit
INSERT INTO TEST values(seq_course.nextval ,'fsfv','asdqw','qdc'); COMMIT;
transaction rollback
rollback has the opportunity to roll back the savepoint savepoint of the transaction transaction before committing
--savepoint 保存点 INSERT INTO TEST values(seq_course.nextval ,'fsfv12','asdqw','qdc'); INSERT INTO TEST values(seq_course.nextval ,'fsfv13','asdqw','qdc'); SAVEPOINT a1; --Create a transaction savepoint INSERT INTO TEST values (seq_course.nextval , ' fsfv14 ' , ' asdqw ' , ' qdc ' ); --Rollback to transaction savepoint a1 ROLLBACK TO a1; --Commit operation COMMIT ;
view
create or replace view emp_dept as select e.ename,e.job,d.dname from emp e,dept d where e.deptno=d.deptno
In the above example, authorization can be made in the syatem account and authorized to scott
--authorize grant create view to scott _
Function: Views store complex query operations, and users (developers) can easily query the views to get the desired data
When querying data later, it is more convenient to write directly and query directly:
select * from emp_dept;