Re: there is an error in comments

From: ddf <oratune_at_msn.com>
Date: Mon, 21 Dec 2009 06:04:58 -0800 (PST)
Message-ID: <7f628c2a-9fa9-4751-9cfa-20f595d94aa5_at_k32g2000prb.googlegroups.com>



On Dec 21, 7:45 am, Daneel Yaitskov <rtfm.rtfm.r..._at_gmail.com> wrote:
> Hi List,
>
> 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.

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 Received on Mon Dec 21 2009 - 08:04:58 CST

Original text of this message