RDBMS_PRACT_6_C



Assignment 6 Exception Handling : SET C


1)

buss4=# create or replace function f4(d date) returns text as'
declare
rec record;
nm driver.dname%type;
begin
for rec in select * from bd
loop
if(rec.duty_date<>d)then
raise notice''Date Is Invalid'';
else
select dname into nm from driver where dno in(select dno from bd where shift=''m'' and shift=''e'' and duty_date=d);
end if;
end loop;
raise notice''dname=%'',nm;
return'' '';
end'
language 'plpgsql';
CREATE FUNCTION

buss4=# select f4('2009-04-03');
NOTICE:  Date Is Invalid
NOTICE:  dname=
 f4
----
 
(1 row)

buss4=#

No comments:

Post a Comment