HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Support Synonym Calls Without Parentheses For Function Without Parameters

Availability

This feature is available since MogDB 5.0.0.

Introduction

This feature supports parameterless FUNCTION to be called normally without parentheses after creating a synonym.

Benefits

Enhance MogDB compatibility with Oracle to reduce application migration costs.

Example

DROP SCHEMA IF EXISTS stone;
NOTICE:  SCHEMA "stone" does NOT exist, skipping
CREATE SCHEMA stone;
CREATE OR REPLACE FUNCTION stone.f_test RETURN number AS
BEGIN
  RETURN 1;
END;
/
DROP synonym IF EXISTS syn_f_test;
NOTICE:  synonym "syn_f_test" does NOT exist, skipping
CREATE synonym syn_f_test FOR stone.f_test;
-- Calling a function directly is normal
SELECT stone.f_test;
 f_test 
--------
      1
(1 row)

-- Using synonym with parentheses is correct
SELECT syn_f_test();
 syn_f_test 
------------
          1
(1 row)

-- Using synonym without parentheses works fine.
SELECT syn_f_test;
 syn_f_test 
------------
          1
(1 row)
Copyright © 2011-2024 www.enmotech.com All rights reserved.