关于读取oracle数据库一段时间数据

alexq08 2017-06-13 09:07:01
我刚开始学习pb和oracle,写了一个读取oracle数据库里一段时间数据的程序,在dw里显示出来。原本pb连接odbc数据库时是可以的,现在连接oracle数据库就不行了,提示“ora-00936:missing expression”请问要怎么改???
string ls_start,ls_end,ls_select
string ls_left ,ls_right

ls_start = em_1.text
ls_end = em_2.text
ls_select = ''

if rb_1.checked then
if not isnull(ls_start) and ls_start <> "" and lower(ls_start) <> 'none' then
ls_select = ls_select + " convert(date,bxtime) >= '" + ls_start + "'"
end if
if not isnull(ls_end) and ls_end <> "" and lower(ls_end) <> 'none' then
if ls_select = "" then
ls_select = " convert(date,bxtime) <= '" + ls_end + "'"
else
ls_select = ls_select + " AND convert(date,bxtime) <= '" + ls_end + "' "
end if

ls_select = is_sql + ' where ' + ls_select
if ls_select <> '' then
dw_1.setsqlselect(ls_select)
dw_1.setfilter("djid='"+trim(sle_1.text)+"'")
end if
end if

else
if not isnull(ls_start) and ls_start <> "" and lower(ls_start) <> 'none' then
ls_select = ls_select + " convert(date,cltime) >= '" + ls_start + "'"
end if
if not isnull(ls_end) and ls_end <> "" and lower(ls_end) <> 'none' then
if ls_select = "" then
ls_select = " convert(date,cltime) <= '" + ls_end + "'"
else
ls_select = ls_select + " AND convert(date,cltime) <= '" + ls_end + "' "
end if

ls_select = is_sql + ' where ' + ls_select
if ls_select <> '' then
dw_1.setsqlselect(ls_select)
dw_1.setfilter("clid='"+trim(sle_1.text)+"'")
end if
end if
end if
dw_1.retrieve()
...全文
102 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
小当家e 2017-06-13
  • 打赏
  • 举报
回复
你写个输出语句,调试输出 ls_select 结果看看
alexq08 2017-06-13
  • 打赏
  • 举报
回复
没错,我改成to_char就可以了
TheLittlePrince 2017-06-13
  • 打赏
  • 举报
回复
convert是sqlserver的写法,oracle里是to_date,to_char

752

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧