2021年4月4日星期日

Oracle SQL set sql values to variable

I am trying to compare dates between the same table. I wanted to store each value to a variable and compare the if there is a month difference between the two dates.

Here is my table structure:

TABLE NAME: SYSTEMPARAM
SEQNO - INT primary key
SYSTEMDATE - DATE

Here is what I want to achieve:

var startdate = "SELECT SYSTEMDATE FROM SYSTEMPARAM WHERE SEQNO = '1'";  var enddate = "SELECT SYSTEMDATE FROM SYSTEMPARAM WHERE SEQNO = '2'";    if(MONTHS_BETWEEN(startdate , enddate ){      //Conditions here  }  

I want to compare if there is a month difference between two sql statement.

https://stackoverflow.com/questions/66947189/oracle-sql-set-sql-values-to-variable April 05, 2021 at 09:05AM

没有评论:

发表评论