Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlPlus not terminating sql script

Tags:

plsql

sqlplus

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?

like image 637
Megacan Avatar asked Feb 17 '10 14:02

Megacan


People also ask

How do I terminate SQL Plus?

Solution 1. 1) If it is a windows SQL*PLus, click on File/Cancel. 2) Press Cntrl + C which will also stop the execution.

How do I run a SQL script in Sqlplus?

Answer: To execute a script file in SQLPlus, type @ and then the file name. The above command assumes that the file is in the current directory. (ie: the current directory is usually the directory that you were located in before you launched SQLPlus.) This command would run a script file called script.

Does Sqlplus commit on exit?

In iSQL*Plus click the Logout button to exit the Oracle Database. Commit on exit, or commit on termination of processing in iSQL*Plus, is performed regardless of the status of SET AUTOCOMMIT.

What SQL*Plus command runs a script at the OS level?

Running a Script as You Start SQL*PlusSQL*Plus starts and runs the script. Include your username, a slash (/), and your password as the first line of the file. Follow the SQLPLUS command with @ and the filename. SQL*Plus starts and runs the file.


1 Answers

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.

like image 54
Tony Andrews Avatar answered Sep 30 '22 15:09

Tony Andrews