user366312
user366312

Reputation: 16896

Why is this sql query giving syntax error?

begin transaction;
update employee set id = id/10;
update sales set employee_id = employee_id/10;
commit;

The error message:

Error starting at line 1 in command:
begin transaction;
update employee set id = id/10;
update sales set employee_id = employee_id/10;
commit; 
Error report:
ORA-06550: line 4, column 8:
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
   <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
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

Upvotes: 0

Views: 1865

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172408

Try this:

begin 
update employee set id = id/10;
update sales set employee_id = employee_id/10;
commit;
end;

Upvotes: 4

Related Questions