[MDEV-17762] PL/SQL FUNCTION arguments with IN/OUT declaration fails Created: 2018-11-18  Updated: 2018-11-19  Resolved: 2018-11-19

Status: Closed
Project: MariaDB Server
Component/s: Parser, Server
Affects Version/s: 10.3.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Oli Sennhauser Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: argument, function, in, out, pl/sql
Environment:

Linux Ubuntu 14.04, n.a.


Issue Links:
Duplicate
duplicates MDEV-10654 IN, OUT, INOUT parameters in CREATE F... Closed

 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;
/


Generated at Thu Feb 08 08:38:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.