Ich versuche, PL/SQL zu lernen. Ich bin betroffen von diesem Code. Bitte benachrichtige mich, wo ich falsch liege. Ich benutze Oracle 10g in einer Befehlszeile.Warum funktioniert PL/SQL nicht?
declare
grade char(1):='&v_grade';
app varchar(15);
begin
app:=case v_grade
when 'a' then
dbms_output.put_line('Excellent');
when 'b' then
dbms_output.put_line('Good');
else
dbms_output.put_line('Bad');
end case;
dbms_output.put_line('Grade'||grade||' Appraisal:'||app);
end;
/
Es zeigt
Enter value for v_grade: a
old 2: grade char(1):='&v_grade';
new 2: grade char(1):='a';
dbms_output.put_line('Excellent');
*
ERROR at line 7:
ORA-06550: line 7, column 34:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. (* % & = - + </> at else end in is mod remainder not rem
when <an exponent (**)> <> or != or ~= >= <= <> and or like
LIKE2_ LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol ";" was ignored.
ORA-06550: line 9, column 29:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. (* % & = - + </> at else end in is mod remainder not rem
when <an exponent (**)> <> or != or ~= >= <= <> and or like
LIKE2_ LIKE4_ LIKEC_ between ||
ORA-06550: line 11, column 28:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. (* % & = - + </> at end in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset
mir bitte mitteilen, wo ich falsch werde.
Ich weiß nichts über PL/SQL, aber ich würde vermuten, dass, da die 'put_line 'in einem' case ... wenn ... dann 'ein' '' ist, nachdem es falsch ist. In SQL beendet '' 'Anweisungen. Sie möchten die Anweisung dort nicht beenden. Die Aussage endet erst nach dem "end case" (und Sie haben ein '' '' '' '', das ist passend). –