【发布时间】:2012-05-15 09:37:25
【问题描述】:
我创建了一个case类和一个伴生对象来执行一个查询,如下:
case class Instruction(caseid:Long, day:String, period:String)
object Instruction{
val rt = {
get[Long]("caseid") ~
get[String]("day") ~
get[String]("period") map{
case caseid~day~period => RealTimeInstruction(caseid, day,period)
}
}
def findAll(date:String):List[RealTimeInstruction]={
DB.withConnection{
implicit c => SQL("""
select
unit.CASEID "CASEID",
to_char(c.GETLOCALDATE(unit.START_TIME), 'DD-MON-YY') as "DAY",
case when to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24') LIKE '0%'
then to_number(substr(to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24'),2))
else to_number(to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24'))
end "PERIOD"
from unit, entity_def, entity
........
""").on('date->date).as(rt *)
}
}
}
执行 findAll 产生 ORA-00942:表或视图不存在
查询 h 我们可以正常工作。我猜这与期望在数据库中找到指令表的异常框架有关。
我想要做的基本上是在异常情况下执行参数化查询并检索和解析结果。
我该怎么做?
谢谢
【问题讨论】: