NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

PROCEDURE table_extract (p_source_table VARCHAR2, p_DSA_table VARCHAR2, p_attributes_src VARCHAR2, p_attributes_dest VARCHAR2) IS
v_end_date TIMESTAMP;
v_start_date t_info_extractions.LAST_TIMESTAMP%TYPE;
v_sql VARCHAR2(1000);
BEGIN
pck_log.write_log(' Extracting data ["TABLE_EXTRACT ('||UPPER(p_source_table)||')"]');
pck_log.rowcount(p_DSA_table,'Before'); -- Logs how many rows the destination table initially contains

-- CLEAN DESTINATION TABLE
v_sql := 'DELETE FROM '||p_DSA_table;
pck_log.write_log(v_sql);
EXECUTE IMMEDIATE v_sql;

-- find the date of change of the last record extracted in the previous extraction
v_sql:='SELECT last_timestamp FROM t_info_extractions WHERE UPPER(source_table_name)='''||UPPER(p_source_table)||'''';
EXECUTE IMMEDIATE v_sql INTO v_start_date;

-- ---------------------
-- | FISRT EXTRACTION |
-- ---------------------
IF v_start_date IS NULL THEN

-- FIND THE DATE OF CHANGE OF THE MOST RECENTLY CHANGED RECORD IN THE SOURCE TABLE
v_sql:='SELECT MAX(src_last_changed) FROM ' || p_source_table;
pck_log.write_log(v_sql);
EXECUTE IMMEDIATE v_sql INTO v_end_date;


-- EXTRACT ALL RELEVANT RECORDS FROM THE SOURCE TABLE TO THE DSA
-- SOMETHING IS MISSING
v_sql := 'INSERT INTO '||p_dsa_table ||'('||p_attributes_dest||')SELECT '|| p_attributes_src ||' FROM '|| p_source_table || ' WHERE src_last_changed <= :1';
pck_log.write_log(v_sql);
EXECUTE IMMEDIATE v_sql USING v_end_date;

-- UPDATE THE t_info_extractions TABLE
-- SOMETHING IS MISSING
v_sql := 'UPDATE t_info_extractions SET last_timestamp = :1 ' || ' WHERE UPPER(source_table_name)='''||UPPER(p_source_table)||'''';
EXECUTE IMMEDIATE v_sql USING v_end_date;
ELSE
-- -------------------------------------
-- | OTHER EXTRACTIONS AFTER THE FIRST |
-- -------------------------------------
-- FIND THE DATE OF CHANGE OF THE MOST RECENTLY CHANGED RECORD IN THE SOURCE TABLE
-- SOMETHING IS MISSING
null;

EXECUTE IMMEDIATE v_sql INTO v_end_date USING v_start_date;

IF v_end_date>v_start_date THEN
-- EXTRACT ALL RELEVANT RECORDS FROM THE SOURCE TABLE TO THE DSA
-- SOMETHING IS MISSING
null;

EXECUTE IMMEDIATE v_sql USING v_start_date, v_end_date;

-- UPDATE THE t_info_extractions TABLE
-- SOMETHING IS MISSING
null;
END IF;
END IF;

pck_log.write_log(' Done!');
pck_log.rowcount(p_DSA_table,'After'); -- Logs how many rows the destination table now contains
EXCEPTION
WHEN OTHERS THEN
pck_log.write_uncomplete_task_msg;
RAISE e_extraction;
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.