What is the output of the following code?
DECLARE salary NUMBER := 60000; commission NUMBER := 0.10; BEGIN DBMS_OUTPUT.PUT_LINE('5 + 12 / 4 = ' || TO_CHAR(5 + 12 / 4)); DBMS_OUTPUT.PUT_LINE('12 / 4 + 5 = ' || TO_CHAR(12 / 4 + 5)); END; /
Division has higher precedence than addition:
SQL> SQL> DECLARE-- from w w w . ja va 2 s .c o m 2 salary NUMBER := 60000; 3 commission NUMBER := 0.10; 4 BEGIN 5 6 7 DBMS_OUTPUT.PUT_LINE('5 + 12 / 4 = ' || TO_CHAR(5 + 12 / 4)); 8 DBMS_OUTPUT.PUT_LINE('12 / 4 + 5 = ' || TO_CHAR(12 / 4 + 5)); 9 END; 10 / 5 + 12 / 4 = 8 12 / 4 + 5 = 8 PL/SQL procedure successfully completed. SQL>