Skip to Content
0

SQL Statement Debug

Mar 09, 2017 at 07:31 PM

183

avatar image
Former Member

Dear sirs,

I am writing a script for automating a job for changing several scripts (each script consists of one or more sql statement/s).

For this job I am using string functions (substr, locate, right....etc.), so that I read the original script and then do changes on it, and I am not sure whether at the end my job will create correct changes (from syntax point of view, i.e. will generate free of syntax error scripts).

The question is: is there any statement/command in dbisql that enables me to to read a string consisting of sql command/s and check the syntax (something similar to BUILD or COMPILE).

I know that the READ statement can read a script file but it will also execute it, but I don't want the scripts to be executed.

Thanks in advance

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Volker Barth Mar 10, 2017 at 08:55 AM
0

Use DBISQL (or the older dbisqlc program) with option "-x" in order to scan scripts without executing them.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for the reply, is it however possible to stay in the same session of DBISQL (which must already be started w/o -X)?

I am writing a script which goes through stored scripts of mobilink, and do particular changes in each of those scripts.

I need to execute my script in DBISQL (w/o -X).

So, is it possible to scan the newly changed mobilink scripts within the same session of DBISQL?

The only solution which I have now is to export all the newly changed scripts into txt files and then let a batch file go through those txt files and read them with DBISQL -X.

Please let me know if there is any other suggestions, so that I eliminate the need for the batch file.

Thanks in advance

0

Not that I'm aware of. There are some functions like "SQLDIALECT" that will parse SQL statements (but possibly not whole batches) but I don't know whether they do enough checking for you.

As usually, I'd recommend to ask that in the separate SAP SQL Anywhere Forum because your chances are way higher to get in contact with SQL Anywhere staff members there.

0
Former Member
You could try highlighting the query and use the Query Editor (Ctrl-Q) to see if that can parse the statement or not.
1