我试图通过在动态查询中使用union来查询来自3个差异表的数据,但是当我这样做时,我没有得到任何编译错误,但是我得到以下错误:
ORA-00933:SQL命令未正确结束 ORA-06512:在“XXXXXXXX”,第38行
以下是代码:
[1] pry(main)> Customer = Struct.new(:mula, :alu, :lorem)
=> Customer
[2] pry(main)> a = Customer.new('khao', 'khamu na', 'You can use the PrettyPrint standard library included in Ruby.')
=> #<struct Customer mula="khao", alu="khamu na", lorem="You can use the PrettyPrint standard library included in Ruby.">
[3] pry(main)> pp a
#<struct Customer
mula="khao",
alu="khamu na",
lorem="You can use the PrettyPrint standard library included in Ruby.">
=> #<struct Customer mula="khao", alu="khamu na", lorem="You can use the PrettyPrint standard library included in Ruby.">
[4] pry(main)>
另外,如果我在动态查询中只使用1个select语句,那么它可以工作。
答案 0 :(得分:0)
以下是示例代码,我认为您需要检查您的sql是否正确生成
JPA Repository