Kbase P8855: How to get the current date in SQL-92?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/18/2005 |
|
Status: Unverified
GOAL:
How to get the current date in SQL-92?
GOAL:
How to get the 4GL TODAY function's behavior in SQL92 ?
CAUSE:
The Progress SQL92 implementation does not share the functions used by the 4GL language thereby the usage of 4GL functions within SQL92 or Java code may result in errors at compile time.
FIX:
To get today's date in SQL-92, use the SYSDATE Function. The SYSDATE Function returns the current date as a DATE value. This function takes no arguments, and the trailing parentheses are optional:
Examples:
SELECT <fields> FROM <table> WHERE <date_field> <= SYSDATE;
SELECT * FROM PUB.Invoice WHERE InvoiceDate <= SYSDATE;
SELECT * FROM PUB.Invoice WHERE InvoiceDate <= SYSDATE + 7;
SELECT * FROM PUB.Invoice WHERE InvoiceDate > SYSDATE - 21;