Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Institutional Coding
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
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
AG Bibliometrie
Institutional Coding
Commits
a83aa16f
Commit
a83aa16f
authored
5 months ago
by
Christopher Lenke
Browse files
Options
Downloads
Patches
Plain Diff
23.09.2024
parent
e3100157
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Procedures/exclude_ii_pg.txt
+41
-0
41 additions, 0 deletions
Procedures/exclude_ii_pg.txt
with
41 additions
and
0 deletions
Procedures/exclude_ii_pg.txt
0 → 100644
+
41
−
0
View file @
a83aa16f
-- DROP PROCEDURE schema_xyz.exclude_ii_pg(text);
CREATE OR REPLACE PROCEDURE schema_xyz.exclude_ii_pg(input_table text)
LANGUAGE plpgsql
AS $procedure$
BEGIN
DECLARE
ec cursor is SELECT epid, uid_, pattern_nf, pattern_city from schema_xyz.exclude_pattern;
/* exclude things are deleted and a table _ex is created to save the excude results. input table must contain adr_id and top.
*/
exclude_pattern RECORD;
BEGIN
EXECUTE 'alter table '||input_table||' add column exclude bigint, add column exclude_id bigint';
for exclude_pattern in ec
LOOP
EXECUTE 'update '||input_table||' set exclude=1, exclude_id='||exclude_pattern.epid|| '
where (
top='||exclude_pattern.uid_||'
and adr_id in (select adr_id from schema_xyz.result_II where
upper(address_full) like '''||exclude_pattern.pattern_nf||''' and (city is null or upper(city) like '''||exclude_pattern.pattern_city||''')))';
END LOOP;
EXECUTE 'drop table if exists '||input_table||'_ex';
EXECUTE 'create table '||input_table||'_ex as (select * from '||input_table||')';
EXECUTE 'delete from '||input_table||' where exclude=1';
commit;
END;
END;
$procedure$
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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