Details
-
Technical task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
When running with sql_mode=ORACLE, MariaDB should allow calling stored functions that have no parameters without having to type parentheses after the function name.
DROP FUNCTION f1; |
CREATE FUNCTION f1 RETURN INT |
AS
|
BEGIN
|
RETURN 10; |
END; |
/
|
SELECT f1 FROM DUAL; |
SELECT f1() FROM DUAL; |
Notice, the above two SELECT queries return the same result:
SQL>
|
F1
|
----------
|
10
|
 |
SQL>
|
F1()
|
----------
|
10
|
Name resolution will follow Oracle rules. For example, table columns shadow stored functions:
DROP FUNCTION f1; |
CREATE FUNCTION f1 RETURN VARCHAR |
AS
|
BEGIN
|
RETURN 10; |
END; |
/
|
DROP TABLE t1; |
CREATE TABLE t1 (f1 INT); |
INSERT INTO t1 VALUES (20); |
SELECT f1 FROM t1; |
SQL>
|
F1
|
----------
|
20
|
Notice, it returned the value of the column t1.f1 rather than the function f1.
Under terms of this task we'll also allow calling SP control functions SQLCODE and SQLERRM with empty parentheses:
DROP FUNCTION f1; |
CREATE FUNCTION f1 RETURN INT |
AS
|
BEGIN
|
EXECUTE IMMEDIATE 'xxx'; |
RETURN 0; |
EXCEPTION
|
WHEN OTHERS THEN RETURN SQLCODE(); |
END; |
/
|
SELECT f1 FROM DUAL; |
Attachments
Issue Links
- relates to
-
MDEV-10578 sql_mode=ORACLE: SP control functions SQLCODE, SQLERRM
- Closed
-
MDEV-11022 sql_mode=ORACLE: SQLERRM(errcode)
- Open