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.
SingleStore Studio SQL Editor
On this page
Important
Studio is designed to work with MemSQL 6.
The SQL Editor page is a feature of Studio that allows customers to edit and run SQL queries against their SingleStore clusters.
The editor in this page works like a worksheet where users can type in multiple SQL queries and then choose which queries they want to run.
Creating and Running a Stored Procedure
In order to create a Stored Procedure in the SQL Editor, simply paste a regular CREATE PROCEDURE block into the editor:
DELIMITER //CREATE PROCEDURE charge_account(id BIGINT, amount DECIMAL(18,4)) ASDECLAREbalance_tbl QUERY(bal DECIMAL(18,4)) =SELECT remaining_balanceFROM account_balanceWHERE account_id = id;balance DECIMAL(18,4) = SCALAR(balance_tbl);updated_balance DECIMAL(18,4) = balance - amount;BEGINIF balance > amount THENUPDATE account_balanceSET remaining_balance = updated_balanceWHERE account_id = id;END IF;END //DELIMITER ;
Then, you can either select and execute the entire block or simply place the editor cursor anywhere in between the // delimiters and click Run.
Finally, running the stored procedure works like running any query.CALL charge_ into the SQL Editor and click Run.
Last modified: