I have created the age calculator using PLSQL,
In this user input the date of birth and the age is shown as result.
A function names age_calculator returns the age by taking the input as date of birth,you can also use procedure here.
declare
output number;
function age_calculator return number
as
age number;
begin
select round(ceil(sysdate-to_date('&enter_DOB','dd/mm/yyyy'))/365) into age from dual;
return age;
end;
begin
output :=age_calculator();
dbms_output.put_line('age is :'||output);
end;
In this user input the date of birth and the age is shown as result.
A function names age_calculator returns the age by taking the input as date of birth,you can also use procedure here.
program
declare
output number;
function age_calculator return number
as
age number;
begin
select round(ceil(sysdate-to_date('&enter_DOB','dd/mm/yyyy'))/365) into age from dual;
return age;
end;
begin
output :=age_calculator();
dbms_output.put_line('age is :'||output);
end;
No comments:
Post a Comment