我如何修复在预期错误处找不到关键字!请任何人帮忙 谢谢
执行查询时未在预期位置找到 FROM 关键字
String query = "select bc.institution_code,bc.branch_code,tmp.order_channel,tmp.order_root_div,"
+ "count(ls.session_id) as tenlogincount from branch bc,login_session ls,(select a.session_id,a.branch_id,"
+ "b.order_channel,c.order_root_div from(select session_id,property_value as branch_id"
+ "from login_session_property where property_name = 'branchID') a,(select session_id,"
+ "property_value as order_channel from login_session_property where property_name = 'orderChannel') b,"
+ "(select session_id,property_value as order_root_div from login_session_property"
+ "where property_name = 'orderRootDiv') c where a.session_id = b.session_id"
+ "and b.session_id = c.session_id) tmp where to_char(ls.creation_date, 'YYYY-MM-DD') = ?"
+ "and ls.type_id in (select type_id from login_type where type_name like '%customer_login_type%')"
+ "and ls.session_id = tmp.session_id and bc.branch_id = tmp.branch_id"
+ "and ((to_char(ls.creation_date,'HH24MI') <= ? and to_char(ls.last_update,'HH24MI') >= ?"
+ "and ls.validity <> 0) or (to_char(ls.creation_date,'HH24MI') <= ?"
+ "and to_char(ls.expiration_date,'HH24MI') >= ? and ls.validity = 0)) group by bc.institution_code,"
+ "bc.branch_code,tmp.order_channel,tmp.order_root_div";
最佳答案
连接字符串时需要用空格分隔单词。
例如,在第 3 行的末尾 asbranch_id
与第 4 行的开头fromlogin_session_property
之间。这将成为来自login_session_property的branch_id
。看到错误了吗?这没有道理。
只需确保在每行末尾添加一个空格,以确保在构建整个字符串时分隔单词。第 3 行的末尾应类似于 asbranch_id
<-- 此处末尾有一个额外的空格。
你有好几行都有同样的错误。
关于java - 未在预期位置找到关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50341270/