-1

我在 Talend 中使用组件 tDBRow 执行一个简单的查询,如下所示:

" 
insert into test.wk_sf_l_srv_cshistory_to_load select
ID, 
CREATEDDATE
from test.CASE_HISTORY_FULL
where createddate >=  " +context.builtIn_lastRunDate +  " "

但是当我启动我的工作时,错误ora-00933 sql command not properly ended就会弹出。这是上下文变量使用问题吗?我已经搜索并看到我可以这样写,但它不起作用。

编辑我在 SQL Developer 中尝试了相同的查询,使用随机日期,并且没有给出错误。

4

1 回答 1

0

问题是您没有正确构建查询。我猜context.builtIn_lastRunDate是一个字符串,所以你应该用引号将它括起来,如下所示:

"insert into test.wk_sf_l_srv_cshistory_to_load select
ID, 
CREATEDDATE
from test.CASE_HISTORY_FULL
where createddate >=  '" + context.builtIn_lastRunDate +  "'"

如果context.builtIn_lastRunDate是日期类型,则需要将其格式化为如下字符串:

".. where createddate >= '" + TalendDate.formatDate("<date format here>", context.builtIn_lastRunDate) + "'"
于 2018-10-20T15:11:33.107 回答