Validating date during insert operation in pl sql with examples
One of the key goals when building applications is to make sure the data you enter into the database meets all your business rules.Data validation is a critical part of your application to ensure your data meets the requirements developed by your business analysts.
A common use is to provide a primary key with a value from a sequence in a before-insert trigger.
: New and : Old Value can be differentiated in DML Statements .
Insert -- : Old = NULL : New= Inserted new value Update -- : Old = Value present in table before the Update statement Triggered : New = Given new value to Update Delete -- : Old = Value before deletion : New = NULL CREATE OR REPLACE TRIGGER get_dept BEFORE DELETE OR INSERT OR UPDATE ON employees FOR EACH ROW BEGIN DBMS_OUTPUT.
Hence, we can use easy conversion functions to convert this to hours or minutes.
However, when the minutes are not a whole number, we have the problem of trailing decimal places: We can use these Oracle SYSDATE functions to convert an elapsed time into rounded elapsed minutes, and place the value inside an Oracle table.