문제

I would like to see the code for a function defined like below. This function -lives in a schema called MYSCHEMA -makes usage of a shared library installed.

I tried to use the following but it doesn't work.

  select r.routinename as FunctionName, r.text as FunctionBody from 
  syscat.routines r where r.origin in ('U','R') and ROUTINESCHEMA='TRADE' 
  AND ROUTINETYPE ='F'

How can I do that?

   create or replace function MyFunction(varchar(60))
          returns  table(
          ..fields..
           )
          external name 'mySharedLib.so!function'
          language c
          parameter style sql
도움이 되었습니까?

해결책

There's no "code", just the function definition. You can either use db2look or generate the definition yourself by querying the system catalog views SYSCAT.ROUTINES and SYSCAT.ROUTINEPARMS.

다른 팁

DB2 will not store the code of the external routines (C or Java). DB2 will just call the external binary when the function or SP is called. If the DB cannot locate the binary, it will throw an error

However, the mapping between a routine definition and the called binary is in the catalog, where DB2 will store the header and which binary has to call.

When you add a routine, DB2 does not even check it that routine has the good format, or callable parameters. That will be done at execution time.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top