Skip to main content

OpenESQL - SQL TYPE is TIMESTAMP

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

Tips on how to use data type 'SQL TYPE is TIMESTAMP' vs. MSSQLSERVER also ORACLE database.

Column in MSSQLSERVER is declared as 'DATETIME'.

Column in ORACLE is declared as 'DATE'.

Both databases reflect a date format 'dd.mm.yyyy hh:mm:ss' which is different to

'yyyy-mm-dd hh:mm:ss' by default.

Resolution:

A string should be redefined as follows, i.e.:

02  upd-date.

    05  upd-dd           pic 99.

    05  filler          pic x     value ".".

    05  upd-mm          pic 99.

    05  filler          pic x     value ".".

    05  upd-yyyy       pic 9(4).

    05  filler          pic x     value " ".

    05  upd-hh          pic 99.

    05  filler          pic x     value ":".

    05  upd-min        pic 99.

    05  filler          pic x     value ":".

    05  upd-ss          pic 99.

02  filler              redefines upd-date.

    05  upd-datetime     pic x(19).

Microsoft's SQLSERVER accepts a column as of DATETIME from host variable :upd-datetime directly.

Additionally, Oracle needs a conversion using a column as of DATE:

to_date(:upd-datetime,'DD.MM.YYYY HH24:MI:SS')

Both databases accept the upd-datetime redefined string only.

Old KB# 5213

0 replies

Be the first to reply!