我遇到了将查询输出导出到GemFireXD中的.csv文件的问题我有这个命令:
CALL SYSCS_UTIL.EXPORT_QUERY('select * from table where logtime >= '2017-02-26 00:00:00' and logtime <= '2016-02-27 00:00:00' order by logtime asc;', '/home/user/smsgateway-stats/smsgateway-stats-2017-02-26.csv', null, null, null);
GemFireXD似乎不喜欢围绕WHERE子句中日期的那些单引号。
注意:logtime字段是TIMESTAMP数据类型。
答案 0 :(得分:0)
使用其中两个来表示您的意思是单引号:
,然后单击时间戳周围的单引号CALL SYSCS_UTIL.EXPORT_QUERY('select * from table where logtime >=
''2017-02-26 00:00:00'' and logtime <= ''2016-02-27 00:00:00'' order by
logtime asc;',
'/home/user/smsgateway-stats/smsgateway-stats-2017-02-26.csv', null, null, null);
参考: What is the correct way to include a variable inside an Apache derby Export_Query