Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to show diff betw two column amts in recursive select

Status
Not open for further replies.

raygg

Technical User
Jun 14, 2000
397
US
A user schema was created using the system user for the staging tables of a 10gR2 data warehouse on windows. I expdp'd out the system version, built new dbf's and impdp'd and remapped schema and tablspace to a new user name STAGEW. I ran a script to list the rows for comparison of the tables. How do I change this script to include a difference column? If possible I would like to keep it as a cmd line script rather than change it to a declared procedure. Here is my script


SQL> SELECT S.TABLE_NAME, S.NUM_ROWS AS SYSTEMROWS, T.NUM_ROWS AS STAGEWROWS
2 FROM DBA_TABLES s, DBA_TABLES T
3 WHERE s.TABLE_NAME = T.TABLE_NAME
4 AND s.OWNER = 'SYSTEM'
5 AND T.OWNER = 'STAGEW'
6 ORDER BY S.TABLE_NAME;

TABLE_NAME SYSTEMROWS STAGEWROWS
------------------------------ ---------- ----------
STAGE_1901 6571 6571
STAGE_1902 6571 6571
STAGE_1903 6560 6560

Just because these amts are identical do not think I made a mistake there are other rows where differences occur due to i/o errors

 

If you use the NUM_ROWS column from DBA_TABLES there might be a difference because that column is valid only for the date the table was analyzed.
And...datapump will compute new statistics.
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
I am loading each table only once so it is not a problem. Do you know how to code the diff column?

 
What do you mean by a diff column? Do you mean subtract systemrows from stagerows?

abs(S.NUM_ROWS AS SYSTEMROWS - T.NUM_ROWS AS STAGEWROWS) as diff


For Oracle-related work, contact me through Linked-In.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top