In Oracle, user can write the following statement to implement the conversion from date type to char type, how can I do that in DBMaker?
select * from QMDVFCMDBS where
sts_tkystr = to_char(sysdate,'yyyymmdd')

~ 0 min
2016-03-07 09:52

There also have conversion functions todate and datetostr in DBMaker which located in \DBMaker\x.x\shared\udf. It need user to create UDF first.

Alternatively, you can implement it by the statement:

select replace(cast(curdate() as char(10)),'-','') as new_char;

Suppose there is a table whose schema is:

create table SYSADM.B (

 STS_TKYSTR  CHAR(10) default null ,

 STS_TKYEND  CHAR(10) default null )

You can do the select as:

select * from b where STS_TKYSTR <= replace(cast(curdate() as char(10)),'-','') and STS_TKYEND >= replace(cast(curdate() as char(10)),'-','');

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags