Skip to Content
0
Former Member
May 06, 2016 at 11:35 PM

Script to delete the today's data in target table

345 Views

Hi All,

I loaded the below data to a table by adding a new column LOAD_DATE.

How to write the script to delete the data if same day loaded?

For example, loaded the data on today and I want to rerun this job today. Today's data should be deleted and load the data again.

What is the script for this.

Thanks in advance.


This is the source data.

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 1001 SMITH CLERK 7902 17-Dec-80 800 NULL 20 1002 ALLEN SALESMAN 7698 20-Feb-81 1600 300 30 1003 WARD SALESMAN 7698 22-Feb-81 1250 500 30 1004 JONES MANAGER 7839 02-Apr-81 2975 NULL 20 1005 MARTIN SALESMAN 7698 28-Sep-81 1250 1400 30 1006 BLAKE MANAGER 7839 01-May-81 2850 NULL 30 1007 CLARK MANAGER 7839 09-Jun-81 2450 NULL 10 1008 SCOTT ANALYST 7566 09-Dec-82 3000 NULL 20 1009 KING PRESIDENT NULL 17-Nov-81 5000 NULL 10 1010 TURNER SALESMAN 7698 08-Sep-81 1500 0 30 1011 ADAMS CLERK 7788 12-Jan-83 1100 NULL 20 1012 JAMES CLERK 7698 03-Dec-81 950 NULL 30 1013 FORD ANALYST 7566 03-Dec-81 3000 NULL 20 1014 MILLER CLERK 7782 23-Jan-82 1300 NULL 10