PHP Code:
SQL> edit
Wrote file afiedt.buf
1 declare
2 num1 number := 100;
3 num2 number := 300;
4 begin
5 declare
6 sum number(6);
7 begin
8 sum := num1 + num2;
9 dbms_output.put_line ('Total: ');
10 end;
11* end;
SQL> /
Total:
PL/SQL procedure successfully completed.
The same PL/SQL block does not work when I use the variable "sum" in the output statement:
PHP Code:
SQL> edit
Wrote file afiedt.buf
1 declare
2 num1 number := 100;
3 num2 number := 300;
4 begin
5 declare
6 sum number(6);
7 begin
8 sum := num1 + num2;
9 dbms_output.put_line ('Total: ' || sum);
10 end;
11* end;
SQL> /
dbms_output.put_line ('Total: ' || sum);
*
ERROR at line 9:
ORA-06550: line 9, column 41:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
(
SQL>
Note:
This line is causing the error shown above:
PHP Code:
dbms_output.put_line ('Total: ' || sum);
I tried using the variable name only and it still did not work:
PHP Code:
dbms_output.put_line (sum);