ViaSQL Features
Catalog Stored Procedures


Checkmark Catalog Stored Procedures

Also called CSPs, catalog stored procedures are a way for applications to query DBMS catalog tables without having to write SQL statements or know anything about the catalog structure of the DBMS.

The standard ODBC and JDBC catalog stored procedure specifications are supported by ViaSQL, thus allowing any application to retrieve table, column, foreign key, and user privilege information about DB2 tables or ViaSQL "virtual tables" without having to write customized SQL. For example, the SQL_tables procedure is converted by ViaSQL to code similar to the following:

SELECT DISTINCT T.CREATOR, T.TNAME, T.TABLETYPE, SUBSTR(T.REMARKS,1,64)
FROM SYSTEM.SYSCATALOG T, SYSTEM.SYSTABAUTH TA
WHERE T.CREATOR = TA.TCREATOR AND T.TNAME = TA.TTNAME
AND T.TABLETYPE IN ('R','V') AND T.TNAME NOT LIKE 'SYS%'
AND T.CREATOR = 'USER01' AND (TA.GRANTEE = USER OR TA.GRANTEE = 'PUBLIC')
ORDER BY 3, 1, 2