We found an issue, which delete all the rows in the DB table , though we need to delete only one record. We delete using PL/SQL.
We found this is due to we define the PL/SQL input parameter name same as delete table column name. Then we rename the proc to change the email parameter as p_email. Presentation
FUNCTION DELETE_INTERVIEW_ROWS (email IN VARCHAR2)
RETURN VARCHAR2 AS
wk_message varchar2(100);
BEGIN
DELETE FROM INTERVIEW interv
WHERE interv.EMAIL = email;
wk_message := 'Success';
commit;
return wk_message;
EXCEPTION
WHEN OTHERS THEN
wk_message := 'Not Success';
return wk_message;
END;
----------------------------------------------
SOLUTION
FUNCTION DELETE_INTERVIEW_ROWS (p_email IN VARCHAR2)
RETURN VARCHAR2 AS
wk_message varchar2(100);
BEGIN
DELETE FROM INTERVIEW interv
WHERE interv.EMAIL = p_email;
wk_message := 'Success';
commit;
return wk_message;
EXCEPTION
WHEN OTHERS THEN
wk_message := 'Not Success';
return wk_message;
END;
----------------------------------------------
No comments:
Post a Comment