Skip Headers
Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)

Part Number E25519-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
LNPLS01303

Block

The block, which groups related declarations and statements, is the basic unit of a PL/SQL source program. It has an optional declarative part, a required executable part, and an optional exception-handling part. Declarations are local to the block and cease to exist when the block completes execution. Blocks can be nested.

An anonymous block is an executable statement.

LNPLS961Topics

Syntax

LNPLS949plsql_block ::=

Description of plsql_block.gif follows
Description of the illustration plsql_block.gif

See "body ::=".

LNPLS950declare_section ::=

Description of declare_section.gif follows
Description of the illustration declare_section.gif

See "item_list_2 ::=".

LNPLS951item_list_1 ::=

Description of item_list_1.gif follows
Description of the illustration item_list_1.gif

See:

LNPLS952item_list_2 ::=

Description of item_list_2.gif follows
Description of the illustration item_list_2.gif

See:

LNPLS953type_definition ::=

Description of type_definition.gif follows
Description of the illustration type_definition.gif

See:

LNPLS954subtype_definition ::=

Description of subtype_definition.gif follows
Description of the illustration subtype_definition.gif

LNPLS962constraint ::=

Description of constraint.gif follows
Description of the illustration constraint.gif

LNPLS955item_declaration ::=

Description of item_declaration.gif follows
Description of the illustration item_declaration.gif

See:

LNPLS956pragma ::=

Description of pragma.gif follows
Description of the illustration pragma.gif

See:

LNPLS957body ::=

Description of body.gif follows
Description of the illustration body.gif

See:

LNPLS958statement ::=

Description of statement.gif follows
Description of the illustration statement.gif

See:

LNPLS959procedure_call ::=

Description of procedure_call.gif follows
Description of the illustration procedure_call.gif

LNPLS960sql_statement ::=

Description of sql_statement.gif follows
Description of the illustration sql_statement.gif

Semantics

LNPLS963plsql_block

LNPLS964label

Undeclared identifier, unique for the block.

LNPLS965DECLARE

Starts the declarative part of the block.

LNPLS966declare_section

Contains local declarations, which exist only in the block and its sub-blocks and are not visible to enclosing blocks.

LNPLS967Restrictions on declare_section 

See Also:

LNPLS968subtype_definition

LNPLS969subtype

Name of the user-defined subtype that you are defining.

LNPLS970base_type

Base type of the subtype that you are defining. base_type must be scalar.

LNPLS971CHARACTER SET character_set

Specifies the character set for a subtype of a character data type.

LNPLS972Restriction on CHARACTER SET character_set Do not specify this clause if base_type is not a character data type.

LNPLS973NOT NULL

Imposes the NOT NULL constraint on data items declared with this subtype. For information about this constraint, see "NOT NULL Constraint".

LNPLS974constraint

Specifies a constraint for a subtype of a numeric data type.

LNPLS975Restriction on constraint Do not specify constraint if base_type is not a numeric data type.

LNPLS976precision

Specifies the precision for a constrained subtype of a numeric data type.

LNPLS977Restriction on precision Do not specify precision if base_type cannot specify precision.

LNPLS978scale

Specifies the scale for a constrained subtype of a numeric data type.

LNPLS979Restriction on scale Do not specify scale if base_type cannot specify scale.

LNPLS980RANGE low_value .. high_value

Specifies the range for a constrained subtype of a numeric data type. The low_value and high_value must be numeric literals.

LNPLS981Restriction on RANGE high_value .. low_value Specify this clause only if base_type is PLS_INTEGER or a subtype of PLS_INTEGER (either predefined or user-defined). (For a summary of the predefined subtypes of PLS_INTEGER, see Table 3-3. For information about user-defined subtypes with ranges, see "Constrained Subtypes".)

LNPLS984body

LNPLS985BEGIN

Starts the executable part of the block, which contains executable statements.

LNPLS986EXCEPTION

Starts the exception-handling part of the block. When PL/SQL raises an exception, normal execution of the block stops and control transfers to the appropriate exception_handler. After the exception handler completes, execution resumes with the statement following the block. For more information about exception-handling, see Chapter 11, "PL/SQL Error Handling."

LNPLS990exception_handler

See "Exception Handler".

LNPLS996END

Ends the block.

LNPLS997name

The name of the block to which END applies—a label, function name, procedure name, or package name.

LNPLS998statement

LNPLS999label

Undeclared identifier, unique for the statement.

LNPLS1000assignment_statement

See "Assignment Statement".

LNPLS1001basic_loop_statement

See "Basic LOOP Statement".

LNPLS1002case_statement

See "CASE Statement".

LNPLS1003close_statement

See "CLOSE Statement".

LNPLS1004collection_method_call

Invocation of one of these collection methods, which are procedures:

For syntax, see "Collection Method Invocation".

LNPLS1025continue_statement

See "CONTINUE Statement".

LNPLS1026cursor_for_loop_statement

See "Cursor FOR LOOP Statement".

LNPLS1027execute_immediate_statement

See "EXECUTE IMMEDIATE Statement".

LNPLS1028exit_statement

See "EXIT Statement".

LNPLS1029fetch_statement

See "FETCH Statement".

LNPLS1030for_loop_statement

See "FOR LOOP Statement".

LNPLS1031forall_statement

See "FORALL Statement".

LNPLS1032goto_statement

See "GOTO Statement".

LNPLS1033if_statement

See "IF Statement".

LNPLS1034null_statement

See "NULL Statement".

LNPLS1035open_statement

See "OPEN Statement".

LNPLS1036open_for_statement

See "OPEN FOR Statement".

LNPLS1037pipe_row_statement

See "PIPE ROW Statement".

LNPLS1038Restriction on pipe_row_statement This statement can appear only in the body of a pipelined table function; otherwise, PL/SQL raises an exception.

LNPLS1039raise_statement

See "RAISE Statement".

LNPLS1040return_statement

See "RETURN Statement".

LNPLS1041select_into_statement

See "SELECT INTO Statement".

LNPLS1043while_loop_statement

See "WHILE LOOP Statement".

LNPLS1044procedure_call

LNPLS1045procedure

Name of the procedure that you are invoking.

LNPLS1048parameter [, parameter ]...

List of actual parameters for the procedure that you are invoking. The data type of each actual parameter must be compatible with the data type of the corresponding formal parameter. The mode of the formal parameter determines what the actual parameter can be:

Formal Parameter Mode Actual Parameter
IN Constant, initialized variable, literal, or expression
OUT Variable whose data type is not defined as NOT NULL
IN OUT Variable (typically, it is a string buffer or numeric accumulator)

If the procedure specifies a default value for a parameter, you can omit that parameter from the parameter list. If the procedure has no parameters, or specifies a default value for every parameter, you can either omit the parameter list or specify an empty parameter list.

LNPLS1049sql_statement

LNPLS1050commit_statement

SQL COMMIT statement. For syntax, see Oracle Database SQL Language Reference.

LNPLS1051delete_statement

SQL DELETE statement. For syntax, see Oracle Database SQL Language Reference. See also "DELETE Statement Extension".

LNPLS1052insert_statement

SQL INSERT statement. For syntax, see Oracle Database SQL Language Reference. See also "INSERT Statement Extension".

LNPLS1053lock_table_statement

SQL LOCK TABLE statement. For syntax, see Oracle Database SQL Language Reference.

LNPLS1054rollback_statement

SQL ROLLBACK statement. For syntax, see Oracle Database SQL Language Reference.

LNPLS1055savepoint_statement

SQL SAVEPOINT statement. For syntax, see Oracle Database SQL Language Reference.

LNPLS1056set_transaction_statement

SQL SET TRANSACTION statement. For syntax, see Oracle Database SQL Language Reference.

LNPLS1057update_statement

SQL UPDATE statement. For syntax, see Oracle Database SQL Language Reference. See also "UPDATE Statement Extensions".

Examples

Related Topics

LNPLS1061In this chapter:

LNPLS1067In other chapters:

Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF