We need to INSERT or UPDATE data of table consultant_skill , create needed functions, procedures … that accepts consultant id, skill id, and certification status for the task. The procedure should be user friendly enough to handle all possible errors such as consultant id, skill id do not exist OR certification status is different than ‘Y’, ‘N’. Make sure to display: Consultant last, first name, skill description and the confirmation of the DML performed (hint: Do not forget to add COMMIT inside the procedure)
CREATE OR replace PROCEDURE nw (p_c_id NUMBER,
p_s_id NUMBER,
p_certification VARCHAR2)
AS
v_c_id NUMBER := p_c_id;
v_s_id NUMBER := p_s_id;
v_certification VARCHAR2(20);
flag NUMBER(3);
BEGIN
SELECT count(*)
INTO flag
FROM consultant_skill
WHERE c_id = v_c_id
AND skill_id = v_s_id;
dbms_output.Put_line (flag);
IF flag > 0 THEN
UPDATE consultant_skill
SET skill_id = p_s_id,
certification = p_certification
WHERE c_id = v_c_id;
ELSE
dbms_output.Put_line ('bye bye');
END IF;
END;
/
Stuck on update itself.. yet to try insert in else block.. first trying on update part.. dnt know if it is write or not
But on compiling the samd it is showing ora 00001: unique constraint violated