SlideShare a Scribd company logo
1 of 15
Recipes of Data Warehouse and
Business Intelligence

How to check the Staging Area Loading
The Micro ETL Foundation
•

•

•

•
•

The Micro ETL Foundation is a set of ideas and solutions for Data Warehouse and
Business Intelligence Projects in Oracle environment.
It doesn’t use expensive ETL tools, but only your intelligence and ability to
think, configure, build and load data using the features and the programming
language of your RDBMS.
This recipes is another easy example based on the slides of Recipes 1 and 2 of Data
Warehouse and Business Intelligence.
Copying the content of the following slides with your editor and SQL Interface
utility, you can reproduce this example.
The solution presented here is the check of Staging area loading
The load of data file
•

•
•
•

Configure and load the source data file according to the slides of «Recipes 2 of
Data Warehouse and Business Intelligence».
Copy the SQL statement in a file. Run the script and you will load a Staging Table
with a «click»
Now we will see how to verify the load process.
The data source file is the following

EMPLOYEE_ID FIRST_NAME
117 Sigal
118 Guy
119 Karen
120 Matthew
121 Adam
122 Payam
123 Shanta
124 Kevin
125 Julia
126 Irene

LAST_NAME
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni

EMAIL
PHONE_NUMBER HIRE_DATE JOB_ID
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
STOBIAS
5.151.274.564 24/07/2005 PU_CLERK
2800
114
30
GHIMURO
5.151.274.565 15/11/2006 PU_CLERK
2600
114
30
KCOLMENA
5.151.274.566 10/08/2007 PU_CLERK
2500
114
30
MWEISS
6.501.231.234 18/07/2004 ST_MAN
8000
100
50
AFRIPP
6.501.232.234 10/04/2005 ST_MAN
8200
100
50
PKAUFLIN
6.501.233.234 01/05/2003 ST_MAN
7900
100
50
SVOLLMAN
6.501.234.234 10/10/2005 ST_MAN
6500
100
50
KMOURGOS
6.501.235.234 16/11/2007 ST_MAN
5800
100
50
JNAYER
6.501.241.214 16/07/2005 ST_CLERK
3200
120
50
IMIKKILI
6.501.241.224 28/09/2006 ST_CLERK
2700
120
50
The load process
•

The objects involved in the process are showned in the next figure.

1

File Sytem

Row External
Table (RXT)

Source External
View (FXV)

Load

Source
Data
File

2

Configuration
External Table
(CXT)

File Definition
Table (CFT)

Source External
Table (FXT)

Row
File

3

Configuration
External View
(CXV)

4

Staging Table
(STT)

5
What to check
•

At the end of the loading, we need to control that it is gone all ok. We need to
ensure that the rows number in the Staging table is correct. To have this safety, we
must show that:
1.
2.
3.
4.
5.

The rows number declared in the .row file
The rows number in the source data file
The rows number in the external table that refers to the data file
The rows number of the view builded on the external table
The rows number of the staging table

Are all exactly the same.
• Now see what we need.
The detail check table
•
•
•
•
•
•
•
•

Build a check table to contain the result
of the checks
IO_COD is the same of the configuration
table created in «Recipes2».
SEQ_NUM is a global sequential number
got from an Oracle sequence.
SOURCE_COD is the name of the data file
SORT_NUM is a sort number inside the
io_cod
CHECK_DET is a description of the check
N1_VAL is the rows counter
STAMP_DTS is the sysdate

DROP TABLE STA_CHK_LOT;
CREATE TABLE STA_CHK_LOT
(
IO_COD VARCHAR2(12) NOT NULL,
SEQ_NUM NUMBER NOT NULL,
SOURCE_COD VARCHAR2(24) NOT NULL,
SORT_NUM NUMBER NOT NULL,
CHECK_DET VARCHAR2(600) NOT NULL,
N1_VAL NUMBER NOT NULL,
STAMP_DTS DATE NOT NULL
);
DROP SEQUENCE STA_CHK_SEQ;
CREATE SEQUENCE STA_CHK_SEQ
START WITH 1 INCREMENT BY 1;
The summary check table
•

•
•
•
•

Build a summary check table to contain
in only one row the result of the previous
table.
IO_COD is the same of the configuration
table created in «Recipes2».
*_CNT is the rows number got from the 5
checks showed in the slide 4.
RET_COD will be the final result (OK or
NOT OK)
STAMP_DTS is the sysdate

DROP TABLE STA_IO_LOT;
CREATE TABLE STA_IO_LOT
(
IO_COD
VARCHAR2(12) NOT NULL,
SOURCE_COD VARCHAR2(80) NOT NULL,
DEC_CNT NUMBER,
FIL_CNT NUMBER,
FXT_CNT NUMBER,
FXV_CNT NUMBER,
STT_CNT NUMBER,
RET_COD varchar2(30),
STAMP_DTS DATE
);
The count rows function
•

•
•
•

At this point I need to write some
pl/sql code. You can write it also in
java or other programming language.
This function count the number of
lines in the source data file.
It has 2 parameters: the folder
(Oracle directory) and the file name.
It is all. Now we can load the two
check tables.

CREATE OR REPLACE FUNCTION F_COUNT_FILE_ROWS(
P_DIR VARCHAR2
,P_FILE_NAME VARCHAR2
) RETURN NUMBER IS
V_F UTL_FILE.FILE_TYPE;
V_COUNT NUMBER;
V_LINE VARCHAR2(2000);
BEGIN
V_COUNT := 0;
V_F := UTL_FILE.FOPEN(P_DIR, P_FILE_NAME, 'R');
LOOP
UTL_FILE.GET_LINE(V_F, V_LINE);
V_COUNT := V_COUNT+1;
END LOOP;
UTL_FILE.FCLOSE(V_F);
EXCEPTION
WHEN NO_DATA_FOUND THEN
UTL_FILE.FCLOSE(V_F);
RETURN V_COUNT;
END;
/
The declared rows
•
•
•

Insert this number with the following SQL statement.
It use the Oracle dictionary to find the file name.
It use the source external view to calculate the number
INSERT INTO STA_CHK_LOT (
IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS)
VALUES ('employees1'
,STA_CHK_SEQ.NEXTVAL
,(SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')
,1
,'DECLARED'
,(SELECT NVL(MAX(ROWS_NUM),0) FROM STA_EMPLOYEES1_FXV)
,SYSDATE
);
The file rows
•
•
•

Insert this number with the following SQL statement.
It use the Oracle dictionary to find the file name.
It use the function to calculate the number
INSERT INTO STA_CHK_LOT (
IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS)
VALUES ('employees1'
,STA_CHK_SEQ.NEXTVAL
,(SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')
,2
,'FILE'
,NVL(F_COUNT_FILE_ROWS('STA_BCK', (SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')),0)
,SYSDATE
);
The external table rows
•
•
•

Insert this number with the following SQL statement.
It use the Oracle dictionary to find the file name.
It use the external table to calculate the number
INSERT INTO STA_CHK_LOT (
IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS)
VALUES ('employees1'
,STA_CHK_SEQ.NEXTVAL
,(SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')
,3
,'EXTERNAL TABLE (STA_EMPLOYEES1_FXT)'
,(SELECT NVL(COUNT(*),0)
FROM STA_EMPLOYEES1_FXT)
,SYSDATE
);
The external view rows
•
•
•

Insert this number with the following SQL statement.
It use the Oracle dictionary to find the file name.
It use the external view and the configuration table to calculate the number
INSERT INTO STA_CHK_LOT (
IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS)
VALUES ('employees1'
,STA_CHK_SEQ.NEXTVAL
,(SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')
,4
,'EXTERNAL VIEW (STA_EMPLOYEES1_FXV)'
,(SELECT NVL(COUNT(*),0) FROM STA_EMPLOYEES1_FXV)+(SELECT HEAD_CNT+FOO_CNT FROM STA_IO_CFT WHERE IO_COD
= 'employees1')
,SYSDATE
);
The staging table rows
•
•
•

Insert this number with the following SQL statement.
It use the Oracle dictionary to find the file name.
It use the staging table and the configuration table to calculate the number
INSERT INTO STA_CHK_LOT (
IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS)
VALUES ('employees1'
,STA_CHK_SEQ.NEXTVAL
,(SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS
WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')
,5
,'STAGING TABLE (STA_EMPLOYEES1_STT)'
,(SELECT NVL(COUNT(*),0) FROM STA_EMPLOYEES1_STT)+(SELECT HEAD_CNT+FOO_CNT FROM STA_IO_CFT WHERE IO_COD
= 'employees1')
,SYSDATE
);
The summary check
•
•
•

Insert the summary check with the following SQL statement.
It use the detail table.
It use an Oracle 11g analytics function (but you can use something else)

INSERT INTO STA_IO_LOT (
IO_COD, SOURCE_COD, DEC_CNT, FIL_CNT, FXT_CNT,
FXV_CNT, STT_CNT,RET_COD, STAMP_DTS)
SELECT IO_COD, SOURCE_COD, DEC_CNT,FIL_CNT, FXT_CNT, FXV_CNT, STT_CNT
,(CASE WHEN (DEC_CNT=FIL_CNT
AND FIL_CNT=FXT_CNT
AND FXT_CNT=FXV_CNT
AND FXV_CNT=STT_CNT) THEN 'OK' ELSE 'NOT OK' END)
,SYSDATE
FROM (SELECT IO_COD,SOURCE_COD,SORT_NUM,N1_VAL
FROM STA_CHK_LOT
WHERE SOURCE_COD = (SELECT SUBSTR(LOCATION,1,80)
FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT'))
PIVOT (
SUM(N1_VAL)
FOR SORT_NUM IN (
1 AS DEC_CNT,
2 AS FIL_CNT,
3 AS FXT_CNT,
4 AS FXV_CNT,
5 AS STT_CNT)
);
COMMIT;
Conclusion
We are at the end of this recipe. The final result of the two check tables are:

With only two log tables, a function and some SQL statement we have reached the
control of a Staging Area table loading, without ETL tools.
This is the philosophy of Micro ETL Foundation.
Email - massimo_cenci@yahoo.it
Blog (italian/english) - http://massimocenci.blogspot.it/

More Related Content

What's hot

Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Massimo Cenci
 
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)Massimo Cenci
 
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...Massimo Cenci
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interfaceDharmaraj Borse
 
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...Massimo Cenci
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 Richie Rump
 
MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017Dave Stokes
 
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)Darshankumar Prajapati
 
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...Darshankumar Prajapati
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsDave Stokes
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads UpMindfire Solutions
 

What's hot (20)

Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
 
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)
Recipe 14 - Build a Staging Area for an Oracle Data Warehouse (2)
 
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...
Recipe 16 of Data Warehouse and Business Intelligence - The monitoring of the...
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interface
 
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...
Recipes 9 of Data Warehouse and Business Intelligence - Techniques to control...
 
DataBase Management System Lab File
DataBase Management System Lab FileDataBase Management System Lab File
DataBase Management System Lab File
 
Sql loader good example
Sql loader good exampleSql loader good example
Sql loader good example
 
Oracle sql loader utility
Oracle sql loader utilityOracle sql loader utility
Oracle sql loader utility
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012
 
MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017
 
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
 
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
 
Apps1
Apps1Apps1
Apps1
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 
dbms lab manual
dbms lab manualdbms lab manual
dbms lab manual
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads Up
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Sqlmap
SqlmapSqlmap
Sqlmap
 

Similar to Data Warehouse and Business Intelligence - Recipe 3

Oracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesOracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesKellyn Pot'Vin-Gorman
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSSupriya Radhakrishna
 
Avoiding cursors with sql server 2005 tech republic
Avoiding cursors with sql server 2005   tech republicAvoiding cursors with sql server 2005   tech republic
Avoiding cursors with sql server 2005 tech republicKaing Menglieng
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorialMohd Tousif
 
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...InSync2011
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...TAISEEREISA
 
ShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlChema Alonso
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptxSiddhantBhardwaj26
 

Similar to Data Warehouse and Business Intelligence - Recipe 3 (20)

Les09
Les09Les09
Les09
 
Oracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesOracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the Indices
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
 
Etl2
Etl2Etl2
Etl2
 
Avoiding cursors with sql server 2005 tech republic
Avoiding cursors with sql server 2005   tech republicAvoiding cursors with sql server 2005   tech republic
Avoiding cursors with sql server 2005 tech republic
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 
SQL
SQLSQL
SQL
 
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...
Database & Technology 2 _ Richard Foote _ 10 things you probably dont know ab...
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
IR SQLite Session #1
IR SQLite Session #1IR SQLite Session #1
IR SQLite Session #1
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
 
ShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)Sql
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Triggers and Stored Procedures
Triggers and Stored ProceduresTriggers and Stored Procedures
Triggers and Stored Procedures
 

More from Massimo Cenci

Il controllo temporale dei data file in staging area
Il controllo temporale dei data file in staging areaIl controllo temporale dei data file in staging area
Il controllo temporale dei data file in staging areaMassimo Cenci
 
Tecniche di progettazione della staging area in un processo etl
Tecniche di progettazione della staging area in un processo etlTecniche di progettazione della staging area in un processo etl
Tecniche di progettazione della staging area in un processo etlMassimo Cenci
 
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...Massimo Cenci
 
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...Massimo Cenci
 
Note di Data Warehouse e Business Intelligence - Pensare "Agile"
Note di Data Warehouse e Business Intelligence - Pensare "Agile"Note di Data Warehouse e Business Intelligence - Pensare "Agile"
Note di Data Warehouse e Business Intelligence - Pensare "Agile"Massimo Cenci
 
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioni
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioniNote di Data Warehouse e Business Intelligence - La gestione delle descrizioni
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioniMassimo Cenci
 
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Massimo Cenci
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Massimo Cenci
 
Data Warehouse - What you know about etl process is wrong
Data Warehouse - What you know about etl process is wrongData Warehouse - What you know about etl process is wrong
Data Warehouse - What you know about etl process is wrongMassimo Cenci
 
Letter to a programmer
Letter to a programmerLetter to a programmer
Letter to a programmerMassimo Cenci
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Massimo Cenci
 
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Massimo Cenci
 
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Massimo Cenci
 
Oracle All-in-One - how to send mail with attach using oracle pl/sql
Oracle All-in-One - how to send mail with attach using oracle pl/sqlOracle All-in-One - how to send mail with attach using oracle pl/sql
Oracle All-in-One - how to send mail with attach using oracle pl/sqlMassimo Cenci
 
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...Massimo Cenci
 
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisiNote di Data Warehouse e Business Intelligence - Le Dimensioni di analisi
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisiMassimo Cenci
 

More from Massimo Cenci (16)

Il controllo temporale dei data file in staging area
Il controllo temporale dei data file in staging areaIl controllo temporale dei data file in staging area
Il controllo temporale dei data file in staging area
 
Tecniche di progettazione della staging area in un processo etl
Tecniche di progettazione della staging area in un processo etlTecniche di progettazione della staging area in un processo etl
Tecniche di progettazione della staging area in un processo etl
 
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...
Note di Data Warehouse e Business Intelligence - Il giorno di riferimento dei...
 
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...
Recipe 12 of Data Warehouse and Business Intelligence - How to identify and c...
 
Note di Data Warehouse e Business Intelligence - Pensare "Agile"
Note di Data Warehouse e Business Intelligence - Pensare "Agile"Note di Data Warehouse e Business Intelligence - Pensare "Agile"
Note di Data Warehouse e Business Intelligence - Pensare "Agile"
 
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioni
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioniNote di Data Warehouse e Business Intelligence - La gestione delle descrizioni
Note di Data Warehouse e Business Intelligence - La gestione delle descrizioni
 
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
 
Data Warehouse - What you know about etl process is wrong
Data Warehouse - What you know about etl process is wrongData Warehouse - What you know about etl process is wrong
Data Warehouse - What you know about etl process is wrong
 
Letter to a programmer
Letter to a programmerLetter to a programmer
Letter to a programmer
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
 
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
 
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
Data Warehouse e Business Intelligence in ambiente Oracle - Il sistema di mes...
 
Oracle All-in-One - how to send mail with attach using oracle pl/sql
Oracle All-in-One - how to send mail with attach using oracle pl/sqlOracle All-in-One - how to send mail with attach using oracle pl/sql
Oracle All-in-One - how to send mail with attach using oracle pl/sql
 
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi (pa...
 
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisiNote di Data Warehouse e Business Intelligence - Le Dimensioni di analisi
Note di Data Warehouse e Business Intelligence - Le Dimensioni di analisi
 

Recently uploaded

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Data Warehouse and Business Intelligence - Recipe 3

  • 1. Recipes of Data Warehouse and Business Intelligence How to check the Staging Area Loading
  • 2. The Micro ETL Foundation • • • • • The Micro ETL Foundation is a set of ideas and solutions for Data Warehouse and Business Intelligence Projects in Oracle environment. It doesn’t use expensive ETL tools, but only your intelligence and ability to think, configure, build and load data using the features and the programming language of your RDBMS. This recipes is another easy example based on the slides of Recipes 1 and 2 of Data Warehouse and Business Intelligence. Copying the content of the following slides with your editor and SQL Interface utility, you can reproduce this example. The solution presented here is the check of Staging area loading
  • 3. The load of data file • • • • Configure and load the source data file according to the slides of «Recipes 2 of Data Warehouse and Business Intelligence». Copy the SQL statement in a file. Run the script and you will load a Staging Table with a «click» Now we will see how to verify the load process. The data source file is the following EMPLOYEE_ID FIRST_NAME 117 Sigal 118 Guy 119 Karen 120 Matthew 121 Adam 122 Payam 123 Shanta 124 Kevin 125 Julia 126 Irene LAST_NAME Tobias Himuro Colmenares Weiss Fripp Kaufling Vollman Mourgos Nayer Mikkilineni EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID STOBIAS 5.151.274.564 24/07/2005 PU_CLERK 2800 114 30 GHIMURO 5.151.274.565 15/11/2006 PU_CLERK 2600 114 30 KCOLMENA 5.151.274.566 10/08/2007 PU_CLERK 2500 114 30 MWEISS 6.501.231.234 18/07/2004 ST_MAN 8000 100 50 AFRIPP 6.501.232.234 10/04/2005 ST_MAN 8200 100 50 PKAUFLIN 6.501.233.234 01/05/2003 ST_MAN 7900 100 50 SVOLLMAN 6.501.234.234 10/10/2005 ST_MAN 6500 100 50 KMOURGOS 6.501.235.234 16/11/2007 ST_MAN 5800 100 50 JNAYER 6.501.241.214 16/07/2005 ST_CLERK 3200 120 50 IMIKKILI 6.501.241.224 28/09/2006 ST_CLERK 2700 120 50
  • 4. The load process • The objects involved in the process are showned in the next figure. 1 File Sytem Row External Table (RXT) Source External View (FXV) Load Source Data File 2 Configuration External Table (CXT) File Definition Table (CFT) Source External Table (FXT) Row File 3 Configuration External View (CXV) 4 Staging Table (STT) 5
  • 5. What to check • At the end of the loading, we need to control that it is gone all ok. We need to ensure that the rows number in the Staging table is correct. To have this safety, we must show that: 1. 2. 3. 4. 5. The rows number declared in the .row file The rows number in the source data file The rows number in the external table that refers to the data file The rows number of the view builded on the external table The rows number of the staging table Are all exactly the same. • Now see what we need.
  • 6. The detail check table • • • • • • • • Build a check table to contain the result of the checks IO_COD is the same of the configuration table created in «Recipes2». SEQ_NUM is a global sequential number got from an Oracle sequence. SOURCE_COD is the name of the data file SORT_NUM is a sort number inside the io_cod CHECK_DET is a description of the check N1_VAL is the rows counter STAMP_DTS is the sysdate DROP TABLE STA_CHK_LOT; CREATE TABLE STA_CHK_LOT ( IO_COD VARCHAR2(12) NOT NULL, SEQ_NUM NUMBER NOT NULL, SOURCE_COD VARCHAR2(24) NOT NULL, SORT_NUM NUMBER NOT NULL, CHECK_DET VARCHAR2(600) NOT NULL, N1_VAL NUMBER NOT NULL, STAMP_DTS DATE NOT NULL ); DROP SEQUENCE STA_CHK_SEQ; CREATE SEQUENCE STA_CHK_SEQ START WITH 1 INCREMENT BY 1;
  • 7. The summary check table • • • • • Build a summary check table to contain in only one row the result of the previous table. IO_COD is the same of the configuration table created in «Recipes2». *_CNT is the rows number got from the 5 checks showed in the slide 4. RET_COD will be the final result (OK or NOT OK) STAMP_DTS is the sysdate DROP TABLE STA_IO_LOT; CREATE TABLE STA_IO_LOT ( IO_COD VARCHAR2(12) NOT NULL, SOURCE_COD VARCHAR2(80) NOT NULL, DEC_CNT NUMBER, FIL_CNT NUMBER, FXT_CNT NUMBER, FXV_CNT NUMBER, STT_CNT NUMBER, RET_COD varchar2(30), STAMP_DTS DATE );
  • 8. The count rows function • • • • At this point I need to write some pl/sql code. You can write it also in java or other programming language. This function count the number of lines in the source data file. It has 2 parameters: the folder (Oracle directory) and the file name. It is all. Now we can load the two check tables. CREATE OR REPLACE FUNCTION F_COUNT_FILE_ROWS( P_DIR VARCHAR2 ,P_FILE_NAME VARCHAR2 ) RETURN NUMBER IS V_F UTL_FILE.FILE_TYPE; V_COUNT NUMBER; V_LINE VARCHAR2(2000); BEGIN V_COUNT := 0; V_F := UTL_FILE.FOPEN(P_DIR, P_FILE_NAME, 'R'); LOOP UTL_FILE.GET_LINE(V_F, V_LINE); V_COUNT := V_COUNT+1; END LOOP; UTL_FILE.FCLOSE(V_F); EXCEPTION WHEN NO_DATA_FOUND THEN UTL_FILE.FCLOSE(V_F); RETURN V_COUNT; END; /
  • 9. The declared rows • • • Insert this number with the following SQL statement. It use the Oracle dictionary to find the file name. It use the source external view to calculate the number INSERT INTO STA_CHK_LOT ( IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS) VALUES ('employees1' ,STA_CHK_SEQ.NEXTVAL ,(SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT') ,1 ,'DECLARED' ,(SELECT NVL(MAX(ROWS_NUM),0) FROM STA_EMPLOYEES1_FXV) ,SYSDATE );
  • 10. The file rows • • • Insert this number with the following SQL statement. It use the Oracle dictionary to find the file name. It use the function to calculate the number INSERT INTO STA_CHK_LOT ( IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS) VALUES ('employees1' ,STA_CHK_SEQ.NEXTVAL ,(SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT') ,2 ,'FILE' ,NVL(F_COUNT_FILE_ROWS('STA_BCK', (SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')),0) ,SYSDATE );
  • 11. The external table rows • • • Insert this number with the following SQL statement. It use the Oracle dictionary to find the file name. It use the external table to calculate the number INSERT INTO STA_CHK_LOT ( IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS) VALUES ('employees1' ,STA_CHK_SEQ.NEXTVAL ,(SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT') ,3 ,'EXTERNAL TABLE (STA_EMPLOYEES1_FXT)' ,(SELECT NVL(COUNT(*),0) FROM STA_EMPLOYEES1_FXT) ,SYSDATE );
  • 12. The external view rows • • • Insert this number with the following SQL statement. It use the Oracle dictionary to find the file name. It use the external view and the configuration table to calculate the number INSERT INTO STA_CHK_LOT ( IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS) VALUES ('employees1' ,STA_CHK_SEQ.NEXTVAL ,(SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT') ,4 ,'EXTERNAL VIEW (STA_EMPLOYEES1_FXV)' ,(SELECT NVL(COUNT(*),0) FROM STA_EMPLOYEES1_FXV)+(SELECT HEAD_CNT+FOO_CNT FROM STA_IO_CFT WHERE IO_COD = 'employees1') ,SYSDATE );
  • 13. The staging table rows • • • Insert this number with the following SQL statement. It use the Oracle dictionary to find the file name. It use the staging table and the configuration table to calculate the number INSERT INTO STA_CHK_LOT ( IO_COD,SEQ_NUM,SOURCE_COD,SORT_NUM,CHECK_DET,N1_VAL,STAMP_DTS) VALUES ('employees1' ,STA_CHK_SEQ.NEXTVAL ,(SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT') ,5 ,'STAGING TABLE (STA_EMPLOYEES1_STT)' ,(SELECT NVL(COUNT(*),0) FROM STA_EMPLOYEES1_STT)+(SELECT HEAD_CNT+FOO_CNT FROM STA_IO_CFT WHERE IO_COD = 'employees1') ,SYSDATE );
  • 14. The summary check • • • Insert the summary check with the following SQL statement. It use the detail table. It use an Oracle 11g analytics function (but you can use something else) INSERT INTO STA_IO_LOT ( IO_COD, SOURCE_COD, DEC_CNT, FIL_CNT, FXT_CNT, FXV_CNT, STT_CNT,RET_COD, STAMP_DTS) SELECT IO_COD, SOURCE_COD, DEC_CNT,FIL_CNT, FXT_CNT, FXV_CNT, STT_CNT ,(CASE WHEN (DEC_CNT=FIL_CNT AND FIL_CNT=FXT_CNT AND FXT_CNT=FXV_CNT AND FXV_CNT=STT_CNT) THEN 'OK' ELSE 'NOT OK' END) ,SYSDATE FROM (SELECT IO_COD,SOURCE_COD,SORT_NUM,N1_VAL FROM STA_CHK_LOT WHERE SOURCE_COD = (SELECT SUBSTR(LOCATION,1,80) FROM USER_EXTERNAL_LOCATIONS WHERE TABLE_NAME = 'STA_EMPLOYEES1_FXT')) PIVOT ( SUM(N1_VAL) FOR SORT_NUM IN ( 1 AS DEC_CNT, 2 AS FIL_CNT, 3 AS FXT_CNT, 4 AS FXV_CNT, 5 AS STT_CNT) ); COMMIT;
  • 15. Conclusion We are at the end of this recipe. The final result of the two check tables are: With only two log tables, a function and some SQL statement we have reached the control of a Staging Area table loading, without ETL tools. This is the philosophy of Micro ETL Foundation. Email - massimo_cenci@yahoo.it Blog (italian/english) - http://massimocenci.blogspot.it/