No idea if this is close, but it might be a starter-for-tenKristenCREATE PROCEDURE dbo.max_user @lmax int OUTPUT, -- I don't know what PLS_INTEGER is, I've assumed an "int" @lday int OUTPUT -- PLS_INTEGERASDECLARE @TRUNC_SYSDATE datetime-- I have assumed that TRUNC(SYSDATE) is Today's date (with NO time)SELECT @TRUNC_SYSDATE = DATEADD(Day, 0, DATEDIFF(Day, 0, GetDate()))SELECT @lmax = COUNT(*) FROM sapr3.USR41 WHERE mandt = '240'SELECT @lday = COUNT(*)FROM sapr3.ZBC_MAX_USER WHERE sample_date >= @TRUNC_SYSDATE AND sample_date < DATEADD(Day, 1, @TRUNC_SYSDATE) -- Before tomorrowIF @lday > 0 THENBEGIN UPDATE sapr3.ZBC_MAX_USER SET [MAX] = @lmax WHERE sample_date = @TRUNC_SYSDATE AND [MAX] < @lmax-- COMMIT WORKENDELSEBEGIN INSERT INTO sapr3.ZBC_MAX_USER (sample_date, [MAX]) VALUES (@TRUNC_SYSDATE, @lmax);-- COMMIT WORK;END-- This duplciate ELSE presumably doesn;t do anything in Oracle??-- ELSE-- BEGIN-- INSERT INTO sapr3.ZBC_MAX_USER (sample_date, [MAX]) VALUES (@TRUNC_SYSDATE, @lmax);-- -- COMMIT WORK;-- ENDGO