Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 11.8
-
None
Description
This script return a syntax error near 'CURSOR cur IS...':
SET sql_mode=ORACLE; |
DROP PACKAGE pkg; |
DELIMITER /
|
CREATE PACKAGE pkg AS |
FUNCTION f1 RETURN INT; |
END; |
/
|
CREATE PACKAGE BODY pkg AS |
vc INT := 0; |
CURSOR cur IS SELECT 1 AS c FROM DUAL; -- Error is raised incorectly |
FUNCTION f1 RETURN INT AS |
BEGIN |
OPEN cur; |
FETCH cur INTO vc; |
CLOSE cur; |
RETURN vc; |
END; |
END; |
/
|
DELIMITER ;
|
SELECT pkg.f1() FROM DUAL; |
ERROR 1064 (42000): You have an error in your SQL syntax; ... 'CURSOR cur IS SELECT 1 AS c FROM DUAL..';
|
If I run a similar script in Oracle, it works fine and returns "1" as expected:
DROP PACKAGE pkg; |
CREATE PACKAGE pkg AS |
FUNCTION f1 RETURN INT; |
END; |
/
|
CREATE PACKAGE BODY pkg AS |
vc INT := 0; |
CURSOR cur IS SELECT 1 AS c FROM DUAL; |
FUNCTION f1 RETURN INT AS |
BEGIN |
OPEN cur; |
FETCH cur INTO vc; |
CLOSE cur; |
RETURN vc; |
END; |
END; |
/
|
SELECT pkg.f1() FROM DUAL; |
PKG.F1()
|
1
|
Attachments
Issue Links
- is duplicated by
-
MDEV-36081 CURSOR is not allowed in the top level block in PACKAGE BODY
-
- Closed
-
- relates to
-
MDEV-10152 Add support for TYPE .. IS REF CURSOR
-
- Open
-
-
MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR
-
- In Testing
-
-
MDEV-36047 Package body variables are not allowed as FETCH targets
-
- Closed
-
-
MDEV-13139 CREATE PACKAGE: package-wide declarations
-
- Stalled
-