PL/SQL language development Reference Manual II: PL/SQL program structure
PL/SQL language development Reference Manual
1,PL/SQL Block
1) Declaration, declare (if the statement does not need to declare any variables, you can leave it empty );
2) execution part, begin <---------> end;
3) exception handling, exception (may not );
2,PL/SQL Development Environment
You can use any plain text editor to edit a file, for example, Vi.
3,PL/SQL Character Set
Letter: A-Z, A-Z;
Number: 0-9;
Blank: tab, space, and press Enter;
Symbol: + _) (* & ^ % $ #@!~ ;
PL/SQL is case insensitive (note)
4,Identifier naming rulesA:
1) start with a letter:
2) followed by any non-space characters, numbers, currency symbols ($), underscores (_), or #;
3) the maximum length is 30 characters (about 8 characters );
Used to name objects (potential rules ):
Variable: starting with V _
Cursor: starting with C _
Type:
Subroutine:
5,Delimiter
1) operator +-*/** (exponential operator)
2) link = (equivalent to = in Java)> <>! = ~ ==<=>=
3) Value assignment: = Example A: = 2
4) join | example: 'abc' | 123
5) Labels <required tags>
6) comment -- (single line)/**/(paragraph)
7) replace <scape> <tab> <enter>
6,Text
1) character text (string)
'Tom '(single quotes)
'Tom's pen ''is a pair of single quotes (marked escape) and a Tom's pen.
2) digital
123-4 + 56 0 9.0 1.23e5 9.8e-3
3) Boolean
True False null
7,Variable Declaration
Syntax var_name [constant] (ID constant, Optional) Type [not null] (ID is not-null and must be initialized later) [: = value] (assign value, initialization );
Var_name [constant] (ID constant, Optional) Type [not null] [default value] (Value assignment, initialization) is equivalent to the preceding statement;
Note:
1) The statement can have a default value or not;
2) If [constant] [not null] exists, the variable must have an initial value;
3) The value assignment statement is ": = ";
4) variables can be considered as a field in the database;
5) it is specified that the variable not initialized is null;