CREATE OR REPLACE TASK DATABASE_AND_SNOWFLAKE_RDS_TABLES_DAILY_ALIGNMENT(p_date DATE)
  WAREHOUSE = SUNO_PROD_RDS_HOURLY_LARGE
  AS
    DECLARE
        start_time TIMESTAMP;
        p_hour STRING;
        stage_path STRING;
        row_count NUMBER;
        sql STRING;
        BEGIN
        start_time := CURRENT_TIMESTAMP();
        
        -- Pass the task parameter to the procedure
        sql := 'CALL rds_data_alignment_proc(''' || p_date || ''')';
        EXECUTE IMMEDIATE :sql;
        
        -- Log the task execution
        CALL TASK_MONITOR_INSERT_PROC(
            'DATABASE_AND_SNOWFLAKE_RDS_TABLES_DAILY_ALIGNMENT', 
            start_time, 
            -1, 
            'SUCCESS', 
            'DAILY'
        );
    END;