Home » SQL & PL/SQL » SQL & PL/SQL » SQL Plus script question
SQL Plus script question [message #316304] Thu, 24 April 2008 09:55 Go to next message
Nasiobo
Messages: 10
Registered: August 2007
Location: Atlanta, GA
Junior Member
This works, when running from SQL Plus.

SPOOL runme.LOG
SET echo ON;
SET feedback ON;
SET timing ON;
SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SELECT * FROM v$instance;
SET DEFINE OFF;
SET SCAN OFF
/


DECLARE 
	test varchar2(100);
BEGIN

	update "TEST"."TABLE" set "COLUMNNAME" = 'TESTING' where "SOMETHING" = '1000';
	
END;
/

SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SPOOL OFF;


However, if I remove the " / " from the bottom, after the end then the script will hang. (see below).

I understand fully that I can put the " / " at the end to make it work, but, my question is "why" do I have to do this, and, is there a way around from having to do this? Is there something in one of the "SET" commands that can be used?

SPOOL runme.LOG
SET echo ON;
SET feedback ON;
SET timing ON;
SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SELECT * FROM v$instance;
SET DEFINE OFF;
SET SCAN OFF
/


DECLARE 
	test varchar2(100);
BEGIN

	update "TEST"."TABLE" set "COLUMNNAME" = 'TESTING' where "SOMETHING" = '1000';
	
END;

SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SPOOL OFF;

Re: SQL Plus script question [message #316308 is a reply to message #316304] Thu, 24 April 2008 10:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
my question is "why" do I have to do this

Because this is the syntax to execute a PL/SQL block.

Quote:
is there a way around from having to do this?

No. Why do you want to work around this?

Regards
Michel
Re: SQL Plus script question [message #316349 is a reply to message #316304] Thu, 24 April 2008 13:01 Go to previous messageGo to next message
joy_division
Messages: 4644
Registered: February 2005
Location: East Coast USA
Senior Member
Nasiobo wrote on Thu, 24 April 2008 10:55


I understand fully that I can put the " / " at the end to make it work, but, my question is "why" do I have to do this, and, is there a way around from having to do this? Is there something in one of the "SET" commands that can be used?

SPOOL runme.LOG
SET echo ON;
SET feedback ON;
SET timing ON;
SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SELECT * FROM v$instance;
SET DEFINE OFF;
SET SCAN OFF
/


DECLARE 
	test varchar2(100);
BEGIN

	update "TEST"."TABLE" set "COLUMNNAME" = 'TESTING' where "SOMETHING" = '1000';
	
END;

SELECT TO_CHAR(SYSDATE,'mm-dd hh24:mi:ss') FROM dual;
SPOOL OFF;




That's a pretty funny question. It's kind of like asking, "I want to ask a question to someone on the phone, but I don't want to have to speak (or use morse code)." *** I was really trying hard to come up with an analogy, but this is the best I could do. Maybe someone can come up with a better one ***

You do know that your first slash after SET SCAN OFF is going to execute your results from v$instance twice.

[Updated on: Thu, 24 April 2008 13:02]

Report message to a moderator

Re: SQL Plus script question [message #316351 is a reply to message #316308] Thu, 24 April 2008 13:22 Go to previous message
Nasiobo
Messages: 10
Registered: August 2007
Location: Atlanta, GA
Junior Member
Thanks for the response. I'm trying to understand all the details and this is just one of those that I didn't understand what the requirement was.
Previous Topic: Query Problem
Next Topic: SQL: Listing/Showing functions created by "CREATE function"?
Goto Forum:
  


Current Time: Sat Dec 10 10:57:26 CST 2016

Total time taken to generate the page: 0.07627 seconds