SQL Stored Procedure in Databricks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2025 04:56 AM - edited 09-30-2025 05:00 AM
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'
endThank You in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2025 05:37 AM
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