# Procedural SQL

**URL:** https://www.singlestore.com/forum/c/support/procedural-sql/24.md

[Latest](https://www.singlestore.com/forum/latest.md) · [Categories](https://www.singlestore.com/forum/categories.md) · [Tags](https://www.singlestore.com/forum/tags.md)

---

## [STRING\_SPLIT and CROSS APPLY](https://www.singlestore.com/forum/t/string-split-and-cross-apply/4792)

<div class="topic-metadata">

**Author:** [@tamara.b](https://www.singlestore.com/forum/u/tamara.b)\
**Replies:** 7\
**Last updated:** [November 21, 2025, 1:08am UTC](https://www.singlestore.com/forum/t/string-split-and-cross-apply/4792 "2025-11-21T01:08:55Z")

</div>

I’m looking for a way to do this in SingleStore: I have a column with coma separated string that I need to split to different rows and the join to the table as a new column sql server script: SELECT id, …

---

## [Output Parameter support in Stored Procedure](https://www.singlestore.com/forum/t/output-parameter-support-in-stored-procedure/8161)

<div class="topic-metadata">

**Author:** [@askids](https://www.singlestore.com/forum/u/askids)\
**Replies:** 3\
**Last updated:** [March 25, 2025, 1:24am UTC](https://www.singlestore.com/forum/t/output-parameter-support-in-stored-procedure/8161 "2025-03-25T01:24:53Z")

</div>

hi, Is there any plan to support Out and InOut parameters in Singlestore stored procedures? We are assessing use of Singlestore DB for replacing multiple existing applications using DB2 and Oracle, which has thousands o…

---

## [SELECT statement or scalar in UDFs](https://www.singlestore.com/forum/t/select-statement-or-scalar-in-udfs/8075)

<div class="topic-metadata">

**Author:** [@edson.moretti](https://www.singlestore.com/forum/u/edson.moretti)\
**Replies:** 1\
**Last updated:** [January 13, 2025, 10:02pm UTC](https://www.singlestore.com/forum/t/select-statement-or-scalar-in-udfs/8075 "2025-01-13T22:02:55Z")

</div>

Hello, We are trying to create a simple function to handle currency conversion. We have a table that stores the currency conversion rates and all I wanted to do is a scalar function that takes the two currency codes and…

---

## [Renaming table within transaction and keeping in-sync during swap](https://www.singlestore.com/forum/t/renaming-table-within-transaction-and-keeping-in-sync-during-swap/2027)

<div class="topic-metadata">

**Author:** [@MGRAHAM](https://www.singlestore.com/forum/u/MGRAHAM)\
**Replies:** 2\
**Last updated:** [November 16, 2024, 1:13am UTC](https://www.singlestore.com/forum/t/renaming-table-within-transaction-and-keeping-in-sync-during-swap/2027 "2024-11-16T01:13:01Z")

</div>

I understand that MemSQL allows online alter table statements. But, in situations where the best course of action is to create a new table and swap them out, what is possible? My normal pattern for doing such a switch wo…

---

## [Code Quality Check using SonarQube or other tool](https://www.singlestore.com/forum/t/code-quality-check-using-sonarqube-or-other-tool/7693)

<div class="topic-metadata">

**Author:** [@vasanth.ramu](https://www.singlestore.com/forum/u/vasanth.ramu)\
**Replies:** 0\
**Last updated:** [May 14, 2024, 10:29am UTC](https://www.singlestore.com/forum/t/code-quality-check-using-sonarqube-or-other-tool/7693 "2024-05-14T10:29:34Z")

</div>

We are using CICD deployments from Dev to SIT and Prod. We are having tools like SonarQube. Is there any plugin or any tool for SingleStore using which we can do automated code quality check and score. We are now manual…

---

## [The operating system failed to allocate memory -alma linux](https://www.singlestore.com/forum/t/the-operating-system-failed-to-allocate-memory-alma-linux/7113)

<div class="topic-metadata">

**Author:** [@Johanna\_Rosero](https://www.singlestore.com/forum/u/Johanna_Rosero)\
**Replies:** 4\
**Last updated:** [May 13, 2024, 5:06am UTC](https://www.singlestore.com/forum/t/the-operating-system-failed-to-allocate-memory-alma-linux/7113 "2024-05-13T05:06:49Z")

</div>

line 34: ER\_MEMSQL\_OOM (1712), Leaf Error (127.0.0.1:3307): The operating system failed to allocate memory (MemSQL memory use 18658.88 Mb). The request was not processed. See Memory Errors · SingleStore Documentation for…

---

## [What is the max length of JSON input parameter in the Stored Procedure](https://www.singlestore.com/forum/t/what-is-the-max-length-of-json-input-parameter-in-the-stored-procedure/2861)

<div class="topic-metadata">

**Author:** [@pkodavoo](https://www.singlestore.com/forum/u/pkodavoo)\
**Replies:** 7\
**Last updated:** [April 2, 2024, 5:46am UTC](https://www.singlestore.com/forum/t/what-is-the-max-length-of-json-input-parameter-in-the-stored-procedure/2861 "2024-04-02T05:46:51Z")

</div>

I see in the documentation, it is mentioned JSON size can go up to 100MB that is the default value of max\_allowed\_packet. However, I see Long Data not supported error when I pass a JSON of size more than 3MB to the SP. …

---

## [Waiting for metadata lock on 'table', when running insert/ when duplicate update](https://www.singlestore.com/forum/t/waiting-for-metadata-lock-on-table-when-running-insert-when-duplicate-update/7481)

<div class="topic-metadata">

**Author:** [@moralez.rodrigo](https://www.singlestore.com/forum/u/moralez.rodrigo)\
**Replies:** 7\
**Last updated:** [February 27, 2024, 12:44am UTC](https://www.singlestore.com/forum/t/waiting-for-metadata-lock-on-table-when-running-insert-when-duplicate-update/7481 "2024-02-27T00:44:32Z")

</div>

We are running an insert/when duplicate update over a rowstore table, it has in total 2M rows. We tried updating into batches of 100k, 10k, 4k, 1k (with start transaction as well), for all the cases it reaches a point on…

---

## [Getting access to Named Stored Procedure Query Data Type Return Value](https://www.singlestore.com/forum/t/getting-access-to-named-stored-procedure-query-data-type-return-value/7339)

<div class="topic-metadata">

**Author:** [@jc\_mtlstatic](https://www.singlestore.com/forum/u/jc_mtlstatic)\
**Replies:** 3\
**Last updated:** [November 29, 2023, 4:18pm UTC](https://www.singlestore.com/forum/t/getting-access-to-named-stored-procedure-query-data-type-return-value/7339 "2023-11-29T16:18:44Z")

</div>

My Spring Boot Java application consumes a SingleStore Named Stored Procedure using MariaDB JDBC driver( I have also observed the same behavior with the SingleStore jdbc driver as well). The NSP has an json input and pro…

---

## [SELECT in PL expressions' is not supported by MemSQL](https://www.singlestore.com/forum/t/select-in-pl-expressions-is-not-supported-by-memsql/7271)

<div class="topic-metadata">

**Author:** [@sindri](https://www.singlestore.com/forum/u/sindri)\
**Replies:** 5\
**Last updated:** [November 6, 2023, 9:13am UTC](https://www.singlestore.com/forum/t/select-in-pl-expressions-is-not-supported-by-memsql/7271 "2023-11-06T09:13:07Z")

</div>

Hi, I am trying to do something similar to this here: delimiter // do begin if not exists (select 1 from module where moduleid = 1) then select 1 as ok; end if; end // delimiter ; and it gives me the following…

---

## [Table() function with array variable not working](https://www.singlestore.com/forum/t/table-function-with-array-variable-not-working/6631)

<div class="topic-metadata">

**Author:** [@j.sathishmdu](https://www.singlestore.com/forum/u/j.sathishmdu)\
**Replies:** 13\
**Last updated:** [October 23, 2023, 10:52pm UTC](https://www.singlestore.com/forum/t/table-function-with-array-variable-not-working/6631 "2023-10-23T22:52:57Z")

</div>

My below code is giving an error. I know this date generation can be done using recursive CTE, but my use case prevents the use of recursive CTE. So could someone please help me convert array variable into table. DELIM…

---

## [Exception handling](https://www.singlestore.com/forum/t/exception-handling/1757)

<div class="topic-metadata">

**Author:** [@mohankonkala](https://www.singlestore.com/forum/u/mohankonkala)\
**Replies:** 7\
**Last updated:** [September 27, 2023, 11:16pm UTC](https://www.singlestore.com/forum/t/exception-handling/1757 "2023-09-27T23:16:17Z")

</div>

Can we use exception more than once in one stored procedure??

---

## [Parsing Nested array within a nested array](https://www.singlestore.com/forum/t/parsing-nested-array-within-a-nested-array/7088)

<div class="topic-metadata">

**Author:** [@himawari](https://www.singlestore.com/forum/u/himawari)\
**Replies:** 7\
**Last updated:** [August 24, 2023, 6:31am UTC](https://www.singlestore.com/forum/t/parsing-nested-array-within-a-nested-array/7088 "2023-08-24T06:31:48Z")

</div>

I have the below Avro. which has a nested array(attachment) and also a nested array within a nested array( charactersticsRelationship inside characterstic). { “doc”: “Sample schema to help you get started.”, “fields”:…

---

## [Check if a string ISNUMERIC()?](https://www.singlestore.com/forum/t/check-if-a-string-isnumeric/2551)

<div class="topic-metadata">

**Author:** [@mazhar001](https://www.singlestore.com/forum/u/mazhar001)\
**Replies:** 3\
**Last updated:** [August 5, 2023, 6:53pm UTC](https://www.singlestore.com/forum/t/check-if-a-string-isnumeric/2551 "2023-08-05T18:53:47Z")

</div>

There is an inbuilt function ISNUMERIC() in SQL Server which checks and returns TRUE if the string has “only digits” (so it is a number) otherwise FALSE. Do we have a similar function in singlestore (memsql)? Thanks Az…

---

## [DEDUPLICATION in Rowstore Tables](https://www.singlestore.com/forum/t/deduplication-in-rowstore-tables/1750)

<div class="topic-metadata">

**Author:** [@pkodavoo](https://www.singlestore.com/forum/u/pkodavoo)\
**Replies:** 1\
**Last updated:** [July 13, 2023, 1:01am UTC](https://www.singlestore.com/forum/t/deduplication-in-rowstore-tables/1750 "2023-07-13T01:01:42Z")

</div>

Hi Team, I am trying to implement deduplication on a rowstore table. Requirement: If a insert happens twice on same day for same user id, username value should be updated. MemSQL throws error when I use a WHERE clause…

---

## [Stored Procedure Unable to Execute With Variable Table Name](https://www.singlestore.com/forum/t/stored-procedure-unable-to-execute-with-variable-table-name/6959)

<div class="topic-metadata">

**Author:** [@swateek](https://www.singlestore.com/forum/u/swateek)\
**Replies:** 2\
**Last updated:** [July 10, 2023, 4:31am UTC](https://www.singlestore.com/forum/t/stored-procedure-unable-to-execute-with-variable-table-name/6959 "2023-07-10T04:31:38Z")

</div>

I am trying to get the count of rows into a variable, withing a stored procedure… the below one WORKS: DELIMITER // CREATE OR REPLACE PROCEDURE tmp\_into\_var () AS DECLARE row\_c INT; qry VARCHAR(50); BEGIN qry = "SEL…

---

## [Copy SP output into Temp table](https://www.singlestore.com/forum/t/copy-sp-output-into-temp-table/2571)

<div class="topic-metadata">

**Author:** [@Maney73](https://www.singlestore.com/forum/u/Maney73)\
**Replies:** 9\
**Last updated:** [May 22, 2023, 2:27am UTC](https://www.singlestore.com/forum/t/copy-sp-output-into-temp-table/2571 "2023-05-22T02:27:01Z")

</div>

Hi Guys, Is it possible to store the SP result into a table? Let me know your thoughts. e.g. INSERT INTO tmptable(Id) CALL (101);

---

## [Not able to drop default constraint of a table column](https://www.singlestore.com/forum/t/not-able-to-drop-default-constraint-of-a-table-column/6671)

<div class="topic-metadata">

**Author:** [@vivek.kedar](https://www.singlestore.com/forum/u/vivek.kedar)\
**Replies:** 1\
**Last updated:** [April 10, 2023, 6:07pm UTC](https://www.singlestore.com/forum/t/not-able-to-drop-default-constraint-of-a-table-column/6671 "2023-04-10T18:07:45Z")

</div>

“ALTER TABLE tablename ALTER COLUMN columnname datatype DROP DEFAULT” is not working on a singlestore table. I just want to drop the default constraint on the table column I cannot use the work around of dropping a co…

---

## [GRANT with wildcard](https://www.singlestore.com/forum/t/grant-with-wildcard/3170)

<div class="topic-metadata">

**Author:** [@pierre](https://www.singlestore.com/forum/u/pierre)\
**Replies:** 4\
**Last updated:** [March 30, 2023, 10:28pm UTC](https://www.singlestore.com/forum/t/grant-with-wildcard/3170 "2023-03-30T22:28:15Z")

</div>

Hi guys, I need to GRANT user access to some databases that contain a certain prefix, but I noticed that the wildcard doesn’t work: GRANT SELECT ON xxx\_%.\* TO ‘user\_xxx’@’%’; FLUSH PRIVILEGES; New databases are added r…

---

## [UDAF: What is state type used for?](https://www.singlestore.com/forum/t/udaf-what-is-state-type-used-for/6613)

<div class="topic-metadata">

**Author:** [@michal.kyjovsky](https://www.singlestore.com/forum/u/michal.kyjovsky)\
**Replies:** 1\
**Last updated:** [March 14, 2023, 8:15pm UTC](https://www.singlestore.com/forum/t/udaf-what-is-state-type-used-for/6613 "2023-03-14T20:15:55Z")

</div>

Hello community, I am reading the documentation on the UDAF topic and struggling to understand the state type used. It is being referenced throughout the documentation and is always referenced by the following string T…

---

## [Select into s3 NULL specification](https://www.singlestore.com/forum/t/select-into-s3-null-specification/2535)

<div class="topic-metadata">

**Author:** [@csparrow](https://www.singlestore.com/forum/u/csparrow)\
**Replies:** 3\
**Last updated:** [March 14, 2023, 2:38pm UTC](https://www.singlestore.com/forum/t/select-into-s3-null-specification/2535 "2023-03-14T14:38:56Z")

</div>

I am using the select into s3 functionality. Some fields are being exported as ‘\\N’. These are null fields. Is there a way to control the representation of NULLs when exporting? Ideally report nothing between the delimit…

---

## [Splitting a Column of JSON Data and then Cross Apply](https://www.singlestore.com/forum/t/splitting-a-column-of-json-data-and-then-cross-apply/6180)

<div class="topic-metadata">

**Author:** [@rishi.rakshit](https://www.singlestore.com/forum/u/rishi.rakshit)\
**Replies:** 1\
**Last updated:** [March 1, 2023, 5:55pm UTC](https://www.singlestore.com/forum/t/splitting-a-column-of-json-data-and-then-cross-apply/6180 "2023-03-01T17:55:53Z")

</div>

How to turn this: To This:

---

## [Echo Statement in the SP when no rows returned](https://www.singlestore.com/forum/t/echo-statement-in-the-sp-when-no-rows-returned/6392)

<div class="topic-metadata">

**Author:** [@prathap\_26](https://www.singlestore.com/forum/u/prathap_26)\
**Replies:** 5\
**Last updated:** [February 23, 2023, 1:19am UTC](https://www.singlestore.com/forum/t/echo-statement-in-the-sp-when-no-rows-returned/6392 "2023-02-23T01:19:50Z")

</div>

Hi Hanson, Since there is problem with distributed joins (where shard key columns are different), how we are doing is extract the result set from driving table and then in the loop we are using the extracted result set …

---

## [Stored Proc Bug between SSDB Cloud and SSDB CIAB](https://www.singlestore.com/forum/t/stored-proc-bug-between-ssdb-cloud-and-ssdb-ciab/6301)

<div class="topic-metadata">

**Author:** [@DataSleek](https://www.singlestore.com/forum/u/DataSleek)\
**Replies:** 1\
**Last updated:** [December 7, 2022, 4:51pm UTC](https://www.singlestore.com/forum/t/stored-proc-bug-between-ssdb-cloud-and-ssdb-ciab/6301 "2022-12-07T16:51:18Z")

</div>

I created a stored procedure that use an array from a SQL query and execute in a loop a dynamic query. The stored Proc works on the Cloud SSDB (vs 7.6.22) and not on SSDB Cluster In a Box (vs. 7.8.17 ) \> \> -- Cloud \> …

---

## [Show errors using in procedure](https://www.singlestore.com/forum/t/show-errors-using-in-procedure/6284)

<div class="topic-metadata">

**Author:** [@prathap\_26](https://www.singlestore.com/forum/u/prathap_26)\
**Replies:** 1\
**Last updated:** [December 6, 2022, 1:42pm UTC](https://www.singlestore.com/forum/t/show-errors-using-in-procedure/6284 "2022-12-06T13:42:37Z")

</div>

Dear Team, In the procedure while performing exception handling we need to capture the information that has been returned by the SHOW ERRORS command @the runtime. Show errors results : LEVEL, CODE and MESSAGE. Appreci…

---

## [Do we have mysql equivalent FIND\_IN\_SET in singlestore?](https://www.singlestore.com/forum/t/do-we-have-mysql-equivalent-find-in-set-in-singlestore/4329)

<div class="topic-metadata">

**Author:** [@ganesh.usi.gk](https://www.singlestore.com/forum/u/ganesh.usi.gk)\
**Replies:** 5\
**Last updated:** [November 22, 2022, 11:58pm UTC](https://www.singlestore.com/forum/t/do-we-have-mysql-equivalent-find-in-set-in-singlestore/4329 "2022-11-22T23:58:44Z")

</div>

Hi Team, Do we have mysql equivalent FIND\_IN\_SET function in Singlestore? if please let me know. DIM\_RULE\_CON ID Rule\_id 01 A01,A02,A03 02 A04 03 A05,A06,A07 FACT\_FIN TIME RULE\_ID AM…

---

## [Stored Proc error when using loop : Multiple statements detected in a single query](https://www.singlestore.com/forum/t/stored-proc-error-when-using-loop-multiple-statements-detected-in-a-single-query/6109)

<div class="topic-metadata">

**Author:** [@DataSleek](https://www.singlestore.com/forum/u/DataSleek)\
**Replies:** 1\
**Last updated:** [November 7, 2022, 11:32pm UTC](https://www.singlestore.com/forum/t/stored-proc-error-when-using-loop-multiple-statements-detected-in-a-single-query/6109 "2022-11-07T23:32:47Z")

</div>

Hi , I’m getting the follow error when I execute this SP: call del\_truncate\_all\_project\_data() ; setting\_value contains the table name. singlestore\> call del\_truncate\_all\_project\_data() ; ±-------------------------…

---

## [Batch Insert in Stored Procedure](https://www.singlestore.com/forum/t/batch-insert-in-stored-procedure/6039)

<div class="topic-metadata">

**Author:** [@baskar.sks](https://www.singlestore.com/forum/u/baskar.sks)\
**Replies:** 7\
**Last updated:** [October 28, 2022, 12:05am UTC](https://www.singlestore.com/forum/t/batch-insert-in-stored-procedure/6039 "2022-10-28T00:05:01Z")

</div>

I am trying to optimize the stored proc by using the Batch processing approach. The stored proc gets invoked by the kafka pipeline. Pipeline: CREATE or REPLACE PIPELINE test\_proc\_pipeline AS LOAD DATA KAFKA ‘\<broker\_ho…

---

## [While calling procedure getting empty output but data is present in the table ....Can u help on this syntax logic where did i given mistake in the query and variable is not taking in the select query.I am pasting the output and the procedure info](https://www.singlestore.com/forum/t/while-calling-procedure-getting-empty-output-but-data-is-present-in-the-table-can-u-help-on-this-syntax-logic-where-did-i-given-mistake-in-the-query-and-variable-is-not-taking-in-the-select-query-i-am-pasting-the-output-and-the-procedure-info/5908)

<div class="topic-metadata">

**Author:** [@Nani](https://www.singlestore.com/forum/u/Nani)\
**Replies:** 4\
**Last updated:** [October 24, 2022, 9:57pm UTC](https://www.singlestore.com/forum/t/while-calling-procedure-getting-empty-output-but-data-is-present-in-the-table-can-u-help-on-this-syntax-logic-where-did-i-given-mistake-in-the-query-and-variable-is-not-taking-in-the-select-query-i-am-pasting-the-output-and-the-procedure-info/5908 "2022-10-24T21:57:20Z")

</div>

CREATE OR REPLACE PROCEDURE get123(callType varchar(20) , typeName varchar(30) , timeInterval int(11) NULL, inDate date NULL, site\_id varchar(100) ) RETURNS void AS DECLARE msgType varchar(10) = ‘’; timeInt int = 1800; …

---

## [Error in stored procedure while migrating mysql syntax to singlestore syntax is not matching...can you please help me to get this syntax. Thanks in advance](https://www.singlestore.com/forum/t/error-in-stored-procedure-while-migrating-mysql-syntax-to-singlestore-syntax-is-not-matching-can-you-please-help-me-to-get-this-syntax-thanks-in-advance/5439)

<div class="topic-metadata">

**Author:** [@Nani](https://www.singlestore.com/forum/u/Nani)\
**Replies:** 6\
**Last updated:** [October 1, 2022, 12:00am UTC](https://www.singlestore.com/forum/t/error-in-stored-procedure-while-migrating-mysql-syntax-to-singlestore-syntax-is-not-matching-can-you-please-help-me-to-get-this-syntax-thanks-in-advance/5439 "2022-10-01T00:00:05Z")

</div>

CREATE PROCEDURE Get\_Monitor(in callType varchar(20),in typeName varchar(30),in timeInterval int,in inDate date) begin declare msgType varchar(10) default ‘’; declare timeInt int default 1800; declare selectInterval …

[Next page](https://www.singlestore.com/forum/c/support/procedural-sql/24.md?page=1)
