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

PL/SQL FUNCTION arguments with IN/OUT declaration fails

    Details

      Description

      According to Oracle documentation:
      https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5009.htm

      This CREATE FUNCTION should work:

      CREATE FUNCTION get_bal(acc_no IN NUMBER) 
         RETURN NUMBER 
         IS acc_bal NUMBER(11,2);
         BEGIN 
            SELECT order_total 
            INTO acc_bal 
            FROM orders 
            WHERE customer_id = acc_no; 
            RETURN(acc_bal); 
          END;
      /
      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 'IN NUMBER)
      

      If you omit the IN it works:

      CREATE FUNCTION get_bal(acc_no NUMBER) 
         RETURN NUMBER 
         IS acc_bal NUMBER(11,2);
         BEGIN 
            SELECT order_total 
            INTO acc_bal 
            FROM orders 
            WHERE customer_id = acc_no; 
            RETURN(acc_bal); 
          END;
      /
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                oli Oli Sennhauser
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: