From f71a1f736df98507c56913cc7538926f265545ea Mon Sep 17 00:00:00 2001
From: Alexander Barkov <bar@mariadb.org>
Date: Mon, 8 Aug 2016 18:06:49 +0400
Subject: [PATCH] MDEV-10411 Providing compatibility for basic PL/SQL
 constructs

Part 4: AS/IS keyword before a function or a procedure body
---
 mysql-test/suite/compat/oracle/r/sp.result | 272 ++++++++++----------
 mysql-test/suite/compat/oracle/t/sp.test   | 278 +++++++++++----------
 sql/sql_yacc_ora.yy                        |   9 +-
 3 files changed, 286 insertions(+), 273 deletions(-)

diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result
index 31934f6698f..aa52cda9937 100644
--- a/mysql-test/suite/compat/oracle/r/sp.result
+++ b/mysql-test/suite/compat/oracle/r/sp.result
@@ -1,6 +1,6 @@
 SET sql_mode=ORACLE;
 # Testing labels
-CREATE FUNCTION f1 (a INT) RETURNS CLOB
+CREATE FUNCTION f1 (a INT) RETURNS CLOB AS
 BEGIN
 <<label1>>
 BEGIN
@@ -19,7 +19,7 @@ SELECT f1(2);
 f1(2)
 IS NOT 1
 DROP FUNCTION f1;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT IS
 BEGIN
 <<label1>>
 LOOP
@@ -35,7 +35,7 @@ SELECT f1(4);
 f1(4)
 2
 DROP FUNCTION f1;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT AS
 BEGIN
 <<label1>>
 WHILE a>0 DO
@@ -51,7 +51,7 @@ SELECT f1(4);
 f1(4)
 2
 DROP FUNCTION f1;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT AS
 BEGIN
 <<label1>>
 REPEAT
@@ -68,7 +68,7 @@ f1(4)
 2
 DROP FUNCTION f1;
 # Testing IN/OUT/INOUT
-CREATE PROCEDURE p1 (p1 IN VARCHAR2(10), p2 OUT VARCHAR2(10))
+CREATE PROCEDURE p1 (p1 IN VARCHAR2(10), p2 OUT VARCHAR2(10)) AS
 BEGIN
 SET p1='p1new';
 SET p2='p2new';
@@ -81,7 +81,7 @@ SELECT @p1, @p2;
 p1	p2new
 DROP PROCEDURE p1;
 # Testing Oracle-style assigment
-CREATE PROCEDURE p1 (p1 OUT VARCHAR2(10))
+CREATE PROCEDURE p1 (p1 OUT VARCHAR2(10)) AS
 BEGIN
 p1:= 'p1new';
 END;
@@ -93,138 +93,138 @@ SELECT @p1;
 p1new
 DROP PROCEDURE p1;
 # Testing that (some) keyword_sp are allowed in Oracle-style assignments
-CREATE PROCEDURE p1 (action OUT INT) action:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (clob OUT INT) clob:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (enum OUT INT) enum:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (via OUT INT) via:=10;
-DROP PROCEDURE p1;
+CREATE PROCEDURE p1 (action OUT INT) AS BEGIN action:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (clob OUT INT) AS BEGIN clob:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (enum OUT INT) AS BEGIN enum:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (via OUT INT) AS BEGIN via:=10; END;/
+DROP PROCEDURE p1/
 # Testing keyword_directly_assignable
-CREATE PROCEDURE p1 (ascii OUT INT) ascii:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (backup OUT INT) backup:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (binlog OUT INT) binlog:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (byte OUT INT) byte:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (cache OUT INT) cache:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (checksum OUT INT) checksum:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (checkpoint OUT INT) checkpoint:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_add OUT INT) column_add:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_check OUT INT) column_check:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_create OUT INT) column_create:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_delete OUT INT) column_delete:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_get OUT INT) column_get:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (commit OUT INT) commit:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (deallocate OUT INT) deallocate:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (examined OUT INT) examined:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (execute OUT INT) execute:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (flush OUT INT) flush:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (format OUT INT) format:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (get OUT INT) get:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (help OUT INT) help:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (host OUT INT) host:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (install OUT INT) install:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (option OUT INT) option:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (options OUT INT) options:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (owner OUT INT) owner:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (parser OUT INT) parser:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (port OUT INT) port:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (prepare OUT INT) prepare:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (remove OUT INT) remove:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (reset OUT INT) reset:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (restore OUT INT) restore:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (rollback OUT INT) rollback:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (security OUT INT) security:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (server OUT INT) server:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (shutdown OUT INT) shutdown:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (signed OUT INT) signed:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (socket OUT INT) socket:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (slave OUT INT) slave:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (slaves OUT INT) slaves:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (soname OUT INT) soname:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (start OUT INT) start:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (stop OUT INT) stop:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (stored OUT INT) stored:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (unicode OUT INT) unicode:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (uninstall OUT INT) uninstall:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (upgrade OUT INT) upgrade:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (wrapper OUT INT) wrapper:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (xa OUT INT) xa:=10;
-DROP PROCEDURE p1;
+CREATE PROCEDURE p1 (ascii OUT INT) AS BEGIN ascii:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (backup OUT INT) AS BEGIN backup:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (binlog OUT INT) AS BEGIN binlog:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (byte OUT INT) AS BEGIN byte:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (cache OUT INT) AS BEGIN cache:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (checksum OUT INT) AS BEGIN checksum:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (checkpoint OUT INT) AS BEGIN checkpoint:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_add OUT INT) AS BEGIN column_add:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_check OUT INT) AS BEGIN column_check:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_create OUT INT) AS BEGIN column_create:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_delete OUT INT) AS BEGIN column_delete:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_get OUT INT) AS BEGIN column_get:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (commit OUT INT) AS BEGIN commit:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (deallocate OUT INT) AS BEGIN deallocate:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (examined OUT INT) AS BEGIN examined:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (execute OUT INT) AS BEGIN execute:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (flush OUT INT) AS BEGIN flush:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (format OUT INT) AS BEGIN format:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (get OUT INT) AS BEGIN get:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (help OUT INT) AS BEGIN help:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (host OUT INT) AS BEGIN host:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (install OUT INT) AS BEGIN install:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (option OUT INT) AS BEGIN option:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (options OUT INT) AS BEGIN options:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (owner OUT INT) AS BEGIN owner:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (parser OUT INT) AS BEGIN parser:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (port OUT INT) AS BEGIN port:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (prepare OUT INT) AS BEGIN prepare:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (remove OUT INT) AS BEGIN remove:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (reset OUT INT) AS BEGIN reset:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (restore OUT INT) AS BEGIN restore:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (security OUT INT) AS BEGIN security:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (server OUT INT) AS BEGIN server:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (signed OUT INT) AS BEGIN signed:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (socket OUT INT) AS BEGIN socket:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (slave OUT INT) AS BEGIN slave:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (slaves OUT INT) AS BEGIN slaves:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (soname OUT INT) AS BEGIN soname:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (start OUT INT) AS BEGIN start:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (stop OUT INT) AS BEGIN stop:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (stored OUT INT) AS BEGIN stored:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (unicode OUT INT) AS BEGIN unicode:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (uninstall OUT INT) AS BEGIN uninstall:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (upgrade OUT INT) AS BEGIN upgrade:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (wrapper OUT INT) AS BEGIN wrapper:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (xa OUT INT) AS BEGIN xa:=10; END;/
+DROP PROCEDURE p1/
 # Testing that keyword_directly_not_assignable works in SET statements.
-CREATE PROCEDURE p1 (contains OUT INT) SET contains=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (language OUT INT) SET language=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (no OUT INT) SET no=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (charset OUT INT) SET charset=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (do OUT INT) SET do=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (repair OUT INT) SET repair=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (handler OUT INT) SET handler=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (open OUT INT) SET open=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (close OUT INT) SET close=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (savepoint OUT INT) SET savepoint=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (truncate OUT INT) SET truncate=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (begin OUT INT) SET begin=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (end OUT INT) SET end=10;
-DROP PROCEDURE p1;
+CREATE PROCEDURE p1 (contains OUT INT) AS BEGIN SET contains=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (language OUT INT) AS BEGIN SET language=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (no OUT INT) AS BEGIN SET no=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (charset OUT INT) AS BEGIN SET charset=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (do OUT INT) AS BEGIN SET do=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (repair OUT INT) AS BEGIN SET repair=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (handler OUT INT) AS BEGIN SET handler=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (open OUT INT) AS BEGIN SET open=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (close OUT INT) AS BEGIN SET close=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (savepoint OUT INT) AS BEGIN SET savepoint=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (truncate OUT INT) AS BEGIN SET truncate=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/
+DROP PROCEDURE p1/
 # Testing that keyword_directly_not_assignable works in table/column names
 CREATE TABLE contains (contains INT);
 DROP TABLE contains;
diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test
index c73e0da47a1..a6ea85d1f3e 100644
--- a/mysql-test/suite/compat/oracle/t/sp.test
+++ b/mysql-test/suite/compat/oracle/t/sp.test
@@ -3,7 +3,7 @@ SET sql_mode=ORACLE;
 --echo # Testing labels
 
 DELIMITER /;
-CREATE FUNCTION f1 (a INT) RETURNS CLOB
+CREATE FUNCTION f1 (a INT) RETURNS CLOB AS
 BEGIN
   <<label1>>
   BEGIN
@@ -22,7 +22,7 @@ DROP FUNCTION f1;
 
 
 DELIMITER /;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT IS
 BEGIN
   <<label1>>
   LOOP
@@ -40,7 +40,7 @@ DROP FUNCTION f1;
 
 
 DELIMITER /;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT AS
 BEGIN
   <<label1>>
   WHILE a>0 DO
@@ -58,7 +58,7 @@ DROP FUNCTION f1;
 
 
 DELIMITER /;
-CREATE FUNCTION f1 (a INT) RETURNS INT
+CREATE FUNCTION f1 (a INT) RETURNS INT AS
 BEGIN
   <<label1>>
   REPEAT
@@ -77,7 +77,7 @@ DROP FUNCTION f1;
 --echo # Testing IN/OUT/INOUT
 
 DELIMITER /;
-CREATE PROCEDURE p1 (p1 IN VARCHAR2(10), p2 OUT VARCHAR2(10))
+CREATE PROCEDURE p1 (p1 IN VARCHAR2(10), p2 OUT VARCHAR2(10)) AS
 BEGIN
   SET p1='p1new';
   SET p2='p2new';
@@ -91,7 +91,7 @@ DROP PROCEDURE p1;
 
 --echo # Testing Oracle-style assigment
 DELIMITER /;
-CREATE PROCEDURE p1 (p1 OUT VARCHAR2(10))
+CREATE PROCEDURE p1 (p1 OUT VARCHAR2(10)) AS
 BEGIN
   p1:= 'p1new';
 END;
@@ -103,141 +103,147 @@ SELECT @p1;
 DROP PROCEDURE p1;
 
 --echo # Testing that (some) keyword_sp are allowed in Oracle-style assignments
-CREATE PROCEDURE p1 (action OUT INT) action:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (clob OUT INT) clob:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (enum OUT INT) enum:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (via OUT INT) via:=10;
-DROP PROCEDURE p1;
+DELIMITER /;
+CREATE PROCEDURE p1 (action OUT INT) AS BEGIN action:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (clob OUT INT) AS BEGIN clob:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (enum OUT INT) AS BEGIN enum:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (via OUT INT) AS BEGIN via:=10; END;/
+DROP PROCEDURE p1/
+DELIMITER ;/
 
 --echo # Testing keyword_directly_assignable
-CREATE PROCEDURE p1 (ascii OUT INT) ascii:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (backup OUT INT) backup:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (binlog OUT INT) binlog:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (byte OUT INT) byte:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (cache OUT INT) cache:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (checksum OUT INT) checksum:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (checkpoint OUT INT) checkpoint:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_add OUT INT) column_add:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_check OUT INT) column_check:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_create OUT INT) column_create:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_delete OUT INT) column_delete:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (column_get OUT INT) column_get:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (commit OUT INT) commit:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (deallocate OUT INT) deallocate:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (examined OUT INT) examined:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (execute OUT INT) execute:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (flush OUT INT) flush:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (format OUT INT) format:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (get OUT INT) get:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (help OUT INT) help:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (host OUT INT) host:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (install OUT INT) install:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (option OUT INT) option:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (options OUT INT) options:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (owner OUT INT) owner:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (parser OUT INT) parser:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (port OUT INT) port:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (prepare OUT INT) prepare:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (remove OUT INT) remove:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (reset OUT INT) reset:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (restore OUT INT) restore:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (rollback OUT INT) rollback:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (security OUT INT) security:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (server OUT INT) server:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (shutdown OUT INT) shutdown:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (signed OUT INT) signed:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (socket OUT INT) socket:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (slave OUT INT) slave:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (slaves OUT INT) slaves:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (soname OUT INT) soname:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (start OUT INT) start:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (stop OUT INT) stop:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (stored OUT INT) stored:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (unicode OUT INT) unicode:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (uninstall OUT INT) uninstall:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (upgrade OUT INT) upgrade:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (wrapper OUT INT) wrapper:=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (xa OUT INT) xa:=10;
-DROP PROCEDURE p1;
+DELIMITER /;
+CREATE PROCEDURE p1 (ascii OUT INT) AS BEGIN ascii:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (backup OUT INT) AS BEGIN backup:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (binlog OUT INT) AS BEGIN binlog:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (byte OUT INT) AS BEGIN byte:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (cache OUT INT) AS BEGIN cache:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (checksum OUT INT) AS BEGIN checksum:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (checkpoint OUT INT) AS BEGIN checkpoint:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_add OUT INT) AS BEGIN column_add:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_check OUT INT) AS BEGIN column_check:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_create OUT INT) AS BEGIN column_create:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_delete OUT INT) AS BEGIN column_delete:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (column_get OUT INT) AS BEGIN column_get:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (commit OUT INT) AS BEGIN commit:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (deallocate OUT INT) AS BEGIN deallocate:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (examined OUT INT) AS BEGIN examined:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (execute OUT INT) AS BEGIN execute:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (flush OUT INT) AS BEGIN flush:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (format OUT INT) AS BEGIN format:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (get OUT INT) AS BEGIN get:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (help OUT INT) AS BEGIN help:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (host OUT INT) AS BEGIN host:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (install OUT INT) AS BEGIN install:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (option OUT INT) AS BEGIN option:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (options OUT INT) AS BEGIN options:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (owner OUT INT) AS BEGIN owner:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (parser OUT INT) AS BEGIN parser:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (port OUT INT) AS BEGIN port:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (prepare OUT INT) AS BEGIN prepare:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (remove OUT INT) AS BEGIN remove:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (reset OUT INT) AS BEGIN reset:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (restore OUT INT) AS BEGIN restore:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (security OUT INT) AS BEGIN security:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (server OUT INT) AS BEGIN server:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (signed OUT INT) AS BEGIN signed:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (socket OUT INT) AS BEGIN socket:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (slave OUT INT) AS BEGIN slave:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (slaves OUT INT) AS BEGIN slaves:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (soname OUT INT) AS BEGIN soname:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (start OUT INT) AS BEGIN start:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (stop OUT INT) AS BEGIN stop:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (stored OUT INT) AS BEGIN stored:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (unicode OUT INT) AS BEGIN unicode:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (uninstall OUT INT) AS BEGIN uninstall:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (upgrade OUT INT) AS BEGIN upgrade:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (wrapper OUT INT) AS BEGIN wrapper:=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (xa OUT INT) AS BEGIN xa:=10; END;/
+DROP PROCEDURE p1/
+DELIMITER ;/
 
 
 --echo # Testing that keyword_directly_not_assignable works in SET statements.
-CREATE PROCEDURE p1 (contains OUT INT) SET contains=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (language OUT INT) SET language=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (no OUT INT) SET no=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (charset OUT INT) SET charset=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (do OUT INT) SET do=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (repair OUT INT) SET repair=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (handler OUT INT) SET handler=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (open OUT INT) SET open=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (close OUT INT) SET close=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (savepoint OUT INT) SET savepoint=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (truncate OUT INT) SET truncate=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (begin OUT INT) SET begin=10;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1 (end OUT INT) SET end=10;
-DROP PROCEDURE p1;
+DELIMITER /;
+CREATE PROCEDURE p1 (contains OUT INT) AS BEGIN SET contains=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (language OUT INT) AS BEGIN SET language=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (no OUT INT) AS BEGIN SET no=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (charset OUT INT) AS BEGIN SET charset=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (do OUT INT) AS BEGIN SET do=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (repair OUT INT) AS BEGIN SET repair=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (handler OUT INT) AS BEGIN SET handler=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (open OUT INT) AS BEGIN SET open=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (close OUT INT) AS BEGIN SET close=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (savepoint OUT INT) AS BEGIN SET savepoint=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (truncate OUT INT) AS BEGIN SET truncate=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/
+DROP PROCEDURE p1/
+CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/
+DROP PROCEDURE p1/
+DELIMITER ;/
 
 --echo # Testing that keyword_directly_not_assignable works in table/column names
 CREATE TABLE contains (contains INT);
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 3766a650fc0..5fee7673b86 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -16131,7 +16131,8 @@ sf_tail:
 
             lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
           }
-          sp_proc_stmt_in_returns_clause /* $15 */
+          sp_tail_is /* $15 */
+          sp_proc_stmt_in_returns_clause /* $16 */
           {
             LEX *lex= thd->lex;
             sp_head *sp= lex->sphead;
@@ -16179,6 +16180,7 @@ sp_tail:
           {
             Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
           }
+          sp_tail_is
           sp_proc_stmt
           {
             LEX *lex= Lex;
@@ -16190,6 +16192,11 @@ sp_tail:
           }
         ;
 
+sp_tail_is:
+          IS
+        | AS
+        ;
+
 /*************************************************************************/
 
 xa: