Neat little comment trick.

I often have some test code that spans multiple lines in my PL/SQL programs that I need to comment/un-comment frequently.

When placing the comment marks (/* */) at the beginning and the end of the test code, you always have to know where the first and last lines of the code are in order to comment/un-comment them.

With this little trick, you only need to know where the test code section starts, and the end of the code section comments/un-comments it self!.

All you have to do is place a line comment (–) in front of the end comment (*/).
If you now place a line comment in front of the begin comment (/*), the code section becomes active (un-commented). If you then remove the line comment (–) from the begin comment (/*), the code section will be commented out.

Commented out:

Code not commented out:

So by commenting/un-commenting the first comment (/*), the entire code section gets affected.

Leave a Reply

Your email address will not be published. Required fields are marked *