[MDEV-15715] sql_mode = Oracle with MariaDB 10.3.4 and Store procedure Created: 2018-03-29  Updated: 2018-04-30  Resolved: 2018-04-09

Status: Closed
Project: MariaDB Server
Component/s: Documentation, Stored routines
Affects Version/s: 10.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Aurélien LEQUOY Assignee: Alexander Barkov
Resolution: Duplicate Votes: 0
Labels: None

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

 Description   

Hello I tried short example to try compatibility of Oracle with MariaDB but it's not work :

sql_mode = Oracle

create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is 
l_Sum Number; 
l_Multiple Number; 
Begin For I in 1..12 Loop
 If mod(i,2) = 0 Then
 l_Multiple := 3;
 Else l_Multiple := 1;
 End If;
 l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple; End Loop; 
If Floor(l_Sum/10) - Mod(l_Sum, 10) = Substr(P_Str, 13) Then Return('TRUE');
Else Return('FALSE'); 
End If; 
End; /



 Comments   
Comment by Elena Stepanova [ 2018-04-06 ]

It appears to be a limitation of the current implementation. There is a separate task for support of IN/OUT for functions, it hasn't been done yet: MDEV-10654

bar, it probably needs to be documented somehow here.

Comment by Alexander Barkov [ 2018-04-09 ]

Correct, IN/OUT parameter data types are not supported yet in Functions.

After removing "IN", this script creates the function:

SET sql_mode=ORACLE;
DELIMITER $$
create or replace function ean_13(P_Str Varchar2) Return Varchar2 Is
  l_Sum Number; 
  l_Multiple Number; 
Begin
 For I in 1..12 Loop
   If mod(i,2) = 0 Then
     l_Multiple := 3;
   Else l_Multiple := 1;
   End If;
 l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple; End Loop; 
 If Floor(l_Sum/10) - Mod(l_Sum, 10) = Substr(P_Str, 13) Then Return('TRUE');
 Else Return('FALSE'); 
 End If; 
End;
$$
DELIMITER ;

Comment by Aurélien LEQUOY [ 2018-04-30 ]

i got a new error :

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

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