Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ed19ed6a
Commit
ed19ed6a
authored
Aug 19, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10411 Providing compatibility for basic PL/SQL constructs
Part 16: CURSOR declaration
parent
6cd24d12
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
mysql-test/suite/compat/oracle/r/sp.result
mysql-test/suite/compat/oracle/r/sp.result
+21
-0
mysql-test/suite/compat/oracle/t/sp.test
mysql-test/suite/compat/oracle/t/sp.test
+24
-0
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+2
-2
No files found.
mysql-test/suite/compat/oracle/r/sp.result
View file @
ed19ed6a
...
...
@@ -656,3 +656,24 @@ SELECT f1() FROM DUAL;
f1()
5
DROP FUNCTION f1;
# Testing CURSOR declaration
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
CREATE FUNCTION f1 RETURN INT
AS
v_a INT:=10;
CURSOR c IS SELECT a FROM t1;
BEGIN
OPEN c;
FETCH c INTO v_a;
CLOSE c;
RETURN v_a;
EXCEPTION
WHEN OTHERS THEN RETURN -1;
END;
/
SELECT f1() FROM DUAL;
f1()
1
DROP FUNCTION f1;
DROP TABLE t1;
mysql-test/suite/compat/oracle/t/sp.test
View file @
ed19ed6a
...
...
@@ -711,3 +711,27 @@ END;
DELIMITER
;
/
SELECT
f1
()
FROM
DUAL
;
DROP
FUNCTION
f1
;
--
echo
# Testing CURSOR declaration
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
);
DELIMITER
/
;
CREATE
FUNCTION
f1
RETURN
INT
AS
v_a
INT
:=
10
;
CURSOR
c
IS
SELECT
a
FROM
t1
;
BEGIN
OPEN
c
;
FETCH
c
INTO
v_a
;
CLOSE
c
;
RETURN
v_a
;
EXCEPTION
WHEN
OTHERS
THEN
RETURN
-
1
;
END
;
/
DELIMITER
;
/
SELECT
f1
()
FROM
DUAL
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
sql/sql_yacc_ora.yy
View file @
ed19ed6a
...
...
@@ -2397,9 +2397,9 @@ sp_decl_body:
$$.vars= $$.conds= $$.curs= 0;
$$.hndlrs= 1;
}
|
ident_directly_assignable CURSOR_SYM FOR_SYM
sp_cursor_stmt
|
CURSOR_SYM ident_directly_assignable IS
sp_cursor_stmt
{
if (Lex->sp_declare_cursor(thd, $
1
, $4))
if (Lex->sp_declare_cursor(thd, $
2
, $4))
MYSQL_YYABORT;
$$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment