Home » Other » Client Tools » How to handle errors in sql files by SQLPlus
How to handle errors in sql files by SQLPlus [message #591753] Wed, 31 July 2013 08:31 Go to next message
sabaka1391
Messages: 4
Registered: July 2013
Location: Sevastopol
Junior Member

Hello everyone!
I have some problem with '/' into the .sql files: after anonymous blocks - it haven't applied without '/'; Also not-anonymous block applied twice when we have both ';' and '/'. I need to report about problems before file will apply.)
Does anyone know how to handle these cases by a SQLPlus?
Re: How to handle errors in sql files by SQLPlus [message #591755 is a reply to message #591753] Wed, 31 July 2013 08:34 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Fix the script so that you have the correct amount /
Re: How to handle errors in sql files by SQLPlus [message #591764 is a reply to message #591753] Wed, 31 July 2013 09:06 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL*Plus handles well the ; and /
You just have some bugs in your script.
Fix them.

Regards
Michel
Re: How to handle errors in sql files by SQLPlus [message #591788 is a reply to message #591764] Wed, 31 July 2013 10:45 Go to previous messageGo to next message
sabaka1391
Messages: 4
Registered: July 2013
Location: Sevastopol
Junior Member

I have described problem only with / and ;
For example:
DECLARE
	begin
		INSERT INTO T1 VALUES(3);
	end;

SQL> @path/first.sql
6  

But with /
DECLARE
	begin
		INSERT INTO T1 VALUES(3);
	end;
/

SQL> @path/first.sql

PL/SQL procedure successfully completed.


For non-anonymous:
 select * from t2;

         X          Y          Z
---------- ---------- ----------
         1          2          3


INSERT INTO T2 VALUES(4,5,6);
/

SQL>  @path/first.sql

PL/SQL procedure successfully completed.


1 row created.


1 row created.

SQL> select * from t2;

         X          Y          Z
---------- ---------- ----------
         1          2          3
         4          5          6
         4          5          6

Re: How to handle errors in sql files by SQLPlus [message #591887 is a reply to message #591788] Thu, 01 August 2013 02:43 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
That's expected behaviour. Put the / after anonymous blocks and not after individual sql statements and your script will work.
Re: How to handle errors in sql files by SQLPlus [message #591889 is a reply to message #591887] Thu, 01 August 2013 03:33 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
The semi-colon (;) loads it into the buffer, the slash (/) executes it.


(Edit: to get rid of the emoticons)

[Updated on: Thu, 01 August 2013 03:34]

Report message to a moderator

Re: How to handle errors in sql files by SQLPlus [message #591892 is a reply to message #591889] Thu, 01 August 2013 03:52 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
what is the it you're referring to?
Re: How to handle errors in sql files by SQLPlus [message #591893 is a reply to message #591892] Thu, 01 August 2013 03:57 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
Apologies. The anonymous block.
Re: How to handle errors in sql files by SQLPlus [message #591899 is a reply to message #591788] Thu, 01 August 2013 04:49 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read SQL*PlusĀ® User's Guide and Reference.

Regards
Michel

Previous Topic: SQLPlus command parser
Next Topic: DATA EXPORT To EXCEL
Goto Forum:
  


Current Time: Thu Mar 28 21:14:26 CDT 2024