Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can we use views in stored procedure?

1028


how would you enter characters as hex numbers? : Sql dba

973


What are sql objects?

1071


How do you copy a table in sql?

1057


What types of commands can be executed in sql*plus?

1101


Why is sql better than hql?

974


How to read/write files from pl/sql?

1030


How to order siblings in oracle hierarchy queries?

1032


What packages are available to pl/sql developers?

1040


Why left join is used in sql?

970


What are the qualities of 2nf?

1033


What are types of exception?

914


Explain aggregate functions are available there in sql?

997


How do I view a sql database?

1013


Can we insert delete data in view?

942