Chapter -03 Writing Executable Statements 01
2013-04-18 23:16
316 查看
Objectives
After completing this lesson,you should be able to do the following:Identify lexical units in a PL/SQL block.
Use build-in SQL functions in PL/SQL
Describe when implict conversions take place and when explict conversion have to be dealt with
Write nested blocks and qualify variables with labels
Write readable code with appropriate indentation
Use sequences in PL/SQL expressions.
Agenda
Writting executable statements in a PL/SQL blockWritting nested blocks
Using operators and developing readable code.
Lexical units in a PL/SQL Block
Lexical units:Are building blocks of any PL/SQL block.
Are sequences of characters including letters,numerals,tables spaces,returns,and symbols
Can be classified as:
Identifiers:v_fname,c_percent
Delimiters:;,+-
Literals:John,428,True
Comments:--,/**/
PL/SQL Block Syntax and Guidelines
Using Literals-Character and date literals must be enclosed in single quotation marks.
-Numbers can be simple values or in scientific notaion.
v_name := 'Henderson';
Formatting Code:Statements can span several lines.
View Code
DECLARE v_outer_variable VARCHAR2(20) := 'GLOBAL VARIABLE'; BEGIN DECLARE v_inner_variable VARCHAR2(20) := 'LOCAL VARIABLE'; BEGIN DBMS_OUTPUT.PUT_LINE(v_inner_variable); DBMS_OUTPUT.PUT_LINE(v_outer_variable); END; DBMS_OUTPUT.PUT_LINE(v_outer_variable); END; / SQL> @nested.sql LOCAL VARIABLE GLOBAL VARIABLE GLOBAL VARIABLE PL/SQL procedure successfully completed.
相关文章推荐
- Chapter -03 Writing Executable Statements 02
- Chapter 03-Using Single-Row Functions to Customize Output(01)
- [bbk4979]第06集 - Chapter 04- Interacting with Oracle Database Server:SQL Statements in PL/SQL Programs(01)
- 自学PL/SQL 第二讲Writing Executable Statements
- [bbk4982]第09集 - Chapter 05- Writing Control Structures(01)
- [THINKING IN C++]CHAPTER 03:EXERCISE 01
- Chapter 2 - Writing a C# Program
- Chapter 6-01
- Chapter 6-03
- MFC-01-Chapter01:Hello,MFC---1.3 第一个MFC程序(03)
- 01-04-03【Nhibernate (版本3.3.1.4000) 出入江湖】Criteria API关联查询
- Chapter 09-Manipulation Data - 03
- [bbk5128]第12集 - Chapter 06- Working with Composite Data Types -01-4998(Record)
- 2016CCPC东北地区大学生程序设计竞赛【01/03/05/06/08】
- [bbk2193] 第34集 - Chapter 09-Optimizing Sore Perations(03)
- [bbk3205] 第68集 -Chapter 17-Monitoring and Detecting Lock Contention(01)
- 17 - 01 - 03 链表逆序合并
- 17 - 03 - 01 图解HTTP(05)
- 视频: 千重浪Linux系统调试技术培训03-01-basic-cpu-task
- Chapter_01 穿越时空的迷雾