In Oracle PL/SQL, writing a Stored Procedure for null operations, although we write a Stored Procedure (Stored Procedure) to complete some specific functions. However, in some cases, the functions implemented by the existing storage functions may no longer be needed or we intend to use other methods to implement them, at this time, in order to minimize the changes to the existing system (to minimize the impact on the existing system), we cannot delete this stored procedure, but we need to modify this stored procedure to make it short, that is, no substantive functions are implemented. However, Oracle requires the code of the stored procedure body when compiling the stored procedure: 1. All parameters declared by the stored procedure must be used in the Stored Procedure body; 2. All declared or computed variable values in the stored procedure must be used in this process. Therefore, to implement null operations on stored procedures, we cannot comment out all the code in the original Stored Procedure body, because the Annotated Code cannot be compiled at all. Www.2cto.com that is to say, we need some special processing to implement null operations on the stored procedure: write the code of the stored procedure body as an if statement, and the conditions of this statement will never be true, in addition, this statement uses all the variables defined in the stored procedure. In this way, the stored procedure can be compiled without any substantive functions. For example, in the following stored procedure, assume that timeStamp represents the number of seconds from the current system time to January 1, January 1, 1970 (therefore, this value will always be a positive number, not a negative number ). Www.2cto.com create or replace procedure ADisabledSP (timeStamp number, tableName varchar2) isbegin -- this condition can never be true, and the input parameter timeStampif timeStamp <0 then -- the input parameter tableNamedbms_output.put_line ('We are going to operate on table' | tableName); end ifend www.2cto.com is used, by specifying the "timeStamp <0" condition in the if statement, the code in the entire if statement can never be executed, so as to achieve the purpose of null operations. In addition, The Condition Clause in the if statement and all variables defined in this stored procedure are used in the statement body to ensure that the compilation can pass.
Source http://blog.viscenthuang.info/