Again, new to DB2. Trying to do something I can do in Sybase ASE.
In any Sybase SQL script I can use /* */ to comment out a block of
code.
In the DB2 9.0 SQL Reference Manual V1 it says:
Comments: SQL comments are either bracketed (introduced by /* and end
with */) or simple (introduced by two consecutive hyphens and end with
the end of line). Static SQL statements can include host language
comments or SQL comments. Comments can be specified wherever a space
can be specified, except within a delimiter token or between the
keywords EXEC and SQL.
I have this piece of DB2 SQL
connect to DB_PPES;
select count(*) from PPES_REQUEST;
select count(*) from PPES_DISPATCHER;
select count(*) from PPES_ADMIN_SOURCE;
which runs fine. But, when I try to use /* */ to block out the middle
select I get
errors.
So, this:
connect to DB_PPES;
select count(*) from PPES_REQUEST;
/*
select count(*) from PPES_DISPATCHER;
*/
select count(*) from PPES_ADMIN_SOURCE;
produces this:
select count(*) from PPES_REQUEST
1
-----------
369955
1 record(s) selected.
/* select count(*) from PPES_DISPATCHER
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "/* select count(*) from
PPES_DISPATCHER" was
found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<space>". SQLSTATE=42601
*/ select count(*) from PPES_ADMIN_SOURCE
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "*/" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601
I realize that I could just put -- in front of the line I want to
comment out, but what if I wanted to
comment out 1000's of lines. The manual says it should work, yet I
can't it to. Our DB2 version is
9.1.0.4. The command I'm executing the query with is "db2 -tf x.sql"
Thanks