This example shows how to raise errors

 DECLARE
    e_rec emp%ROWTYPE;
    e1 EXCEPTION;
    sal1 emp.sal%TYPE;
 BEGIN
    
    SELECT sal INTO sal1 FROM emp WHERE deptno = 30 AND ename = 'WARD';
    IF sal1 < 5000 THEN
    RAISE e1;
    END IF;
 EXCEPTION
    WHEN no_data_found THEN
    RAISE_APPLICATION_ERROR (-20001, 'WARD is not there.');
 WHEN e1 THEN
    RAISE_APPLICATION_ERROR (-20002, 'Less Salary.');
 END;