diff --git a/Practical/Practical Exam/PL-SQL/P7 - Age_calc.md b/Practical/Practical Exam/PL-SQL/P7 - Age_calc.md index f634399..ffb278d 100644 --- a/Practical/Practical Exam/PL-SQL/P7 - Age_calc.md +++ b/Practical/Practical Exam/PL-SQL/P7 - Age_calc.md @@ -1,9 +1,11 @@ # P7 - Age_calc function +**Problem statement:** Create a stored function titled 'Age_calc'. Accept the date of birth of a person as a parameter. Calculate the age of the person in years, months and days e.g. 3 years, 2months, 10 days. Return the age in years directly (with the help of Return statement). The months and days are to be returned indirectly in the form of OUT parameters. + ## Creating function ```sql -CREATE OR REPLACE FUNCTION P7( +CREATE OR REPLACE FUNCTION Age_calc( dob IN DATE, f_month OUT NUMBER, f_day OUT NUMBER @@ -46,7 +48,7 @@ DECLARE months NUMBER; days NUMBER; BEGIN - years := P7(TO_DATE('2003-12-02', 'YYYY-MM-DD'), months, days); + years := Age_calc(TO_DATE('2003-12-02', 'YYYY-MM-DD'), months, days); DBMS_OUTPUT.PUT_LINE('Age: ' || years || ' Years ' || months || ' Months ' || days || ' Days.'); END; /