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
3d31828e
Commit
3d31828e
authored
5 months ago
by
Christopher Lenke
Browse files
Options
Downloads
Patches
Plain Diff
23.09.2024
parent
6176d1e5
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/get_unassigned_pg.txt
+48
-0
48 additions, 0 deletions
Procedures/get_unassigned_pg.txt
with
48 additions
and
0 deletions
Procedures/get_unassigned_pg.txt
0 → 100644
+
48
−
0
View file @
3d31828e
-- DROP PROCEDURE schema_xyz.get_unassigned_pg(text, text, text);
CREATE OR REPLACE PROCEDURE schema_xyz.get_unassigned_pg(ergebnis_tab_name text, basis_tab text, tab_s_inst_sec text)
LANGUAGE plpgsql
AS $procedure$
BEGIN
DECLARE
/*example:
call schema_xyz.get_unassigned_pg(
'schema_xyz.test_get_unassigned',
'schema_xyz.download_adr_wos21_new_struct_rand_1mio',
'schema_xyz.kb_s_addr_inst_sec_testrun_wos_21b_1mio')
*/
BEGIN
raise notice 'Please make sure to have indexes on item_id and aff_seq_id both on the given download table as well as the given kb_s_... table.';
execute 'drop table if exists '||ergebnis_tab_name||'_unassigned';
execute 'drop table if exists '||ergebnis_tab_name||'_cnts';
execute 'create table '||ergebnis_tab_name||'_unassigned as
(select a.*
from '||basis_tab||' a
left join '||tab_s_inst_sec||' b
on a.item_id = b.item_id and a.aff_seq_nr=b.aff_seq_nr
where b.aff_seq_nr is NULL)';
commit;
-- group by fk_institutions from before does not makes sense any more with aff_seq_nr,
-- so group by address_full, also grouping wit upper address_full as more useful
execute 'create table '||ergebnis_tab_name||'_cnts as
(select count(distinct item_id) as item_cnt, upper(address_full) as upper_address_full,
upper(city) as upper_city,
max(pubyear) as max_pubyear
from '||ergebnis_tab_name||'_unassigned
group by upper(address_full), upper(city))';
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