I use Oracle 10 XE. I'm a student. When I wrote my lab then I had found
that Oracle alerts about an error for the line:
call echo('dddddd'); -- comment
But it processes normally this line without the comment:
call echo('dddddd');
The PL script is entirely:
set serveroutput on;
create or replace procedure echo(msg varchar ) as
begin
dbms_output.put_line (msg);
end;
/
call echo('dddddd'); -- comment
-- the end of script
P.S. I have finished study of Oracle and my opinion have been
apparently get negative. It doesn't concern Oracle's performance or
one's stability for overloads because I made only simple demo jobs.
Therefore I cannot say about it. But as Oracle's user say to work very
uncomfortable with Oracle.
PL translator works rather silent and doesn't show a precise line number
with an error.
Daneel Yaitskov.
snip
What a very fine piece of plsql!
PLSQL has a debugger either in SQL Developer or a tool like Toad. I
think you need to do some more labs perhaps!
Have fun.
I expect you're seeing this error:
ERROR at line 1:
ORA-06550: line 2, column 0:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of
the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
because what's happening is this:
BEGIN echo('dddddd'); --comment; END;
Notice your comment in this context is considered as actual (but
invalid) code. Do this instead:
set serveroutput on;
create or replace procedure echo(msg varchar ) as
begin
dbms_output.put_line (msg);
end;
/
-- comment
call echo('dddddd');
-- the end of script
and you won't have such a problem (which you know because you've
removed the in-line comment and your code works).
Regarding your comment "PL translator works rather silent and doesn't
show a precise line number
with an error. " read here:
http://oratips-ddf.blogspot.com/2008/03/what-was-that-masked-message.html
You, as the programmer, are responsible for handling exceptions
(errors) in your PL/SQL code so don't blame Oracle when it doesn't
return the error text as you'd expect it to be. And, in this case it
IS line 1 causing the problem because there is only 1 line in the SQL
buffer to execute.
David Fitzjarrell
You need to turn serveroutput on in the session that calls you test
procedure.
[sqlplus example]
set serveroutput on size n
execute ech('TESTECHO')
Also be aware that package dbms_output was actually introduced as a
debugging tool, It does not issue output until the routine
terminates. There are better options available for reporting namely
pro* languages and the utl_file package. Package dbms_output has
routines to support its use by non-interactive applications.
Oracle provides a free development environment and there are several
other free and commercial tools that provide line by line debugging
capabilities. The PL/SQL errors are no worse than what you get from a
'C' compiller.
HTH -- Mark D Powell --
or simply use sqlplus and type 'show errors'
Tim
>
> Have fun.
>
--
tcross (at) rapttech dot com dot au
You must admit that such behavior strong differentiate from others
languages for the rule of one-line comment. Solid bulk of languages
C++, Bash, C#, Haskell, Lisp, TeX etc. consider that one-line comment
can begin in any place of a line excepting strings (a text between ").
I guess major portion of PL/SQL programmers have first language Basic,
Pascal or C.
My resume is this feature tends to errors.
But I don't see any causes that PS/Sql's syntaxes must differentiate
from the mainstream languages.
Daneel Yaitskov
This makes no sense to me. This is not a multi line comment in
java...
"""
useless comment
"""
...but is in python. However,
/*
another useless comment
*/
...does work in java, but not python.
That is one of the reasons different lanaguages exist, to serve
different needs. I don't think comment syntax is a reason to suggest
a language is not useful.
snip
My guess is that you do not use PLSQL much ... as long as we are
offering wild guesses.
The line in question will work quite well as a comment in a real
procedure. When feeding it in a line at a time thru sqlplus well not
so much.
Perhaps one might actually test something out before offering broad
based opinions?
Just a thought ...
Frankly, your comments have more errors than your PL example.
You may use any language you desire, in any manner you desire. But if
you don't follow the basic rules of the language you are using, your
desire will remain unrequited. If you post to usenet your
misunderstanding of the rules in an arrogant manner, you are lucky you
don't get flamed. I think you are lucky here because your ignorance
is so obvious people just think you are still inexperienced enough to
excuse you.
jg
--
@home.com is bogus.
Local news as I'm typing this is saying "...never seen this before..."
http://www.usatoday.com/money/industries/energy/2008-08-04-gaspumpskimming_N.htm
> On Dec 23, 7:35 am, Daneel Yaitskov <rtfm.rtfm.r...@gmail.com> wrote:
>
> snip
>
> My guess is that you do not use PLSQL much ... as long as we are
> offering wild guesses.
>
> The line in question will work quite well as a comment in a real
> procedure. When feeding it in a line at a time thru sqlplus well not
> so much.
>
> Perhaps one might actually test something out before offering broad
> based opinions?
>
> Just a thought ...
>
Bingo hpuxrac - the issue is with SQL*Plus, not the PL/SQL language:
"...SQL*Plus expects no text after a statement terminator and is unable to process the command." -- from SQL*Plus User's Guide and Reference, Release 10.2, Section: 'Notes on Placing Comments'
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch5.htm#sthref997
Daneel could also try moving the semi-colon to the end of the line to work around this quirk in SQL*Plus:
call echo('dddddd') -- comment;
...that's a bit odd, and inconsistent with PL/SQL comments, but runs fine in SQL*Plus. I believe it works because scripts must always end with a ';' or '/' (followed by a new line) if you run them in SQL*Plus or else they don't "finish". I bet Daneel ran the script, saw that a 'SQL>' prompt appeared with no error, and so assumed the entire script finished running. It didn't, because typing a '/' or ';' at the 'SQL>' prompt after executing the script reveals the error:
SQL> get script.sql
1 set serveroutput on;
2 create or replace procedure echo(msg varchar ) as
3 begin
4 dbms_output.put_line (msg);
5 end;
6 /
7 call echo('dddddd'); -- comment
8* -- the end of script
9 . <=== Manually typed a '.' here to get back to SQL> prompt.
SQL> @script.sql
Procedure created.
SQL> <=== Here it appears the entire script, including the 'call' ran. It didn't. (If your 'script.sql' file ends with only one blank line you may get a ' 3' instead of a 'SQL>' prompt). Typing 'show errors' here will return 'No errors.' because the 'call' line has not run yet! You need to type ';' or '/' so SQL*Plus passes the 'call' line to the database:
SQL> /
call echo('dddddd'); -- comment
*
ERROR at line 1:
ORA-00911: invalid character
...the error is revealed!
If you replace 'call' with 'exec', you get the error ddf mentioned above, instead of a silent, incomplete execution of the script. Seems like 'exec' is the better choice.
George
I was tempted very much to respond in such a manner.
Of course, bash and tex are NOT programming languages at all,
Haskell is NOT mainstream, and all the rest (C++, C# - yuk!
and Lisp) are much younger than PL/SQL.
Mr Yaitskov still has a lot to learn. One of these things
might be mastering the tool, before attempting to use it.
--
Regards,
Frank van Bortel
The commands for shells aren't a programming language? That's a new
one on me. Could you explain more fully? From the wikipedia unix
shell entry: "Since it is both an interactive command language as well
as a scripting programming language it is used by Unix as the facility
to control (see shell script) the execution of the system." And tex
has macros... they may not be _good_ languages, but I write shell
scripts pretty much every day. On the other hand, maybe I just don't
remember what a programming language is. I often see a distinction
made between operating system commands and programs, but frankly, I
don't see the difference - even if you are poking binary into the OS.
The OS is a program, data can be a program. They're all telling the
computer what to do. Of course, I'm a big fan of writing a script,
even to do something once - maybe I've seen enough mistakes to just
not accept the difference. What's a command but a one-line script?
It's saved in a file for subsequent use, unless you really are
misconfigured.
Lisp is from 1958: http://en.wikipedia.org/wiki/Lisp_(programming_language)#History
(BTW, I was looking at Noons' blog, and hit the next blog button that
blogspot puts in, expecting some random page, but it seems to be
content-aware now. A couple of next's later, I hit your blog. Tried
it just now and got different blogs, though some were the same as the
previous time [on a different computer].)
jg
--
@home.com is bogus.
Not programming languages in the sense they
were meant to be programming languages.
I do not regard an OS a programming language,
even though it will support scripting.