我无法更改ln_graph_debt.date_red
CREATE OR REPLACE PROCEDURE GetContactFormalNames
AS
aki DATE := TRUNC (SYSDATE - 3);
aki_1 DATE := TRUNC (ln_graph_debt.date_red);
BEGIN
IF (aki_1 = aki)
THEN
DECLARE account_name_1 AS INT*/
INSERT INTO TEL_LOAN_GRAPH (loan_id,
TOTAL_COUNTED,
DATE_RED,
OBLIGATE_NUMBER,
ACCOUNT_CODE,
ACCOUNT_NAME)
SELECT d.loan_id,
CAST (d.summ_red AS NUMBER) + CAST (p.summ_red AS NUMBER)
AS Total_Counted,
d.date_red,
d.obligate_number,
l.account_code,
l.account_name
FROM ln_graph_debt d, ln_graph_perc p, ln_account l
WHERE d.loan_id = p.loan_id
AND d.loan_id = l.loan_id
AND p.date_red = d.date_red;
END IF;
END GetContactFormalNames;
答案 0 :(得分:0)
这是错误的:
aki_1 DATE := TRUNC (ln_graph_debt.date_red);
您不能以这种方式引用表;您将必须SELECT
进入变量,或编写一个将返回值的函数。
select d.date_red
into aki_1
from ln_graph_debt d
where ...
WHERE
子句应包含一个条件,以便SELECT
仅返回单个值;否则,您会得到TOO-MANY-ROWS
(或者也许是NO-DATA-FOUND
)。
还有一个明显的错误,DECLARE
中多余的IF
。您可能想发表评论?