如何從java中調用oracle函數?如何從java中調用oracle函數
我有一個預言函數aaa.fucntion(號碼,日期);,此方法返回true或false。怎麼從java調用這個並獲得返回的值?
我使用Hibernate
這是我嘗試過,
Session session = null;
String associateHistorySQL="";
try {
session = HibernateUtil.currentSession();
associateHistorySQL = "SELECT aa.myFunction(:aorId,:givenDate) from dual";
Query associateHistoryQuery = session.createQuery(associateHistorySQL);
associateHistoryQuery.setParameter("aorId", associateOfficeRecordId);
associateHistoryQuery.setParameter("givenDate", date);
List associateHistoryList = associateHistoryQuery.list();
if (associateHistoryList != null && associateHistoryList.size() > 0 && new Integer(associateHistoryQuery.uniqueResult().toString()) > 0)
return true;
else
return false;
} finally {
HibernateUtil.cleanUpHibernateFromDao(false);
}
這是例外,我得到unexpected token: aa: line 1:1: unexpected token: aa
感謝
一個SQL查詢?你嘗試了什麼,你卡在哪裏? –
嗨@ErwinBolwidt,啓動服務器,將在幾分鐘內發佈堆棧跟蹤。 –
@ErwinBolwidt,你現在可以看看編輯嗎? –