MySQL Client Delimiters

Redefines the MySQL delimiter.

Syntax

DELIMITER delimiter_symbol

Remarks

When creating a function or a procedure using a MySQL-compatible client connected to SingleStore, you must change the client delimiter to ensure that the function or procedure definition is correctly passed to the server as a single statement. By default, all MySQL clients use a semicolon (;) as a statement delimiter. A problem arises when creating functions or procedures because they use semicolons as statement delimiters within the function body. Therefore, you must change the delimiter setting before creating your function or procedure, and then set it back to a semicolon after the alternate delimiter is no longer needed.

The DELIMITER commands must be on independent lines. These lines are interpreted by the client, not the server. When creating stored procedures or functions from your own client application created in a language such as Java, C++, or Python, the delimiters are not needed.

To change the MySQL delimiter, execute the following command before creating a new function or procedure:

DELIMITER //

When you’ve finished defining functions or procedures, make sure to change the MySQL delimiter back to a semicolon:

DELIMITER ;

Example

The function below uses the delimiter //, which can be executed directly in a MySQL-compatible client connected to SingleStore:

DELIMITER //
CREATE FUNCTION plus_one(a INT) RETURNS INT AS
DECLARE
b INT = a;
BEGIN
b += 1;
RETURN b;
END //
DELIMITER ;

All SingleStore Procedural SQL (PSQL) topics include this MySQL delimiter consideration.

Last modified: November 27, 2024

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK