I have a file with the folowing script:
BEGIN
...
a bunch of inserts
...
COMMIT;
EXCEPTION
WHEN OTHERS THEN ROLLBACK;
END;
When I execute this in sqlplus I get the following:
SQL> @file.sql
382
It's as if he's not ending the block. I'm new to using pl/sql and sqlplus, so I don't know if I'开发者_运维技巧m doing something wrong.
Any ideas?
You need to add one more line after the final END; like this:
/
Just a slash as the first character on the line, and then a new line.
Ok, I figured it out. I should have search better in the documentation before posting the question here.
Anyway according to this link: http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch4.htm#sthref840
SQL*Plus treats PL/SQL subprograms in the same manner as SQL commands, except that a semicolon (;) or a blank line does not terminate and execute a block. Terminate PL/SQL subprograms by entering a period (.) by itself on a new line. You can also terminate and execute a PL/SQL subprogram by entering a slash (/) by itself on a new line.
Instead of END you must finish with /.
精彩评论