pears.DBCleanupOldJRlog

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

Original SQL

CREATE FUNCTION "pears"."DBCleanupOldJRlog"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  IN "age" INTEGER,IN "countordo" CHAR(1) ) 
RETURNS INTEGER
BEGIN
  DECLARE @RC INTEGER;
  SELECT "count"() INTO @RC FROM "iqxjobrunnerlog"
    WHERE "completiontime" <= CURRENT date-"age";
  IF "countordo" = 'C' THEN
    RETURN @RC
  END IF;
  DELETE FROM "iqxjobrunnerlog"
    WHERE "completiontime" <= CURRENT date-"age";
  CALL "AuditLog"('CLEANUP',NULL,"string"(@RC,' Old Jobrunner Logs deleted ',"age",' days old'),NULL,NULL);
  RETURN @RC
END