Oracle PL/SQL Block 小结

PLSQL Block 的结构:

[@more@]

Oracle PL/SQL Block 小结

一些说明小结:
- place a semicolon(;) at the end of a SQL statement or PL/SQL control statement
- section keywords DECLARE,BEGIN,and EXCEPTION are not followed by semicolons
- END and all other PL/SQL statement require a semicolon to terminate the statement
- statement can continue over several lines
- blocks can be entirely separate or nested one within another
- a exception section can also contain nested blocks


the scope and the visibilityh of the identifier:
- the scope of an identifier is that region of a program unit(block,subprogram,or package) from which you can reference the identifier
- an identifier is visible only in the regions from which you can reference the identifier using an unqualified name
- a block can look up to the enclosing block
- a block cannot look down to enclosed blocks or sideways to sibling blocks
- a plsql program is terminated and executed by a slash(/) on a line by itself

Qualify an Identifier:
- by using the block label prefix
- the systax of the label is :<> plsql_block; - can reference another blocks’ variables by using label,syntax:another_label_name.variables_name


PL/SQL support & not support SQL languages:
- SELECT
- DML:UPDATE,INSERT,DELETE,MERGE --&gt Determine DML outcome with implicit cursor attributes
- Transaction Control Language:COMMIT,ROLLBACK,SAVEPOINT
- the keywork END signals the end of a PL/SQL block,not the end of a transaction
- Just as a block can span multiple transactions,a transaction can span multiple blocks
- does not directly support DDL statement: CREATE,ALTER,DROP
- does not support DCL statement: GRANT,REVOKE


SELECT Statements in PL/SQL:
- Retrieve data from the database with a SELECT statement
- Queries must return one and only one row
- Syntax:
SELECT select_list
INTO variable_name [,variable_name]...[,|record_name]
FROM table_name
WHERE condition;

- PL/SQL variable assignments always use :=,and SQL column assignments always use =,like in the UPDATE statement

- lexical units can be classified as:
* delimiters
* identifiers
* literals
* comments

- identifiers
* can contain up to 30 characters * must begin with an alphabetic character
* should not have the same name as a database table column name
* should not be reserved words
* can contain numerals,dollar signs,underscores,and number signs
* cannot contain characters such as hyphens,slashes,and spaces

- literals
* character and date literals must be enclosed in single quotation marks
* numbers can be simple values or scientific notation

- comments
* prefix single-line comments with two dashes(--)
* place multiple-line comments between the symbols /* and */

书写Oracle PL/SQL时关于表示符大小写的一些规范:

Oracle PL/SQL Block 小结

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8633028/viewspace-905567/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8633028/viewspace-905567/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值