7

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?

2 Answers 2

13

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Looks like I posted my reply at the same time. Thanks for the answer.
0

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 /.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.