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
- duplicates
-
MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION
- Closed