procedure_function
procedure_function
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
Table created.
28 rows selected.
no rows selected
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
View created.
Sequence created.
Sequence created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
ROLLNO MARKS
---------- ----------
1 16
4 15
7 12
10 10
7 10
4 20
1 13
-2 17
8 rows selected.
SQL> declare
2 no1 number := &no1;
3 begin
4 if no1%2 = 0
5 dbms_ouput.put_line('No is odd');
6 else
7 dbms_ouput.put_line('No is even');
8 end;
9 /
Enter value for no1: 12
old 2: no1 number := &no1;
new 2: no1 number := 12;
if no1%2 = 0
*
ERROR at line 4:
ORA-06550: line 4, column 8:
PLS-00103: Encountered the symbol "2" when expecting one of the following:
type <an identifier> <a double-quoted delimited-identifier>
SQL> declare
2 no number := &no1;
3 begin
4 if no1%2 = 0
5 dbms_ouput.put_line('No is even');
6 else
7 dbms_ouput.put_line('No is odd');
8 end;
9 /
Enter value for no1: 12
old 2: no number := &no1;
new 2: no number := 12;
if no1%2 = 0
*
ERROR at line 4:
ORA-06550: line 4, column 8:
PLS-00103: Encountered the symbol "2" when expecting one of the following:
type <an identifier> <a double-quoted delimited-identifier>
SQL> declare
no1 number := &no1;
no2 number := &no2;
begin
if no1 > no2
dbms_ouput.put_line(no1 || 'is greater than' || no2);
else
dbms_output.put_line(no2 || 'is greater than' || no1);
end;
/
Enter value for no1: 10
old 2: no1 number := &no1;
new 2: no1 number := 10;
Enter value for no2: 100
old 3: no2 number := &no2;
new 3: no2 number := 100;
dbms_ouput.put_line(no1 || 'is greater than' || no2);
*
ERROR at line 6:
ORA-06550: line 6, column 1:
PLS-00103: Encountered the symbol "DBMS_OUPUT" when expecting one of the
following:
. ( * @ % & - + / at mod remainder rem then
<an exponent (**)> and or || multiset
The symbol "." was substituted for "DBMS_OUPUT" to continue.
ORA-06550: line 6, column 53:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. ( * % & - + / at mod remainder rem then <an exponent (**)>
and or || multiset
SQL> declare
2 no1 number := 1;
3 begin
4 Loop
5 dbms_output.put_line(no1);
6 no1 = no1+1;
7 Exit when (no1 = 10)
8 End loop;
9 end;
10 /
no1 = no1+1;
*
ERROR at line 6:
ORA-06550: line 6, column 5:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ;
The symbol ":= was inserted before "=" to continue.
ORA-06550: line 8, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between overlaps || multiset year day member
submultiset
The symbol ";" was substituted for "END" to continue.
SQL> declare
2 no1 number := 1;
3 begin
4 Loop
5 dbms_ouput.put_line(no1);
6 no1 := no1+1;
7 End loop;
8 end;
9 /
dbms_ouput.put_line(no1);
*
ERROR at line 5:
ORA-06550: line 5, column 1:
PLS-00201: identifier 'DBMS_OUPUT.PUT_LINE' must be declared
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
SQL> declare
2 no1 number:= 1;
3 begin
4 Loop
5 dbms_ouput.put_line(no1);
6 no1:=no1+1;
7 /
no1:=no1+1;
*
ERROR at line 6:
ORA-06550: line 6, column 11:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
( begin case declare end exit for goto if loop mod null
pragma raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge standard pipe
purge json_object
declare
no1 number := 1;
begin
Loop
dbms_output.put_line(no1);
no1:=no1+1;
End loop;
end;
/
declare
no1 number := &no1;
no2 number := &no2;
begin
if no1 = no2 then
dbms_output.put_line(no1 || 'and' || no2 || 'are equal');
elsif no1 > no2 then
dbms_output.put_line(no1 || 'is greater than' || no2);
else
dbms_output.put_line(no2 || 'is greater than' || no1);
end if;
end;
/