I recently came across an issue where I tried accessing a component and received an error stating
No matching buffer found for level. (15,26)
This was because orphan data existed. I had updated an sqr to delete data from a sql table that was a parent table. This parent table had child tables. Since I did not delete the related data from the child tables too the data didn't match up between the levels.
So what I learned from this was to check if a parent record has child records when deleting data. A query that identifies child records is shown below:
SELECT * FROM
PSRECDEFN WHERE PARENTRECNAME = {tablename};
A query for pulling the orphaned data from the child table is shown below:
select * FROM {child_record} A
WHERE NOT EXISTS
(SELECT 'x' FROM {parent_record} B
WHERE A.{key_field}=B.{key_field});
Oracle has some related documentation online. I believe they have a delivered component that can clean up orphan data from batch processes.
No comments:
Post a Comment