Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
cfb85580
Commit
cfb85580
authored
13 years ago
by
Monika Komorowska
Browse files
Options
Downloads
Patches
Plain Diff
Stored procedure to delete duplicates from table unmapped_object.
parent
9214cd53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sql/delete_duplicates.sql
+40
-0
40 additions, 0 deletions
sql/delete_duplicates.sql
with
40 additions
and
0 deletions
sql/delete_duplicates.sql
0 → 100644
+
40
−
0
View file @
cfb85580
CREATE
PROCEDURE
delete_duplicates
()
BEGIN
DECLARE
v_identifier
varChar
(
255
);
DECLARE
v_unmapped_object_id
INT
;
DECLARE
existing_object_id
INT
DEFAULT
0
;
DECLARE
v_parent
varChar
(
255
);
DECLARE
v_ensembl_id
INT
;
DECLARE
v_unmapped_reason_id
INT
;
DECLARE
v_ensembl_object_type
varChar
(
15
);
DECLARE
v_external_db_id
INT
;
DECLARE
done
INT
DEFAULT
0
;
DECLARE
row_count
INT
DEFAULT
0
;
DECLARE
cur1
CURSOR
FOR
SELECT
unmapped_object_id
,
identifier
,
ensembl_id
,
parent
,
unmapped_reason_id
,
ensembl_object_type
,
external_db_id
from
unmapped_object
where
ensembl_id
is
not
null
and
parent
is
not
null
and
ensembl_object_type
is
not
null
and
external_db_id
is
not
null
order
by
unmapped_object_id
;
DECLARE
CONTINUE
HANDLER
FOR
NOT
FOUND
SET
done
=
TRUE
;
OPEN
cur1
;
main_loop
:
LOOP
SET
done
=
FALSE
;
FETCH
cur1
INTO
v_unmapped_object_id
,
v_identifier
,
v_ensembl_id
,
v_parent
,
v_unmapped_reason_id
,
v_ensembl_object_type
,
v_external_db_id
;
IF
done
THEN
LEAVE
main_loop
;
END
IF
;
SET
row_count
=
0
;
SELECT
COUNT
(
1
)
INTO
row_count
FROM
unmapped_object
WHERE
identifier
=
v_identifier
and
ensembl_id
=
v_ensembl_id
and
parent
=
v_parent
and
unmapped_reason_id
=
v_unmapped_reason_id
and
ensembl_object_type
=
v_ensembl_object_type
and
external_db_id
=
v_external_db_id
;
IF
row_count
>
1
THEN
DELETE
FROM
unmapped_object
where
unmapped_object_id
<>
v_unmapped_object_id
and
identifier
=
v_identifier
and
ensembl_id
=
v_ensembl_id
and
parent
=
v_parent
and
unmapped_reason_id
=
v_unmapped_reason_id
and
ensembl_object_type
=
v_ensembl_object_type
and
external_db_id
=
v_external_db_id
;
END
IF
;
END
LOOP
;
CLOSE
cur1
;
END
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment