SQL statement example 3

This is an example of setting dynamic functions in the SQL pane of the Database Inbound or Database Outbound database protocol.

For example, a SQL statement must be run that selects * from patients where dateOfBirth is today(). This example shows how to handle today(), without hardcoding the current date in the SQL statement.

For this, each database provides its own date/time functions.

On an Oracle database, you can use sysdate or to_char(sysdate, ‘format’)/to_date(sysdate, ‘format’) to do it.

Command issued:

hcidbprotocoltest oracle_select

The SQL that was run is:

select * from Table_sanity where DATEFLD = TRUNC(SYSDATE,'DD') 

Command output:

Read 1 message(s) from DB.
    key01,test1,1,2014-10-01,1
inbound db thread