create or replace procedure P_ADD_PERSON( p_NAME in PERSON.NAME%TYPE, p_SAL in PERSON.SAL%TYPE, p_ID out PERSON.ID%TYPE) is n_count INTEGER; begin if (TRIM(p_NAME) IS NULL or LENGTH(TRIM(p_NAME)) < 1) then RAISE_APPLICATION_ERROR(-20101, 'Name should be not null and at least 2 symbols'); end if; if (p_SAL IS NULL or p_SAL <= 0) then RAISE_APPLICATION_ERROR(-20102, 'Salary should be positive'); end if; select count(*) into n_count from PERSON where UPPER(TRIM(NAME)) = UPPER(TRIM(p_NAME)); if (n_count > 0) then RAISE_APPLICATION_ERROR(-20103, 'Person with name ' || p_name || ' already exists'); end if; p_ID := seq_person.nextval; insert into PERSON(ID,NAME,SAL) values (p_ID, p_NAME, p_sal); end P_ADD_PERSON; /