In the previous stored procedure, we didn’t do any validations for the information passed to it. But validating data is the most important priority for any type of solution. Validation of data can be achieved using several methods (at the database level). The simplest one involves using constraints. But constraints may not be suitable if we have any complex validations. The better option is to use database triggers. Database triggers are very similar to stored procedures, but they are automatically executed when the respective DML statement is issued on a table. We can use database triggers to validate the information and to perform a few calculations as well. As we are dealing with stored procedures, I would like to deal with validations (or even calculations) using stored procedures. Let us modify the previous stored procedure to handle a few validations as follows: create or replace procedure p_emp_insert (p_empno emp.empno%type, The next section will give you a complete explanation for the above stored procedure.
blog comments powered by Disqus |