Mate_Sql常用的函数,主要是时间的…
Date
当前日期:%CurrentDateIn
通常可以使用在SQL select 或 update 语句的where 条件语句中,表示当前系统日期时间;
1 2
| select * from tbl t where t.effdt < %CurrentDateIn; update tbl t set t.name = "修改" where t.effdt < %CurrentDateIn;
|
Time
当前时间:%CurrentTimeIn
通常可以使用在SQL select 或 update 语句的where 条件语句中,表示当前系统时间;
1 2
| select * from tbl t where t.effdt < %CurrentDateIn; update tbl t set t.name = "修改" where t.effdt < %CurrentDateIn;
|
%EffDtCheck
通常可以使用在SQL where 条件语句中,获取小于指定日期的最大生效日期的数据;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| %EffDtCheck(recordname , r1, as_of_date)
SELECT . . . FROM. . . WHERE correlation_id.EFFDT = (SELECT MAX(EFFDT) FROM recordname WHERE recordname.KEYFIELD1 = correlation_id.KEYFIELD1 AND recordname.KEYFIELD2 = correlation_id.KEYFIELD2 AND. . . AND recordname.EFFDT <= %DATEIN(as_of_date));
SQLExec("SELECT FNUM FROM PS_REC A WHERE %EffDtCheck(:1, A, :2)", &Rec, &Date);
|
%table()
1 2 3
| SELECT J.EMPLID, J.EMPL_RCD, J.EFFDT, J.EFFSEQ FROM %TABLE(JOB) J ; 等价于 SELECT J.EMPLID, J.EMPL_RCD, J.EFFDT, J.EFFSEQ FROM PS_JOB J ;
|