how do you restrict number of rows for a particular value
in a column.For example:there is a table called
fruits,having apples,bananas ,papayas.I dont want to have
more than 100 apples in that table ,so how can u restrict
number of rows for apple to hundred?
Answer Posted / bikash khuntia
We have to create a trigger for that which is one of the
way for the solutuion as below:-
create or replace trigger trigger_name
before insert on table_name
for each row
DECLARE
v_count number;
begin
select count(apple) into v_count from table_name;
if v_count=100 then
raise_application_error('-20011','u cant insert more than
100 apples in the table');
end if;
end;
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Can we use views in stored procedure?
how would you enter characters as hex numbers? : Sql dba
What are sql objects?
How do you copy a table in sql?
What types of commands can be executed in sql*plus?
Why is sql better than hql?
How to read/write files from pl/sql?
How to order siblings in oracle hierarchy queries?
What packages are available to pl/sql developers?
Why left join is used in sql?
What are the qualities of 2nf?
What are types of exception?
Explain aggregate functions are available there in sql?
How do I view a sql database?
Can we insert delete data in view?