我正在努力弄清楚为什么这段代码没有编译。我得到的确切错误是:
ERROR at line 82:
ORA-06550: line 82, column 4:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
( begin case declare end exit for goto if loop mod null
pragma raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
我尝试做的事情是从临时表&#34; new_Transactions&#34;中获取一系列交易,然后将它们添加到另外几个表中,&#34; Account&#34;,& #34; Transaction_History&#34;和&#34; Transaction_Detail&#34;。 new_transaction表可以为每个事务提供多个借方和贷方,因此嵌套应该将所有事务读入文件中。
我一直在努力弄清楚错误的位置已经有一段时间了,我承认SQL不是我的强项,所以如果有明显可怕的错误,请告诉我。
DECLARE
r_transaction NEW_TRANSACTIONS%ROWTYPE;
CURSOR c_trans_no IS
SELECT *
INTO r_transaction
FROM new_transactions
ORDER BY transaction_no;
v_credit_check NEW_TRANSACTIONS.TRANSACTION_AMOUNT%TYPE;
v_debit_check NEW_TRANSACTIONS.TRANSACTION_AMOUNT%TYPE;
BEGIN
FOR r_transaction IN C_trans_no LOOP
v_debit_check:=0;
v_credit_check:=0;
DECLARE
r_test NEW_TRANSACTIONS%ROWTYPE;
CURSOR c_new_trans IS
SELECT *
INTO r_test
FROM new_transactions
WHERE transaction_no = r_transaction.transaction_no;
BEGIN
FOR r_test IN c_new_trans LOOP
DECLARE
v_number NUMBER(8,2);
rec_account ACCOUNT%ROWTYPE;
BEGIN
SELECT *
INTO rec_account
FROM ACCOUNT
WHERE account_no = r_test.account_no;
INSERT INTO TRANSACTION_HISTORY(transaction_no, transaction_date, description)
VALUES (r_test.transaction_no, r_test.transaction_date, r_test.description);
INSERT INTO TRANSACTION_DETAIL(account_no, transaction_no, transaction_type, transaction_amount)
VALUES (r_test.account_no, r_test.transaction_no, r_test.transaction_type, r_test.transaction_amount);
IF(r_test.transaction_type = 'D') THEN
v_debit_check := v_debit_check + r_test.transaction_amount;
CASE rec_account.account_type_code
WHEN 'A' THEN v_number := r_test.transaction_amount;
WHEN 'L' THEN v_number := -r_test.transaction_amount;
WHEN 'EX' THEN v_number := r_test.transaction_amount;
WHEN 'RE' THEN v_number := -r_test.transaction_amount;
WHEN 'OE' THEN v_number := -r_test.transaction_amount;
END CASE;
UPDATE ACCOUNT
SET account_balance = account_balance + v_number
WHERE r_test.account_no = rec_account.account_no;
ELSIF(r_test.transaction_type = 'C') THEN
v_credit_check := v_credit_check + r_test.transaction_amount;
CASE rec_account.account_type_code
WHEN 'A' THEN v_number := -r_test.transaction_amount;
WHEN 'L' THEN v_number := r_test.transaction_amount;
WHEN 'EX' THEN v_number := -r_test.transaction_amount;
WHEN 'RE' THEN v_number := r_test.transaction_amount;
WHEN 'OE' THEN v_number := r_test.transaction_amount;
END CASE;
UPDATE ACCOUNT
SET account_balance = account_balance + v_number
WHERE r_test.account_no = rec_account.account_no;
--ELSE
--ROLLBACK;
--INSERT INTO WKIS_ERROR_LOG(transaction_no, transaction_date, description, error_msg)
--VALUES (r_test.transaction_no, r_test.transaction_date, r_test.description, 'Not a Debit or a Credit');
END IF;
END lOOP;
--IF(v_credit_check != v_debit_check) THEN
--ROLLBACK;
--INSERT INTO WKIS_ERROR_LOG(transaction_no, transaction_date, description, error_msg)
--VALUES (r_transaction.transaction_no, r_transaction.transaction_date, r_transaction.description, 'Not a Debit or a Credit');
--END IF;
END LOOP;
END;
/
答案 0 :(得分:1)
我没有看到你的其中一个BEGIN语句的END。在第一个END LOOP语句后,您将缺少END。
@model IEnumerable<SO_GUI.Models.BillingValidation>
@{
ViewBag.Title = "Index";
}
<h2>Billing Validation</h2>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Section)
</th>
<th>
@Html.DisplayNameFor(model => model.Details)
</th>
<th>
@Html.DisplayNameFor(model => model.Total)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Section)
</td>
<td>
@Html.DisplayFor(modelItem => item.Details)
</td>
<td>
@Html.DisplayFor(modelItem => item.Total)
</td>
</tr>
}
</table>