create or replace function fun1(wncity in varchar2, ecity in varchar2)
return number
is
total number;
begin
select count(o.o_no) into total from Owner o, Estate e
where o.o_no=e.o_no and o.o_city=wncity
and e.e_city=ecity;
return total;
end;
select fun1('pune', 'pune') from dual;
Q2) create or replace trigger t1
before insert on Estate
for each row
begin
if(:new.e_price<100000) then
raise_application_error(-2013,'e_price should be greater then 100000');
end if;
end;