如果我尝试将(, CCY_TO_BASE_RATE = EXCHANGERATE.MID_RATE)
添加到更新语句中,则会显示以下错误。
ORA-06550: line 8, column 21:
PL/SQL: ORA-00923: FROM keyword not found where expected
ORA-06550: line 6, column 1:
PL/SQL: SQL Statement ignored
但是,如果没有(, CCY_TO_BASE_RATE = EXCHANGERATE.MID_RATE)
,则该语句有效。
那么我如何编辑我的代码以使该语句有效?
DECLARE
v_system_base_ccy NVARCHAR2(10);
BEGIN
v_system_base_ccy := dbo.Fn_parameter('SYSTEMBASECCY');
UPDATE tbl_dvcollateral A
SET coll_value_base = (SELECT coll_value * Nvl(EXCHANGERATE.mid_rate, 1),
ccy_to_base_rate = EXCHANGERATE.mid_rate
FROM (SELECT mid_rate,
from_ccy
FROM TABLE(
dbo.Fn_exchangeratetable(:V_AS_OF_DATE,
NULL,
v_system_base_ccy) )
)EXCHANGERATE
WHERE A.ccy = EXCHANGERATE.from_ccy(+)),
last_updated_by = :V_LOGIN_ID,
last_updated_datetime = To_timestamp(To_char(systimestamp,
'YYYY-MM-DD HH24:MI:SS'),
'YYYY-MM-DD HH24:MI:SS')
WHERE as_of_date = :V_AS_OF_DATE
AND record_status_id = :V_AUTHORIZED;
END;
答案 0 :(得分:1)
我可能误解了你正在做的事情,但你似乎在更新声明的错误一侧有目标列:
UPDATE tbl_dvcollateral A
SET (coll_value_base, ccy_to_base_rate) =
(SELECT coll_value * Nvl(EXCHANGERATE.mid_rate, 1),
EXCHANGERATE.mid_rate
FROM (SELECT mid_rate,
...
答案 1 :(得分:0)
在第8行,你有
ccy_to_base_rate = EXCHANGERATE.mid_rate
作为select-expression。这在技术上是Oracle SQL不能容忍的布尔值。 您需要删除此表达式。我不知道你需要更换它,因为我不知道你试图制定什么。