Posts

Showing posts from April, 2021

Connect to Oracle Autonomous Database from Python

Image
To connect Oracle Autonomous Database from Python, we require below components Oracle Instant Client cx_Oracle Python library A valid wallet for an ADB service Python environment. Oracle Instant Client Oracle Instant Client libraries are required to connect to Oracle Database from any client OS. These are not Python-specific libraries. Using these libraries, you can connect to Oracle Database from the programs written in any other programming language. Download the Oracle Instant Client from  here .  I selected Instant Client for Microsoft Windows (x64).  It will redirect to the download page where two packages are available to download. Basic Package and Basic Light Package. Download any one package and unzip the downloaded package into a suitable location.  Note that Windows 7 is not supported. Also, both the Basic Package and Basic Light Package require  Microsoft Visual Studio 2017 Redistributable .  Add the location of the instant client to the Path Environment Variable. This is

How to compare two tables column by column in Oracle Database?

Image
Recently in my project, we had a requirement to compare two identical CSV files from a different source. Since the size of these files is more than 50MB we were not able to compare using the comparison tool that we are using. So we decided to compare both these files using SQL.  Let's take two CSV files containing the employee's information from two different upstream sources. I want to compare both these files to check data quality.  The first step is to create two temporary tables EMP1 and EMP2 and load the data into these tables. Here, EMPNO is a primary key and I want to compare both the tables based on this column and want to display all those rows which are not exactly the same.  CREATE TABLE EMP1( EMPNO NUMBER(4,0) PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4,0), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2,0)); CREATE TABLE EMP2( EMPNO NUMBER(4,0) PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9),