Created
December 11, 2009 21:16
-
-
Save mmattozzi/254521 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delimiter $$ | |
create trigger HELLO_CUSTOM_FIELD_INSERT_TRIGGER after insert on HELLO_CUSTOM_FIELD for each row | |
begin | |
declare l_count int default 0; | |
select count(*) | |
from HELLO_CUSTOM_FIELD hcf | |
where | |
hcf.owner_uri_path_id = new.owner_uri_path_id and | |
hcf.owner_uri_ref = new.owner_uri_ref and | |
hcf.namespace_prefix = new.namespace_prefix and | |
hcf.namespace_prefix <> '' and | |
hcf.namespace <> new.namespace and | |
hcf.id <> new.id | |
into l_count; | |
if l_count > 0 then | |
insert into ERROR (message) values ('Namespace prefix cannot be shared by multiple namespaces'); | |
end if; | |
select count(*) | |
from HELLO_CUSTOM_FIELD hcf | |
where | |
hcf.owner_uri_path_id = new.owner_uri_path_id and | |
hcf.owner_uri_ref = new.owner_uri_ref | |
into l_count; | |
if l_count > 100 then | |
insert into ERROR (message) values ('Each account is limited to 100 custom fields for each object type'); | |
end if; | |
end; | |
$$ | |
delimiter ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment