Create sequence in DB2 and Oracle

Source: Internet
Author: User

Whether the creation of a new sequence DB2 sequence in DB2 and Oracle contains double quotation marks causes a production system problem www.2cto.com create sequence x3; -- run successfully create sequence "x3" -- run successfully (a sequence named "x3" is actually created and can be accessed using X3) values Nextval for x3 -- run successfully, value: 1 values prevval for X3 -- execution successful, value: 1 create sequence Y3; -- execution successful, you can use Y3, y3, or "Y3" to access create sequence "Y3" -- the execution fails and an error "values Nextval for Y3" is reported. -- the execution is successful, the value is 1 values Nextval for y3 -- execute the command, and the value is 2 create Sequence z3; -- execution successful create sequence "z3" -- execution successful (actually a sequence named "z3" is created, which is enclosed by quotation marks) -- values prevval for z3 -- error: values Nextval for z3 is returned because no value exists. -- execution successful; Value: 1 values Nextval for z3 -- execution successful, value: 2 values Nextval for "z3" -- execution successful; Value: 1 ------------------------------------------------------------- ORACLE sequence create sequence x3; -- create sequence "x3" -- the execution is successful (it indicates that the sequence is created in oracle. When there are lower-case letters in quotation marks, the quotation marks are different from those without quotation marks) -- select x3.prevval from dual -- error -- select X3.prevval from dual -- error select x3.Nextval from dual -- execution success value: 1 select x3.Nextval from dual -- execution success value: 2 select X3.Nextval from dual -- execution the successful value is 3, which is actually the sequence select "x3" of x3 ". nextval from dual -- the execution success value is 1 select "x3 ". nextval from dual -- the execution success value is 2 ------------------------------- create sequence Y3; -- the execution is successful. create sequ Ence "Y3" -- failed to execute. An error is returned, indicating that a sequence already exists. (This indicates that if sequence is created in oracle in uppercase, it is the same as creating a sequence with quotation marks .) Select Y3.nextval from dual -- the execution success value is 1 select "Y3 ". nextval from dual -- the execution success value is 2 --------------------------------- create sequence "A" -- OK select "". nextval from dual -- OK select. nextval from dual -- OK select. nextval from dual -- OK select "". nextval from dual -- OK select "". nextval from dual -- error ------------------------------- create sequence "B" -- OK select "B ". nextval from dual -- OK select B. nextval from dual -- error select B. nextval from dual -- error select "B ". nextval from dual -- error select "B ". nextval from dual -- OK ------------------------------- create sequence "a" select. nextval from dual -- error select. nextval from dual -- error select "". nextval from dual -- OK select "". nextval from dual -- error ------------------------------- create sequence "B" select B. nextval from dual -- OK select B. nextval from dual -- OK select "B ". nextval from dual -- error select "B ". nextval from dual -- OK drop sequence B -- OK drop sequence a -- error drop sequence "a" -- OK create sequence "B" -- OK drop sequence B -- OK create sequence "B "-- OK drop sequence "B" -- error drop sequence B -- OK ---------------------------------------------------------------

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.