Contents Index Passing parameters to external functions Debugging Logic in the Database

ASA SQL User's Guide
  Using Procedures, Triggers, and Batches
    Calling external libraries from procedures

Hiding the contents of procedures, functions, triggers and views


In some cases, you may want to distribute an application and a database without disclosing the logic contained within procedures, functions, triggers and views. As an added security measure, you can obscure the contents of these objects using the SET HIDDEN clause of the ALTER PROCEDURE, ALTER FUNCTION, ALTER TRIGGER, and ALTER VIEW statements.

The SET HIDDEN clause scrambles the contents of the associated objects and makes them unreadable, while still allowing the objects to be used. You can also unload and reload the objects into another database.

The modification is irreversible, and for databases created using version 8.0 or higher, deletes the original text of the object. Preserving the original source for the object outside the database is required.

Debugging using the stored procedure debugger will not show the procedure definition, nor will procedure profiling display the source.

Running one of the above statements on an object that is already hidden has no effect.

To hide the text for all objects of a particular type, you can use a loop similar to the following:

begin
    for hide_lp as hide_cr cursor for
        select proc_name,user_name
        from SYS.SYSPROCEDURE p, SYS.SYSUSERPERM u
        where p.creator = u.user_id
        and p.creator not in (0,1,3)
    do
        message 'altering ' || proc_name;
        execute immediate 'alter procedure "' ||
            user_name || '"."' || proc_name
            || '" set hidden'
    end for
end

For more information, see the ALTER FUNCTION statement, the ALTER PROCEDURE statement, the ALTER TRIGGER statement, and the ALTER VIEW statement.


Contents Index Passing parameters to external functions Debugging Logic in the Database