Hi David,

I've not used it, but based on only a quick look at the SQL Reference, it
sounds like GET DESCRIPTOR after a PREPARE referencing a descriptor
provides access to the SQLDA data and more.

I have a need to analyze SQL also, to improve some custom tooling, but
haven't made the time yet. In particular, I'd like to know the list of
tables, columns, and functions, referenced by an SQL statement, in either
relational form or easily parse-able form. Global variables would be nice

I'm guessing GET DESCRIPTOR will fall short of my / your needs, but I could
easily be wrong since I've not tinkered with it yet. I did a lot of
tinkering with SQLDA's in the late 80s up through the mid 90s, and based on
what I remember about it, it didn't have all the data I'm looking for.

I anticipate that GET DESCRIPTOR will report a SELECT LIST column like:

select ifnull( MY_DB_COLUMN, '' ) as EXPOSED_COLUMN_NAME

...as EXPOSED_COLUMN_NAME, but I'm really interested in the fact that
MY_DB_COLUMN is being referenced. Hopefully I'm wrong if/when I do tinker
with it.

If you figure out how to do such things, please share if you're hands
aren't tied from doing so!

I'm guessing it will take IBM's SQL gurus to provide us access to detailed,
parsed SQL statement analysis data. They must already have that ability
for their own efficiency sake, but the question is if they've released it
to us mere mortals.


date: Tue, 15 Dec 2015 13:00:39 -0600
from: David Gibbs <david@xxxxxxxxxxxx>
subject: Re: [Bulk] Re: DB2 for i "Backus?Naur Form" specification

On 12/15/2015 12:56 PM, Mark S Waterbury wrote:
How about just running an SQL PREPARE on that statement, to see if
DB2 finds any errors?

I'm trying to parse out various pieces of information about the SQL
statements in question ... not just determine if they are valid.


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].