0
votes

How should I end the transaction below so that I don't receive anymore the error:

Line/Col: 30/19 PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge json_exists json_value json_query json_object json_array

create or replace function ueberweisung (a varchar2, b varchar2,c number)  

RETURN varchar2 IS  
pragma autonomous_transaction;
k1 number; -- Variablendeklaration  
k2 number; 

BEGIN  

SELECT saldo into k1  
FROM konto  
WHERE konto_nr=a;  

SELECT saldo into k2  
FROM konto  
WHERE konto_nr=b;  

k1:=k1-c; 
k2:=k2+c; 
begin transaction;
update konto
set saldo = case konto_nr
when a then k1
when b then k2
else saldo
end;
commit;
RETURN (c ||' Eur überwiesen von Konto ' || a || 'auf Konto ' || b);  
END ueberweisung;
1
As you have been told in your other question you can't use DML statements inside a functiona_horse_with_no_name

1 Answers

1
votes

"begin transaction" is t-sql, not Oracle pl/sql.

It is interpreted as "begin" with label "transaction". There is no matching "end" with this "begin".

Solution: remove this line, since it is unnecessary anyway.