Do comments change how a PL/SQL program executes?

Comments change how a PL/SQL program executes, so an unsuitable comment can cause the program to fail. True or False?


As with every other program language comments in the code have no effect on its execution, so the answer is FALSE.

There is a categories of PL/SQL statements that may look like comments but aren't - hints provided to the Oracle optimizer to influence how a particular SQL statement should be run. Whilst these may look superficially like comments they are not.

For example

SELECT /*+ FIRST_ROWS(10) */ * FROM employees;


The FIRST_ROWS hint used above instructs the optimizer to choose the most efficient execution plan to return the first 10 rows of the query result set. The hint starts with "/*" which signifies a comment usually but in this case the next character is "+" which changes the comment to a hint.

See these PL/SQL tutorials for more help

Click here to post comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Oracle Questions.