Page 1 of 1

Problem with months_between

Posted: Tue Feb 19, 2019 4:30 am
by Krishna1944
Hello

I am having problem in months between function.

Query :- Calculate the age of student.
select stu_name,months_between(sysdate,stu_birth_date)/12 from stu_mast;

Error :- The data content could not be loaded.

Access is denied: MONTHS_BETWEEN in statement [select stu_name,months_between(sysdate,stu_birth_date)/12 from stu_mast;]

Please give me solution of this query.

Re: Problem with months_between

Posted: Tue Feb 19, 2019 10:59 am
by Villeroy
If this is an embedded HSQLDB, the statusbar looks like this:
Image

That database is documented here: http://www.hsqldb.org/doc/1.8/guide/ch09.html
It comes with function DATEDIFF. Try this:

Code: Select all

SELECT "stu_name", DATEDIFF( 'month', "stu_birth_date", CURRENT_DATE) from "stu_mast"