Question

Use date user published parameters in SQLCreator


Hello,

I am reading my oracle non spatial database with an SQL query containing couple of dates. When inputting the dates directly in the query, there is no problem and it runs smoothly.

I would like to make user parameters from these dates. So I have created published user parameters choosing 'date' as type.

I then try to use the parameter in my SQL query (where clause) but I get a type error over and over. I have tried couple of different notations but it doesn't seem to work...

This works (without parameters)

 

AUTO_START_DATE <= TO_DATE('15/12/2019', 'DD/MM/YYYY')

Then I tried several variation to use :

 

$(START_DATE)

but I can't seem to find the right syntax.

Thank you


4 replies

Userlevel 2
Badge +16

Did you try AUTO_START_DATE <= TO_DATE('$(START_DATE)', 'YYYY-MM-DD')

Userlevel 4

The DATE-type parameter returns an "FME date" string, so you should use

to_char('$(START_DATE)', 'YYYYMMDD')

Notice the form YYYYMMDD.

Userlevel 1
Badge +21

The parameter is stored in FME format, i think you will need to use something like

AUTO_START_DATE <= TO_DATE($(START_DATE), 'YYYYMMDD')
Userlevel 2
Badge +16

Did you try AUTO_START_DATE <= TO_DATE('$(START_DATE)', 'YYYY-MM-DD')

Did some testing and @egomm is right.

It should be:

AUTO_START_DATE <= TO_DATE('$(START_DATE)', 'YYYYMMDD')

Reply