Hello All,
I am trying to use a Database Join step in order to invoke PostgreSQL for finding the hunber of days on the month before a given date by using the following SELECT statement:
SELECT
DATE_PART('days', DATE_TRUNC('month', timestamp ?)
- (DATE_TRUNC('month', timestamp ?)
- '1 MONTH'::INTERVAL) ) as billdays
I have tried this already on Postgre's PGAdmin III tool (with the appropriate changes for the ? parameter replacement) and it goes fine.
When I run the SQL above in my transformation in Spoon, however, I get the following error:
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : Ocorreu um erro de banco de dados:
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - Couldn't get field info from [SELECT
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - DATE_PART('days', DATE_TRUNC('month', timestamp ?)
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - - (DATE_TRUNC('month', timestamp ?)
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - - '1 MONTH'::INTERVAL) ) as billdays]
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 -
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - ERROR: syntax error at or near "$1"
2015/09/25 15:17:32 - org.pentaho.di.trans.steps.databasejoin.DatabaseJoinMeta@6e93b440 - Posição: 58
The 58th position falls precisely at the first ? for parameter replacement.
What am I doing wrong? Is there a smarter way of determining the number of days of a monthe referred by a date?
Thank you!
The step configuration screen looks like below:
Captura de tela de 2015-09-25 15:19:34.jpg