plsql - PLS-00103 ERROR, what is wrong in the code -
create or replace procedure proc2_del_rows (v_tname varchar2, v_condition varchar2 default null) sql_stmt varchar2(500); where_clause varchar2(200) := 'where'||' '||v_condition; begin if v_condition null where_clause := null; end if; sql_stmt := 'delete :1'||' '||where_clause; execute immediate sql_stmt using v_tname; commit; end; /
the table name can't bind variable. dbms_assert
on input table name parameter , make sure valid table name literal, , directly concatenate delete statement. @ least protect against sql injection.
i'd know reason behind doing delete using procedure , granting execute on procedure individual users, rather granting delete on table user directly, easier control/restrict. don't see how better in terms on security if going for.
Comments
Post a Comment