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 having without group by in sql?
How much does sql cost?
Where the sql database files are stored?
Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints
What is sql trigger example?
What is null in pl/sql?
How do I view a view in sql?
Is sql better than excel?
Which software is used for pl sql programming?
What is triggering circuit?
Is sql workbench free?
What is the difference between inner join and outer join?
Does sql view stored data?
Can a table contain multiple foreign key’s?
How sql query is executed?