cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

SQL Stored Procedure in Databricks

ashishasr
New Contributor II

Hello, Is there a sql server equivalent stored procedure in Databricks which supports while loop along with delay as below. or are there any other alternative to achieve the same.

while (select count(*) from schema.mart_daily with (nolock)) = 0
begin
    waitfor delay '00:01'
end

 Thank You in advance.

1 REPLY 1

szymon_dybczak
Esteemed Contributor III

Hi @ashishasr ,

Yes, support for stored procedures is in public preview:

CREATE PROCEDURE | Databricks on AWS

In the definition of stored procedure you can use compound statement ( SQL compound statement (BEGIN ... END) with the definition of the SQL Procedure.)

And inside compound statement you can use while statement:

WHILE statement | Databricks on AWS

szymon_dybczak_0-1759235856151.png