Untitled

mail@pastecode.io avatar
unknown
pgsql
a year ago
483 B
2
Indexable
Never
do $$
declare
	unitid uuid;
	r record;
	begin
		for r in
		select * from "SysUserInRole" where "SysRoleId" = 'b9d7f112-20de-49f3-ad11-d6f7e6056d91'
		loop 
			if not exists(select * from "SysUserInRole" where "SysUserId" = r."SysUserId" and "SysRoleId" = '2ba9285d-a0ad-4570-84ad-1621135353f4') then 
			insert into "SysUserInRole"("SysUserId", "SysRoleId") VALUES(r."SysUserId", '2ba9285d-a0ad-4570-84ad-1621135353f4');
			end if;
		end loop;
	end;
$$ language PLPGSQL;