I am trying to create a procedure to insert missing rows from another table by max(date). I would then schedule a job to run every 5 minutes to update a remote table.
I am unable to get my procedure to compile. I would like to add date format change as part of the session too. Then how would I use job scheduler to call it to run every 5 minutes.
create or replace procedure update_cars
AS
v_date date;
begin
--execute immediate 'alter session set NLS_DATE_FORMAT='DD-MON-YY HH24:MI:SS'';
select max(inventory_date) from car_equipment into v_date;
return v_date;
insert /*+APPEND*/ into car_equipment (count_cars,equipment_type,location,inventory_date,count_inventory)
select count_cars,equipment_type,location,inventory_date,count_inventory from car_source where inventory_date > v_date;
end;
/
Error(6,47): PL/SQL: ORA-00933: SQL command not properly ended