NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

create or replace PROCEDURE "IMPORT_JOB" (
p_recordset OUT SYS_REFCURSOR)
AS

monthly_import NUMBER(6,0);
daily_import NUMBER(6,0);
manual_monthly_import NUMBER(6,0);

BEGIN

SAVEPOINT job_startPoint;

-- check if that should be monthly import
SELECT count(*) INTO monthly_import FROM IMPORT_PUB_CALENDAR WHERE YEAR_MONTH = (SELECT TO_CHAR (SYSDATE, 'YYYYMM') FROM DUAL) AND IMPORT_DAY = (SELECT TO_CHAR (SYSDATE, 'DD') FROM DUAL) AND IMPORT_STATUS = 0;

-- check if that should be daily import
SELECT count(*) INTO daily_import FROM APP_SETTINGS WHERE LAST_DAILY_IMPORT <= (SELECT TO_DATE (SYSDATE, 'DD-MON-YY') FROM DUAL) AND DAILY_IMPORT_HOUR <= (SELECT TO_CHAR (SYSDATE, 'HH24') FROM DUAL) AND IMPORT_RUNNING = 0;

-- check if that should be manual monthly import
SELECT count(*) INTO manual_monthly_import FROM CRON WHERE STATUS = 0;

IF monthly_import=1 THEN

dbms_output.put_line('MONTHLY IMPORT START');
UPDATE IMPORT_PUB_CALENDAR SET IMPORT_STATUS = 3 WHERE YEAR_MONTH = (SELECT TO_CHAR (SYSDATE, 'YYYYMM') FROM DUAL) AND IMPORT_DAY = (SELECT TO_CHAR (SYSDATE, 'DD') FROM DUAL);
-- run procedure
monthly_refresh;

UPDATE IMPORT_PUB_CALENDAR SET IMPORT_STATUS = 1 WHERE YEAR_MONTH = (SELECT TO_CHAR (SYSDATE, 'YYYYMM') FROM DUAL) AND IMPORT_DAY = (SELECT TO_CHAR (SYSDATE, 'DD') FROM DUAL);
dbms_output.put_line('-FINISHED');

import_send_mail(
p_subject => 'Monthly Import Complete',
p_message => 'Import completed successfully and logged in Oracle'
);

ELSIF daily_import=1 THEN

dbms_output.put_line('DAILY IMPORT START');
UPDATE APP_SETTINGS SET IMPORT_RUNNING = 1;
-- run procedure
daily_refresh;

UPDATE APP_SETTINGS SET IMPORT_RUNNING = 0, LAST_DAILY_IMPORT = (SELECT TO_CHAR (SYSDATE + 1, 'DD-MON-YY') FROM DUAL) WHERE IMPORT_RUNNING = 1;
dbms_output.put_line('-FINISH');

import_send_mail(
p_subject => 'Daily Import Complete',
p_message => 'Import completed successfully and logged in Oracle'
);

ELSIF manual_monthly_import=1 THEN

dbms_output.put_line('MANUAL IMPORT START');
UPDATE CRON SET STATUS = 3 WHERE STATUS = 0;
-- run procedure
dbms_output.put_line('-MONTHLY-');
monthly_refresh;

dbms_output.put_line('-DAILY-');
daily_refresh;

UPDATE CRON SET STATUS = 1, END_TIME = systimestamp, MESSAGE = 'The Ad-Hoc import completed successfully (db).' WHERE STATUS = 3;
dbms_output.put_line('-FINISH');

import_send_mail(
p_subject => 'Manual Import Complete',
p_message => 'Import completed successfully and logged in Oracle'
);

ELSE
dbms_output.put_line('nothing to do ...');
END IF;

EXCEPTION
WHEN OTHERS THEN ROLLBACK TO job_startPoint;
import_send_mail(
p_subject => 'Data import error!',
p_message => 'Import error and logged in Oracle : '||SQLERRM
);
RAISE;
END;
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.