Toad World® Forums

Issue with comments at end of SQL statement?

Hello,

I think I found an issue with TOAD.

TOAD version: TOAD for IBM DB2 6.1.0.134.

The following SQL will fail:

Select * from TblTest
fetch first 1 row only;
–for fetch only;

The error message is the following:

Error:10/12/2015 9:21:20 AM 0:00:00.056: Lookup Error - DB2 Database Error: ERROR [42617] [IBM][DB2] SQL0198N The statement string of the PREPARE or EXECUTE IMMEDIATE statement is blank or empty.

The reason is because I commented out a line after the ; sign. If I move the ; sign after the commented line the SQL will run fine.

Can we try to get this fixed in future release?

Thanks!

Robert

I tested the above as well and did not receive any errors.

Toad: V6.1.0.134

db2level: DB2 V10.1 FP4

select * from systools.explain_object fetch first 1 row only;

–for fetch only;

Category Timestamp Duration Message Line Position

Statement 10/12/2015 9:35:21 AM 0:00:00.077 Query OK 1 0

If you copied and pasted the statements, try typing the whole statement instead.

Thanks,

Eric

How do I find out what db2level I am using?

Still no dice when writing out all the code.

Select * from SYSIBM.SYSDUMMY1 SY

fetch first 1 row only;

–fetch first only;

Error:10/12/2015 9:40:13 AM 0:00:00.070: Lookup Error - DB2 Database Error: ERROR [42617] [IBM][DB2] SQL0198N The statement string of the PREPARE or EXECUTE IMMEDIATE statement is blank or empty.

2:22: Select * from SYSIBM.SYSDUMMY1 SY

fetch first 1 row only;

–fetch first only;

For some odd reason it works in AQT fine; another query tool.

To find your db2level in Toad, go to Explorer while you’re connected to the database. Select “Database” tab. Then go to System General. It will be in the field labeled “Service level”.

Again I tested your latest statement and it was successful. The commented line should all be the same color.

I also tested having two semicolons:

select * from sysibm.sysdummy1

fetch first 1 row only;

;

This worked just fine.

I think I found the issue.

Go to Tools > Options

Expand Database>DB2

Select General

In the field “Script statement delimiter:” make sure it is set to semicolon “;”.

When I changed mine to a dash"-" and then ran the same query I received the exact same error as what you are getting.

Ah I see now. Duh! Chalk it up to a Monday Morning. :slight_smile: Thanks for your help.

I have it set to # sign. When I upload the SQL to the mainframe different members use different statement terminators so I never use ; as a my terminator usually.

Good ol mainframe.

Thanks for your help!!!

Robert