So my long term goal is to throw this PL/SQL statement into a DMBS_SCHEDULER proces in Apex 4.1 in order to create historical snapshots of the data by week but I am hung up on this code:
declare
V_DEKIT_ID varchar(255);
V_NT varchar(255);
V_QUANTITY number;
V_DDATE date;
begin
for DEKIT_ID in (select * from DKT_HIST)
loop
select DEKIT.DEKIT_ID into V_DEKIT_ID from DEKIT;
select DEKIT.NT into V_NT from DEKIT;
select DEKIT.QUANTITY into V_QUANTITY from DEKIT;
select CURRENT_DATE into V_DDATE from dual;
insert into DKT_HIST (DEKIT_ID,NT,QUANTITY,DDATE)
values (V_DEKIT_ID, V_NT, V_QUANTITY, V_DDATE);
end loop;
end;
I enter this code into the SQL Command prompt under the SQL workshop and it says that it is processed but when I go and look at the destination table (DKT_HIST), there is no data. Any help would be appreciated. In this code I want to copy the three columns from the table DEKIT as well as the current date and copy them to DKT_HIST for each row in the DEKIT table.
Thanks,
-Steve