I have a Problem with my SQL Syntax, I need your help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a Problem with my SQL Syntax, I need your help.

I'm having problems with my SQL Syntax, particularly on Stored Functions/ Stored Procedures. Because instead of the Syntax: DELIMITER $ CREATE FUNCTION function_name( param1, param2,… ) RETURNS datatype [NOT] DETERMINISTIC BEGIN -- statements END $ DELIMITER ; It outputs a syntax error. But when I change it into: CREATE FUNCTION function_name( param1, param2,… ) RETURNS datatype DETERMINISTIC -- statements It works. But only that It shows a syntax error when I try to turn deterministic into non deterministic, and also when I do other things like declaring a variable, it also shows an error. What I can only do is make a computation by the following syntax: return(formula); The same issue for a stored Procedure I tried different ways to fix this. I tried changing the // into ; , tried removing the delimiter, etc but did not work. My theory is that I messed up during the installation process or something, but it's obviously not. Ps. Already studied SQL, just not in sololearn

13th May 2021, 1:28 AM
Jayk Anul
Jayk Anul - avatar
1 Answer
+ 1
I just get a thought that maybe we don't need to wrap the NOT in square brackets as you wrote [NOT] in first sample. I assume the [] around the NOT were a syntax emphasization to inform that the NOT is an optional statement.
20th May 2021, 1:24 AM
Ipang