![]() | Products |
| Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » SQL/PSM Statements » SET STATEMENT CACHE |
SET STATEMENT CACHE TO <NumStatements>
-- The following job backs up all tables in all databases
-- defined in the current system at 11:00 PM every evening.
CREATE JOB Backup
RUN AS "System"
FROM DATE '2006-01-01' TO DATE '2010-12-31'
DAILY
BETWEEN TIME '11:00 PM' AND TIME '11:30 PM'
CATEGORY 'Backup'
BEGIN
DECLARE DBCursor CURSOR FOR DBStmt;
DECLARE DBName VARCHAR DEFAULT '';
-- 8 statements is more than we need, but isn't wasteful
SET STATEMENT CACHE TO 8;
PREPARE DBStmt FROM 'SELECT * FROM Databases';
OPEN DBCursor;
FETCH FIRST FROM DBCursor ('Name') INTO DBName;
WHILE NOT EOF(DBCursor) DO
IF (DBName <> 'Configuration') THEN
EXECUTE IMMEDIATE 'BACKUP DATABASE "' + DBName + '" AS "' +
CAST(CURRENT_DATE AS VARCHAR(10)) +
'-' + DBName + '" TO STORE "Backups" INCLUDE CATALOG';
-- This next statement is the one that we're interested in caching
EXECUTE IMMEDIATE 'INSERT INTO BackupLog(ExecTime) Values (CURRENT_TIMESTAMP)';
END IF;
FETCH NEXT FROM DBCursor ('Name') INTO DBName;
END WHILE;
CLOSE DBCursor;
END| Deviation | Details |
| Extension | This SQL statement is an ElevateDB extension. |
This web page was last updated on Tuesday, September 16, 2025 at 04:56 PM | Privacy Policy © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? |

