begin declare dow char(3);declare basePath char(255);declare sSQL long varchar; --Base directory, relative to the server, for backing up database files set basePath = 'D:\\METBASE_Backup\\'; -- The current day of week set dow = DATEFORMAT(current date,'DDD'); -- Dynamic SQL statement set sSQL = 'BACKUP DATABASE DIRECTORY ''' || basePath || dow || ''' TRANSACTION LOG TRUNCATE'; execute immediate sSQL end