What is the output of the following code?
DECLARE salary NUMBER := 60000; commission NUMBER := 0.10; BEGIN DBMS_OUTPUT.PUT_LINE('8 + 6 / 2 = ' || TO_CHAR(8 + 6 / 2)); DBMS_OUTPUT.PUT_LINE('(8 + 6) / 2 = ' || TO_CHAR((8 + 6) / 2)); END; /
Parentheses override default operator precedence:
SQL> SQL> DECLARE-- from ww w . java2 s. c o m 2 salary NUMBER := 60000; 3 commission NUMBER := 0.10; 4 BEGIN 5 6 DBMS_OUTPUT.PUT_LINE('8 + 6 / 2 = ' || TO_CHAR(8 + 6 / 2)); 7 DBMS_OUTPUT.PUT_LINE('(8 + 6) / 2 = ' || TO_CHAR((8 + 6) / 2)); 8 END; 9 / 8 + 6 / 2 = 11 (8 + 6) / 2 = 7 PL/SQL procedure successfully completed. SQL>