Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3189

Re: HANA script - merge sql statements - syntax

$
0
0

Hmm... not sure where you struggled, but it's actually straight forward:

 

do
begin
declare back_id BIGINT =0;
declare cmd NVARCHAR(2000);
-- find the backup id we want to base the deletion on:  SELECT    min(to_bigint(BACKUP_ID)) into back_id  FROM SYS.M_BACKUP_CATALOG  where SYS_START_TIME >= ADD_DAYS(CURRENT_TIMESTAMP, -90)  and ENTRY_TYPE_NAME = 'complete data backup'  and STATE_NAME = 'successful';
-- build the delete statement    cmd := 'BACKUP CATALOG DELETE ALL BEFORE BACKUP_ID ' || :back_id || ' COMPLETE';
-- run the statement we just built   execute immediate (:cmd);
end;

Viewing all articles
Browse latest Browse all 3189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>