Practice 1: Changes to data will only be allowed on tables
during normal office hours of 8.45 in the morning until
5.30 in the afternoon, MONDAY through FRIDAY.
A. Create a procedure called SECURE_DML that prevents the
DML statement from executing outside of normal office
hours, returning the message:
“you may only make changes during normal office hours”
b. Create a statement trigger on the PRODUCT table which
calls the above procedure.
c. Test it by inserting a new record in the PRODUCT table.
Answer Posted / narenkumar reddy
create or replace
procedure SECURE_DML
is
begin
if to_char(sysdate,'h24:mi') not between '08:30' and '17:30' and
to_char(sysdate,'day') not between 'MONDAY' and 'FRIDAY' then
raise_application_error(-20001,'you may only make changes during normal
office hours');
end if;
end;
create or replace
trigger trigger_name
before insert or update or delete on PRODUCT
begin
SECURE_DML( );
end;
| Is This Answer Correct ? | 22 Yes | 3 No |
Post New Answer View All Answers
What are the different datatypes available in PL/SQL?
What is the difference between a database and a relational database?
Explain what is rdbms?
What are the two types of periodical indexes?
Why schema is used in sql?
How do I view a table in sql?
how to drop an existing view in mysql? : Sql dba
What is a dynamic query?
How do you identify a primary key?
What is Histogram?
In a distributed database system, can we execute two queries simultaneously?
Can you inner join the same table?
what are the advantages a stored procedure? : Sql dba
what is a trigger? : Sql dba
how can you create an empty table from an existing table? : Sql dba