-
I am experiencing a problem with 2 tables with same structure , one is production and one is a resolve table, which is mirror of the prod table. Both tables gets populated every day thrice thro sql*loader, with accurate freequency. Now if i query the prod table and resolve table for a specific criteria, prod table comes out with 5 rows more than that of resolve table. It's happening first time after a proper function of nearly an year.
Both tables are having 3 primary keys. How and where to trroubleshoot? Pl help.
Pl give me a SQL statement to check with just duplicate rows present in tables.
Thanx
Deenu Param
-
I did find that there are 5 duplicate rows are in the prod table. I am wondering to know how the duplicates are allowed by breaking the primary key constraint. Any help would be appreciated.
Thanx,
Deenu Param
-
Well, for the start you could clarify what do you mean by "Both tables are having 3 primary keys". No table in SQL world could ever have more than one primary key!
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
-
Are you talking about composite primary key including 3 keys?
Thanks
-
I am sorry for the confusion. I mean a composite key based on 3 columns.
Deenu Param
-
There's a difference in the key values . . . do they contain character or date information? Check for spaces, case and datetime information . . .
-
There are 2 number colns and one date column.
SWITCHID,SEQUENCENUMBER-----number cols
CALLSTARTTIME---------------------date coln,
Pl let me know what to check for case,space etc., i.e., with the entered values or key names?
Thanx,
Deenu Param
-
To find duplicates try:
SELECT SWITCHID, SEQUENCENUMBER, CALLSTARTTIME, count(*)
FROM your_table
HAVING count(*) > 1
GROUP BY SWITCHID, SEQUENCENUMBER, CALLSTARTTIME;
If you select a date column in SQL*Plus without any format , Oracle uses the nls_date_format. Default this is without hours, minutes and seconds.
-
Thanx, I found that there are nearly more than 100 duplicate entries now. It's amazing how composite key violation happening, since the status of the index is USABLE(it's a partitioned index). Any ideas?
Deenu Param
-
Was the primary key enabled with novailidate.
If this is the case the table ignores duplicated data and Oracle assumes you want it this way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|