PLSQL编程(PLSQL programming).doc

  1. 1、本文档共27页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
PLSQL编程(PLSQL programming)

PLSQL编程(PLSQL programming) PL/SQL program block structure (a PL/SQL block can be an anonymous block, process, or function) : DECLARE - optional / * variable, cursor, user-defined special type * / The BEGIN - must / * * / SQL statements / * * / PL/SQL statements The EXCEPTION - optional / * processing actions when the error occurs * / The END; - must be Example: DECLARE V_variable VARCHAR2 (5); The BEGIN The SELECT column_name INTO v_variabe The FROM table_name; The EXCEPTION The WHEN exception_name THEN ... The END; PL/SQL data type PL/SQL variables and constants: PL/SQL variables: Scalar: stores a single value, and the generic data types used by scalar variables include characters, Numbers, dates, and Boolean types Compound: store multiple values Reference: reference external variables Example: SQL VARIABLE emp_num NUMBER SQL the BEGIN SELECT COUNT (*) INTO: emp_num 3 the FROM emp; 4 the END; 5 / The PL/SQL procedure has been successfully completed SQL PRINT emp_num EMP_NUM -- -- -- -- -- -- -- -- -- -- -- -- -- 13 LOB (large object) : CLOB (recipe), BLOB (photo), BFILE (movie), NCLOB External variables: Bind variables and pivot variables Note: variables can be in DECLARE and BEGIN... The END section assigns the value, but the constant can only be assigned to the DECLARE section. = the assignment symbol for PL/SQL. Scope: for a single block, defined the scope of the variable is the block, the parent block variables defined in the scope of the block itself is father, and the nested children. The variables defined in the subblock are only the subblocks themselves that are part of its scope. Each line in PL/SQL declares an identifier at most. Two variables in different blocks can be of the same name. The name of the variable (identifier) cannot be the same name as the column in the block. Initialization and keywords of variables: : = assignment operator The DEFAULT DEFAULT NOT NULL is NOT empty Basic scalar type VARCHAR2 NUMBER The DATE CHAR LONG LONG RAW BOOLEAN B

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档