Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15830

Assorted notes on sql_mode=ORACLE documentation

    XMLWordPrintable

    Details

      Description

      https://mariadb.com/kb/en/library/sql_modeoracle-from-mariadb-103/

      If function has no parameters then parentheses must be omitted

      In fact, it works just fine either way:

      MariaDB [test]> delimiter $$
      MariaDB [test]> set sql_mode=ORACLE $$
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> CREATE OR REPLACE FUNCTION f1() RETURN NUMBER IS BEGIN RETURN 1; END $$
      Query OK, 0 rows affected (0.02 sec)
       
      MariaDB [test]> delimiter ;
      


      RETURN. Can also be used in stored procedures

      Need an example, I can't make it work

      MariaDB [test]> SET sql_mode=ORACLE $$
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> CREATE OR REPLACE PROCEDURE p1 RETURN NUMBER AS BEGIN NULL; END $$
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RETURN NUMBER AS BEGIN NULL; END' at line 1
      


      CREATE PROCEDURE p1 AS rec IN (SELECT a, b FROM t1)

      Apparently, it implies

      CREATE PROCEDURE p1 AS BEGIN FOR rec IN (SELECT a, b FROM t1) LOOP SELECT 1; END LOOP; END
      

      but it's hard to guess


      https://mariadb.com/kb/en/library/sql-mode/

      lists sql_modes which are set if one uses ORACLE. It doesn't mention SIMULTANEOUS_ASSIGNMENT, but it is also set


        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration