gitman3

SQL Sequence 17-Oct-2023

Oct 17th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. CREATE SEQUENCE dept_deptid_seq INCREMENT BY 10 START WITH 120 MAXVALUE 9999 NOCACHE NOCYCLE;
  2.  
  3. select * from user_sequences;
  4.  
  5. CREATE TABLE business(bid number(5), btype varchar2(10));
  6.  
  7. INSERT INTO business(bid,btype) VALUES (435,'D2C');
  8. INSERT INTO business(bid,btype) VALUES (731,'G2C');
  9. INSERT INTO business(bid,btype) VALUES (743,'C2B');
  10. INSERT INTO business(bid,btype) VALUES (763,'D2D');
  11. INSERT INTO business(bid,btype) VALUES (432,'B2B');
  12. INSERT INTO business(bid,btype) VALUES (635,'C2D');
  13. INSERT INTO business(bid,btype) VALUES (535,'D2B');
  14.  
  15. INSERT INTO business VALUES (dept_deptid_seq.nextval, 'c2c')
  16.  
  17. select dept_deptid_seq.nextval from dual
Add Comment
Please, Sign In to add comment