How to view function code with Toad for IBM DB2

Article for: DataGrip

Open Explorer by click on icon in main menu (Fig. 1) or by Tools -> Explorer.

Fig.1. Explorer in menu

In explorer :

  • for Treelist view expand Schemas -> [your schema name] -> Functions
  • for Tabbed view switch to Functions tab

and select function which code you want to see. In Object Details window switch to Script tab (Fig. 2).

Fig. 2. Function Script tab

You can also view edit-ready script from any explorer if you right-click on function and from context menu select Send To -> Editor as Script (Fig.3 [1]). This option will open new editor window with function script which you can edit.

Fig. 3. Function context menu

There is little more advanced option in context menu: Extract DDL… (Fig. 3 [2]). This allows you not only extract script of the function, but also all referenced and dependent object, drop statements and privileges on objects (Fig. 4).

Fig. 4. Extract DDL of function window