I am writing a stored procedure that will execute another stored procedure if the source_count = target_count in my process log table for the latest job number. The CREATE table script for my process table is shown below. I'm thinking I need to find the MAX job_number or the MAX end_date first and then compare the source_count and the target count. If they are equal, then execute the SP. If not, then update the process log table. I'm stuck. Can someone please nudge [or shove] me in the right direction?
CREATE TABLE DDR_PROCESS_LOG
PROGRAM_ID VARCHAR2(30 BYTE),
ERROR_SQLCODE VARCHAR2(30 BYTE),
ERROR_SQLERRM VARCHAR2(250 BYTE),
COMMENTS VARCHAR2(500 BYTE),
SOURCE_COUNT VARCHAR2(20 BYTE),
TARGET_COUNT VARCHAR2(20 BYTE),