you can use /* .... */ to comment some portion of your code, as in :

Beware that some programs will parse the comments to find implementation
specific commands to exeute. These comments are often use to hide those
specific commands to preserve portability. For exemple, for MySQL :

CREATE /*!32302 TEMPORARY */ TABLE (a int);

means that the TEMPORARY command is to be ignored by version older than
3.23.02. It should also be ignored by standard SQL programs (but you can
never be sure !)

Otherwise, you can use -- , but it is safer to add a space afeter the two
dashes because without a space, some SQL programs (like MySQL) will not
treat the line as a comment. This is because there can be a problem when a
single dash is followed by a negative value. For example, if you generate
SQL commands in a servlet, you can end with

        amount1-amount2

if amount1 is 4 and amount 2 is -5, this will translate into :

        4--5

and crash.

You should look at your database documentation to see if it accepts another
style of comments (for example # at start of line) that is safer to use (but
less portable).

Pierre-Yves

-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
Fabrizio Gianneschi
Envoy� : jeudi 17 mai 2001 11:29
� : [EMAIL PROTECTED]
Objet : Off-Topic: Comments in SQL


Hi, this is an off-topic message, but I need some help, please!
It's possible to insert comment blocks or lines in sql statements?
Just like the "//" in java.

Thanks
Fabrizio

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to