Skip to content
Snippets Groups Projects
Commit 50bfc18e authored by Christopher Lenke's avatar Christopher Lenke
Browse files

23.09.2024

parent 1e381043
No related branches found
No related tags found
No related merge requests found
-- DROP FUNCTION schema_xyz.univ_first_pg(varchar);
CREATE OR REPLACE FUNCTION schema_xyz.univ_first_pg(str character varying)
RETURNS character varying
LANGUAGE plpgsql
AS $function$
DECLARE
ergebnis varchar(2000);
begin
-- 3 because ', Univ...'
select substr((regexp_matches(str, ', [A-Z ]*UNIV[A-Z ]*,'))[1], 3) ||' '||
REPLACE(str, (regexp_matches(str, ', [A-Z ]*UNIV[A-Z ]*,'))[1],',') into ergebnis;
if (ergebnis like 'UNIV STR%')
then return ltrim(rtrim(str));
else
RETURN ltrim(rtrim(ergebnis));
end if;
end;
$function$
;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment