Home » SQL & PL/SQL » Client Tools » why below script showing lots of error & Which one is better for practise (merged by MC)
why below script showing lots of error & Which one is better for practise (merged by MC) [message #561986] Thu, 26 July 2012 11:22 Go to next message
mickey0204
Messages: 10
Registered: May 2012
Junior Member
set serveroutput on
set verify off
declare
grade char(1) := upper('&grade');
appraisal varchar2(20);
Begin
appraisal :=
CASE grade
when 'A' then 'excellent'
when 'B' then 'very good'
when 'C' then 'Good'
else 'No such grade'
end;
dbms_output.put_line('Grade is := ' || grade || ' appraisal is :- ' || appraisal);
end;

-----------------------------------------------------------------------------------------




[Updated on: Fri, 27 July 2012 14:02] by Moderator

Report message to a moderator

Re: why below script showing lots of error, kindly help [message #561987 is a reply to message #561986] Thu, 26 July 2012 11:28 Go to previous messageGo to next message
BlackSwan
Messages: 23158
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: why below script showing lots of error, kindly help [message #561988 is a reply to message #561987] Thu, 26 July 2012 11:30 Go to previous messageGo to next message
mickey0204
Messages: 10
Registered: May 2012
Junior Member
When i execute the above code in "Command window" it doesn't throw any error but the same i execute in "SQL Window", it throw lots of why it is so ???
Re: why below script showing lots of error, kindly help [message #561989 is a reply to message #561988] Thu, 26 July 2012 11:39 Go to previous messageGo to next message
mickey0204
Messages: 10
Registered: May 2012
Junior Member
set serveroutput on
set verify off
declare
	grade char(1) := upper('&grade');
	appraisal varchar2(20);
Begin
	appraisal :=
		CASE grade
			when 'A' then 'excellent'
			when 'B' then 'very good'
			when 'C' then 'Good'
			else 'No such grade'
		end;
	dbms_output.put_line('Grade is := ' || grade || ' appraisal is :- ' || appraisal);
end;
Re: why below script showing lots of error, kindly help [message #561990 is a reply to message #561989] Thu, 26 July 2012 11:43 Go to previous messageGo to next message
BlackSwan
Messages: 23158
Registered: January 2009
Senior Member
it works OK for me.

bcm@bcm-laptop:~$ sqlplus user1/user1

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 26 09:43:09 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

09:43:09 SQL> @code
09:43:13 SQL> set serveroutput on
09:43:13 SQL> set verify off
09:43:13 SQL> declare
09:43:13   2  	      grade char(1) := upper('&grade');
09:43:13   3  	      appraisal varchar2(20);
09:43:13   4  Begin
09:43:13   5  	      appraisal :=
09:43:13   6  		      CASE grade
09:43:13   7  			      when 'A' then 'excellent'
09:43:13   8  			      when 'B' then 'very good'
09:43:13   9  			      when 'C' then 'Good'
09:43:13  10  			      else 'No such grade'
09:43:13  11  		      end;
09:43:13  12  	      dbms_output.put_line('Grade is := ' || grade || ' appraisal is :- ' || appraisal);
09:43:13  13  end;
09:43:13  14  /
Enter value for grade: A
Grade is := A appraisal is :- excellent

PL/SQL procedure successfully completed.

09:43:17 SQL> 

Re: why below script showing lots of error, kindly help [message #561992 is a reply to message #561990] Thu, 26 July 2012 12:18 Go to previous messageGo to next message
Littlefoot
Messages: 19890
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You should tell us which errors you got. I don't think that any of us is standing behind your shoulder and actually sees the output you are looking at.
Re: why below script showing lots of error, kindly help [message #561996 is a reply to message #561988] Thu, 26 July 2012 12:56 Go to previous messageGo to next message
cookiemonster
Messages: 11285
Registered: September 2008
Location: Rainy Manchester
Senior Member
mayank.mayank.shukla wrote on Thu, 26 July 2012 17:30
When i execute the above code in "Command window" it doesn't throw any error but the same i execute in "SQL Window", it throw lots of why it is so ???


Sounds like you're using PL/SQL Developer.
In which case the command window is basically a sqlplus emulator. So it recognizes sqlplus commands like set verify off.
The SQL Window isn't a sqlplus emulator and doesn't recognize sqlplus commands.
Re: why below script showing lots of error, kindly help [message #562062 is a reply to message #561996] Fri, 27 July 2012 11:05 Go to previous messageGo to next message
mickey0204
Messages: 10
Registered: May 2012
Junior Member
Thanks for sharing the difference. Exactly i am using "PL/SQL Developer version 7.1"
But what is the best way to do practise, "Command window" or "SQL Window".
Thanks & Regards.

[Updated on: Fri, 27 July 2012 11:05]

Report message to a moderator

Re: Which one is better for practise [message #562067 is a reply to message #561986] Fri, 27 July 2012 11:35 Go to previous messageGo to next message
BlackSwan
Messages: 23158
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/


use what works best for you.
Re: Which one is better for practise [message #562069 is a reply to message #562067] Fri, 27 July 2012 13:28 Go to previous message
Michel Cadot
Messages: 60012
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
...and what is the relation with Oracle?

Regards
Michel
Previous Topic: How to define ED command in sql*plus?
Next Topic: How to have optional parameters and default values in SQL*Plus script?
Goto Forum:
  


Current Time: Sun Dec 21 13:56:54 CST 2014

Total time taken to generate the page: 0.04106 seconds