How to subtract years from sysdate

后端 未结 1 1019
花落未央
花落未央 2021-02-12 11:07

What would be the expression to check if someone\'s 20 years or over without hard-coding the date?

In the SQL

 SELECT student_fname 
 FROM students
 WHE         


        
1条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-12 11:46

    WHERE dob < add_months( trunc(sysdate), -12*20 );
    

    would work assuming that you want to ignore the time component of sysdate.

    0 讨论(0)
提交回复
热议问题