S
S
StrangeAttractor2014-09-29 16:53:19
MySQL
StrangeAttractor, 2014-09-29 16:53:19

How to use semicolons correctly when writing custom functions in MySQL?

Take, for example, this simple function:

CREATE FUNCTION MyFx(`MyArg` VARCHAR(255)) RETURNS VARCHAR(255)
  DETERMINISTIC
BEGIN
  RETURN (SELECT `val` FROM `table` WHERE `arg` = `MyArg`);
END

Works but looks ugly. How to arrange; to a strict standard?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Chistyakov, 2014-09-29
@StrangeAttractor

Is there a strict standard for procedural extensions of the SQL language? O___O And for a long time? I missed something...
Why do you want to use procedural SQL? This is the dark side of the Force, think twice - is it worth it?
Total:
In the procedure body, a delimiter is placed after each expression.
The rest of the declaration of the procedure is written according to BNF .
An example is here .
In order to use the separator in the body of the procedure, it is replaced when defining the procedure, how to do this is shown in the examples at the link.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question