Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
Create Functions
This part of the tutorial shows how to create functions that are used to develop the stored procedures.
Note
The SQL Editor only runs the queries that you select, so ensure you have them all selected before selecting Run.
Run the following SQL commands to create the user-defined functions (UDFs):
USE trades;DELIMITER //CREATE OR REPLACE FUNCTION marketcap_to_DECIMAL(s varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL) RETURNS decimal(18,2) NULL ASDECLAREm CHAR(1) = SUBSTR(s, LENGTH(s), 1);raw_v DECIMAL(18,2) = SUBSTR(s, 2, LENGTH(s) - 1);v DECIMAL(18,2) = NULL;BEGINIF m = "B" THENv = raw_v * 1000;ELSEv = raw_v;END IF;RETURN v;END //DELIMITER ;
Last modified: