oppijanumerorekisteri
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
insertpalvelu(character varying, character varying)
Parameters
Name
Type
Mode
character varying
IN
character varying
IN
Definition
declare role_name alias for $1; role_text_fi alias for $2; _role_exists bigint; begin select count(*) into _role_exists from palvelu where name = role_name; if _role_exists = 0 then insert into text_group (id, version) values (nextval('public.hibernate_sequence'), 1); insert into text (id, version, lang, text, textgroup_id) values (nextval('public.hibernate_sequence'), 1, 'FI', role_text_fi, (select max(id) from text_group)); insert into text (id, version, lang, text, textgroup_id) values (nextval('public.hibernate_sequence'), 1, 'SV', role_text_fi, (select max(id) from text_group)); insert into text (id, version, lang, text, textgroup_id) values (nextval('public.hibernate_sequence'), 1, 'EN', role_text_fi, (select max(id) from text_group)); insert into palvelu (id, version, name, palvelutyyppi, textgroup_id) values (nextval('public.hibernate_sequence'), 1, role_name, 'YKSITTAINEN', (select max(id) from text_group)); end if; return 1; end;