- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
尚硅谷_宋红康_11_其它数据库对象剖析
Confirming Sequences Once you have created your sequence, it is documented in the data dictionary. Since a sequence is a database object, you can identify it in the USER_OBJECTS data dictionary table. You can also confirm the settings of the sequence by selecting from the USER_SEQUENCES data dictionary view. Instructor Note Demo: 12_dd.sql Purpose: To illustrate the USER_SEQUENCES data dictionary view and its contents. Using a Sequence After you create your sequence, it generates sequential numbers for use in your tables. Reference the sequence values by using the NEXTVAL and CURRVAL pseudocolumns. NEXTVAL and CURRVAL Pseudocolumns The NEXTVAL pseudocolumn is used to extract successive sequence numbers from a specified sequence. You must qualify NEXTVAL with the sequence name. When you reference sequence.NEXTVAL, a new sequence number is generated and the current sequence number is placed in CURRVAL. The CURRVAL pseudocolumn is used to refer to a sequence number that the current user has just generated. NEXTVAL must be used to generate a sequence number in the current user’s session before CURRVAL can be referenced. You must qualify CURRVAL with the sequence name. When sequence.CURRVAL is referenced, the last value returned to that user’s process is displayed. Using a Sequence The example on the slide inserts a new department in the DEPARTMENTS table. It uses the DEPT_DEPTID_SEQ sequence for generating a new department number as follows: You can view the current value of the sequence: SELECT dept_deptid_seq.CURRVAL FROM dual; Suppose now you want to hire employees to staff the new department. The INSERT statement to be executed for all new employees can include the following code: INSERT INTO employees (employee_id, department_id, ...) VALUES (employees_seq.NEXTVAL, dept_deptid_seq .CURRVAL, ...); Note: The preceding example assumes that a sequence called EMPLOYEE_SEQ has already been created for generating new employee numbers. Cachi
您可能关注的文档
最近下载
- 移动L1认证传输专业试题汇总(含答案).pdf VIP
- (新版)中移动传输专业L1认证考试复习题库-上(单选题汇总).docx VIP
- 计算机专业(基础综合)模拟试卷3(共456题).pdf VIP
- 项目编号szcg2007041645 项目名称2007年度深圳市储备土地管理.doc
- 离婚登记申请受理回执单民法典版(可直接打印).pdf VIP
- 人教五年级数学上册1.2.2 倍数是小数的实际问题和乘法验算 课时训练.doc VIP
- 光伏电站检修规程(行业标准).docx VIP
- (新版)中移动传输专业L1认证考试复习题库-下(多选题汇总).docx VIP
- 基于大概念的初中音乐单元整体教学设计探索.doc VIP
- 《企业经营数据分析》课件.ppt VIP
文档评论(0)