HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Support To Keep The Same Name After The End With Oracle

Availability

This feature is available since MogDB 5.0.0.

Introduction

This feature supports PROCEDURE/FUNCTION/PACKAGE after the end of the name syntax and Oracle to maintain consistency, either using the object name, or empty.

Benefits

Enhance MogDB compatibility with Oracle to reduce application migration costs.

Description

In Oracle, the end of PROCEDURE/FUNCTION/PACKAGE can be followed by the name of the object or empty; however, prior to MogDB 5.0 it was required that the end of PROCEDURE/FUNCTION could not be followed by a name, while the PACKAGE had to be followed by a name, resulting in a significant amount of code migration by manual This resulted in a lot of rewriting when manually migrating the code.

MogDB 5.0.0 support PROCEDURE/FUNCTION/PACKAGE end after the name syntax and Oracle to maintain consistency with the object name can be used, can also be empty. CREATE PACKAGE body can be after the end of the package_name, can also be empty.

Syntax Description

PROCEDURE/FUNCTION/PACKAGE name after end to be consistent with Oracle

img

Because there are blocks, whether they are functions, procedures, packages, or anonymous blocks, this syntax description does not need to appear separately in the creation syntax of procedures and functions, but is described uniformly here, so it is all optional, and once it is there, it must be consistent with the name.

img

Example

-- Scenario 1, support for anonymous block end followed by no name
BEGIN
raise notice  'ok'
END;

-- Scenario 2, anonymous block end followed by name
BEGIN
raise notice 'ok'
END test;

-- Scenario 3, support stored procedure end after name inconsistency, check and report error
CREATE OR REPLACE PROCEDURE test_proc_end IS
BEGIN
raise notice '%','ok';
END test;

-- Scenario 4, support for stored procedures end followed by the correct name
CREATE OR REPLACE PROCEDURE test_proc_end IS 
BEGIN
raise notice '%','ok';
END test_proc_end;

-- Scenario 5, support for stored procedure end without name in package
CREATE OR REPLACE package test_pkg_end IS
PROCEDURE aa;
END;

-- Scenario 6, support for package bodyend followed by no name
CREATE OR REPLACE package body test_pkg_end IS
PROCEDURE aa IS
BEGIN 
raise notice 'ok';
END;
END;
Copyright © 2011-2024 www.enmotech.com All rights reserved.