I have a streaming ingestion into my staging table. Every 5 minutes I execute a stored procedure to insert/update all the data from this staging table into my final
table.
Process of the stored procedure:
BEGIN
- UPDATE RECORDS IN FINAL TABLE FROM STAGING TABLE
- INSERT RECORDS IN FINAL TABLE FROM STAGING TABLE
- TRUNCATE STAGING TABLE
HERE I WANT TO RELEASE THE LOCK
END
Any idea how I can explicitely say that I want to lock the staging table for inserts until I have truncated it?