SelfRunner

SelfRunnerOdbc

TwoPanelQueryCollection

TwoPanelInlineQueries

TwoPanelTabIndSizeNumRows

TwoPanelTabIndLastAnalyzed

TwoPanelTableDataCompare

CreRunSchemaNumRows

CreRunNumRowsAllDbTab

MakeHtm

MakeHta

GetEnvVars

Click on the image for a bigger view

TwoPanel_TableDataCompare.gif

Compare data
from
one or two tables

TwoPanelTableDataCompare.bat

Compare data from one or two tables


This script is useful when you need to compare data from the same table or between  two different tables.

You can modify this script in any number of ways to make it useful for many different needs.

:: ==========================================================
:: TwoPanel_TableDataCompare.bat
:: Compare data from same table side-by-side.
:: Useful when you migrate data from one system to another.
:: ==========================================================
:: Jerome Christopher [Jerome_christopher@yahoo.com
:: http://sqlhtm.blogspot.com
:: http://www.sqlhtm.com/sqlhtm
:: ==========================================================
:: First get table data displayed on the left side
:: ==========================================================
(
rem echo spool c:^\tptdc1.out
echo set pages 1000 lines 200 echo off feedback off
echo prompt  ^<html^>^<head^>
echo set heading off feedback off
echo select ^'^<^'^|^|^'style type^=^'^|^|^'^'^'^'^|^|^'text^'^|^|^'^/^'^|^|^'css^'^|^|^'^'^'^'^|^|^'^>^'^|^| chr^(10^)^|^|
echo ^'body  {font^:6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:}^'^|^|chr^(10^)^|^|
echo ^'p     {font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:}^'^|^|chr^(10^)^|^|
echo ^'table {font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;}^'^|^|chr^(10^)^|^|
echo ^'tr    {font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;}^'^|^|chr^(10^)^|^|
echo ^'td    {font^:bold bold 7pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:aqua^;}^'^|^|chr^(10^)^|^|
echo ^'th    {font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:white^; background^:olive^; }^'^|^|chr^(10^)^|^|
echo ^'a     {font^:6pt Arial^,Helvetica^,sans^-serif^; color^:^#663300^; background^:^#ffffff^; vertical^-align^:top^;}^'^|^|chr^(10^)^|^|
echo ^'^<^'^|^|^'^/^'^|^|^'style^>^' from dual^;
echo prompt ^<^/head^>^<body^>
echo select ^'Two-Panel Data Compare Tool ^' from dual;
echo prompt ^<h1^>Two-Panel Data Compare Tool  - User^_tables ^<^/h1^>
echo select name,to_char^(sysdate,^'dd-mon-yy hh:mi:ss pm Dy^'^) Today from v$database;
echo set heading on feedback on
echo set markup HTML ON table ^"^" entmap off 
echo prompt ^<table^>^<tr^>^<td^>
echo select * from user_tables;
echo set heading off
echo set feedback off
echo spool off
echo prompt ^<^/td^>^<^/tr^>^<^/table^>^<^/body^>^<^/html^>
echo exit
)> c:\tptdc1.bat
:: ==========================================================
:: Get table data displayed on the right side
:: ==========================================================
(
rem echo spool c:\tptdc2.out
echo set pages 1000 lines 200 echo off feedback off
echo prompt  ^<html^>^<head^>
echo set heading off feedback off
echo select ^'^<^'^|^|^'style type^=^'^|^|^'^'^'^'^|^|^'text^'^|^|^'^/^'^|^|^'css^'^|^|^'^'^'^'^|^|^'^>^'^|^| chr^(10^)^|^|
echo ^'body  ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:^}^'^|^|chr^(10^)^|^|
echo ^'p     ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:^}^'^|^|chr^(10^)^|^|
echo ^'table ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'tr    ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'td    ^{font^:bold bold 7pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:aqua^;^}^'^|^|chr^(10^)^|^|
echo ^'th    ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:white^; background^:olive^; ^}^'^|^|chr^(10^)^|^|
echo ^'a     ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:^#663300^; background^:^#ffffff^; vertical^-align^:top^;^}^'^|^|chr^(10^)^|^|
echo ^'^<^'^|^|^'^/^'^|^|^'style^>^' from dual^;
prompt ^<^/head^>^<body^>
echo select ^'Two-Panel Data Compare Tool ^' from dual;
echo prompt ^<h1^>Two-Panel Data Compare Tool - User^_tables^<^/h1^>
echo select name,to_char^(sysdate,^'dd-mon-yy hh:mi:ss pm Dy^'^) Today from v$database;
echo set heading on feedback on
echo set markup HTML ON table ^"^" entmap off 
echo prompt ^<table^>^<tr^>^<td^>
echo SELECT * from user_tables;
echo set heading off
echo set feedback off
echo spool off
echo prompt ^<^/td^>^<^/tr^>^<^/table^>^<^/body^>^<^/html^>
echo exit
)> c:\tptdc2.bat
:: ========================================================
:: Get the output of the two scripts generated above
:: ========================================================
sqlplus -s "
system/oracle@xe " <c:\tptdc1.bat >c:\tptdc1.htm
sqlplus -s "
system/oracle@xe " <c:\tptdc2.bat >c:\tptdc2.htm
:: ========================================================
:: Create the two-panel window
:: ========================================================
(
echo ^<html^>
echo   ^<head^>
echo     ^<title^>
echo       Two Panel Data Compare Tool - Table Data
echo    ^<^/title^>
echo   ^<^/head^>
echo   ^<FRAMESET COLS^=^"600^,*^" border^=1^>
echo   ^<FRAME NAME^=^"top^"    SRC^=^"c^:^\tptdc1.htm^" marginwidth^=^"10^" scrolling^=^"Auto^"^>
echo   ^<FRAME NAME^=^"bottom^" SRC^=^"c^:^\tptdc2.htm^" marginwidth^=^"10^" scrolling^=^"Auto^"^>
echo   ^<^/FRAMESET^>
echo ^<^/html^>
)>c:\tptdc.hta
start c:\tptdc.hta

rem Uncomment line below to debug
rem del c:\tptdc1.bat c:\tptdc2.bat c:\tptdc1.htm c:\tptdc2.htm c:\tptdc.hta
exit

   

Home

Scripts

Tips

Misc

Resume

Tamil

JobSearch

www.sqlhtm.com Copyright Jerome S. Christopher 2010