CREATE OR REPLACE TASK SUNO_PROD.PROD.DIM_USER_INSERT
    WAREHOUSE = SUNO_PROD_LARGE
    SCHEDULE = 'USING CRON 40 * * * * UTC'
    AS
    DECLARE
        p_date VARCHAR;
        p_hour VARCHAR;
        row_count NUMBER;
        start_time TIMESTAMP;
    BEGIN
        start_time := CURRENT_TIMESTAMP();
        p_date := DATE(SYSDATE() - INTERVAL '1 HOUR');
        p_hour := HOUR(SYSDATE() - INTERVAL '1 HOUR');
        CALL dim_user_proc(:p_date, :p_hour);

        SELECT COUNT(*) INTO :row_count
        FROM suno_prod.prod.dim_user;
        CALL TASK_MONITOR_INSERT_PROC('DIM_USER_INSERT', :start_time, :row_count, 'SUCCESS', 'HOURLY');
    END;
