Fehler : PLS-00103: stießen auf das symbol "END" erwarten, wenn eine der folgenden

Schrieb ich Folgendes Package und Package body:

create or replace package discounts
is
g_id number := 7839;
discount_rate number := 0.0;
procedure display_price(p_price number);
end;
/
create or replace package body discounts
is
procedure display_price(p_price number)
is
  begin
     dbms_output.put_line('Discount rate 1:'||discount_rate); 
     dbms_output.put_line('Discounted '||to_char(p_price * nvl(discount_rate,0)));
     dbms_output.put_line('Discount rate 2:'||discount_rate); 
  end;
begin
  dbms_output.put_line('Discount rate 3:'||discount_rate); 
  discount_rate := 0.10;
  dbms_output.put_line('Discount rate 4:'||discount_rate); 
end;
/

Ist es geschrieben, dass "Der Wert von discount_rate ist eingestellt auf 0,10, wenn das Paket aufgerufen wird, zum ersten mal in einer Sitzung". Ich bin nicht immer in diesem Punkt, genau das ist der Grund, warum ich überprüft den Wert jedes mal, wenn der Diskontsatz. Ich tippte die folgenden aufrufen:

SQL> execute discounts.display_price(1000);
Discount rate 3:0
Discount rate 4:.1
Discount rate 1:.1
Discounted 100
Discount rate 2:.1

Dann wieder rief ich die variable:

  begin
    dbms_output.put_line('Discount rate :'||discounts.discount_rate);
  end;
  SQL> /
  Discount rate :.1

Dann habe ich eingegeben "exit" schließen Sie das SQL *PLUS. Wieder öffnete ich SQL *PLUS und tippte den gleichen code ein:

  begin
    dbms_output.put_line('Discount rate :'||discounts.discount_rate);
  end;

Dachte ich, es wird nicht initialisiert die variable aber ich habe den Fehler:

  ERROR at line 3:
  ORA-06550: line 3, column 1:
  PLS-00103: Encountered the symbol "END" when expecting one of the following:
  := . ( % ;
  The symbol ";" was substituted for "END" to continue.

Was ist der Fehler??? Ich bin neu in PL/SQL-Vorbereitung für die Zertifizierungsprüfung.

InformationsquelleAutor ankitaP | 2013-03-23

Schreibe einen Kommentar