Reputation: 391
I need to delete selective rows from Database using pl/sql procedure. But it deletes all rows irrespective of what is in where clause.
The student table is:-
id name class
1 danial 9
2 patrick 9
3 paul 8
create or replace procedure delete_student (stId in NUMBER)
begin
delete from students where class = stId;
commit;
end;
I call this procedure from jsf application sending, say 9 as argument. However, this procedure in effect deletes all three rows in the student table irrespective of the value of argument stId which outputs correctly in the DBMS_OUT console. What am i doing wrong.
Upvotes: 0
Views: 765
Reputation: 35401
Does the name of the parameter coincide with the name of a column in the table ?
It is good practice to name parameters and variables with a prefix (such as p_, v_) so that SQL statements are unambiguous when differentiating between column names and variable / parameter names.
Upvotes: 1