Written by

Question Jaffa Brown · May 25, 2021

Script out a routine (stored procedure) name

Afternoon all,

Is there a way (at SQL level) to script out the definition of a Cache stored procedure from within SQL?

In SQL Server, I would do...

Select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = 'my_sproc_name'

But cant find anyway to do this in cache.

Note, its an old version of Cache, so "INFORMATION_SCHEMA" is not available.

I am trying to see the SQL definition in the sproc from SQL itself.

Thanks all

Product version: Caché 2014.1

Comments

Robert Cemper · May 25, 2021

Ok. this is not MS-SQL.
Connect with your Studio to the correct Namespace and print out the related ClassMethod. 
This would most likely be some code in ObjectScript and not look like SQL

0
Warlin Garcia · May 25, 2021

How old are you talking about? In any case, you could use old stored procedures provided by Cache to pull the data. There will be under %SQL.Manager.Catalog, eg. %SQL.Manager.Catalog.Procedures()

0
Julius Kavay · May 25, 2021

If I got you correctly... for IRIS (and newer Cache Versions) you can use

select * from  INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME='...'

and for older Cache versions try

select * from %Dictionary.CompiledMethod where SqlProc=1 and Name='...'

(but be patient, this takes some time)

0
Stephen Canzano · May 26, 2021

You might also find some relief by querying %Dictionary.MethodDefinition WHERE SQLProc=1 or %Dictionary.QueryDefinition.  If it's a really old version you might look in %Library schema.

0