CREATE PACKAGE BODY
You are viewing an old version of this article. View
the current version here.
MariaDB starting with 10.3.5
Oracle-style packages were introduced in MariaDB 10.3.5.
Syntax
CREATE [ OR REPLACE ] [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }] PACKAGE BODY [ IF NOT EXISTS ] package_name [ package_characteristic... ] { AS | IS } package_implementation_declare_section package_implementation_executable_section END [ package_name] package_implementation_declare_section: package_implementation_item_declaration [ package_implementation_item_declaration... ] [ package_implementation_routine_definition... ] | package_implementation_routine_definition [ package_implementation_routine_definition...] package_implementation_item_declaration: variable_declaration ; variable_declaration: variable_name[,...] type [:= expr ] package_implementation_routine_definition: FUNCTION package_specification_function [ package_implementation_function_body ] ; | PROCEDURE package_specification_procedure [ package_implementation_procedure_body ] ; package_implementation_function_body: { AS | IS } package_routine_body [func_name] package_implementation_procedure_body: { AS | IS } package_routine_body [proc_name] package_routine_body: [ package_routine_declarations ] BEGIN statements [ EXCEPTION exception_handlers ] END package_routine_declarations: package_routine_declaration ';' [package_routine_declaration ';']... package_routine_declaration: variable_declaration | condition_name CONDITION FOR condition_value | user_exception_name EXCEPTION | CURSOR_SYM cursor_name [ ( cursor_formal_parameters ) ] IS select_statement ; package_implementation_executable_section: END | BEGIN statement ; [statement ; ]... [EXCEPTION exception_handlers] END exception_handlers: exception_handler [exception_handler...] exception_handler: WHEN_SYM condition_value [, condition_value]... THEN_SYM statement ; [statement ;]... condition_value: condition_name | user_exception_name | SQLWARNING | SQLEXCEPTION | NOT FOUND | OTHERS_SYM | SQLSTATE [VALUE] sqlstate_value | mariadb_error_code
Contents
Description
The CREATE PACKAGE BODY
statement can be used when Oracle SQL_MODE is set.
The CREATE PACKAGE BODY
statement creates the package body for a stored package. The package specification must be previously created using the CREATE PACKAGE statement.
A package body provides implementations of the package public routines and can optionally have:
- package-wide private variables
- package private routines
- forward declarations for private routines
- an executable initialization section
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.