2017-02-23

[Oracle]How To Disable Users Using API

 

 
CREATE OR REPLACE PROCEDURE CBM_FND_PRC_001(P_USER_NAME     IN VARCHAR2,
											P_USER_END_DATE IN VARCHAR2,
                                            P_MESSAGE       OUT VARCHAR2) IS

  P_COUNT          NUMBER;
  P_USER_END_DATE1 VARCHAR2(20);
BEGIN
  P_USER_END_DATE1 := TO_DATE(P_USER_END_DATE, 'YYYY/MM/DD');

  SELECT COUNT(*)
    INTO P_COUNT
    FROM FND_USER FU
   WHERE 1 = 1
     AND FU.USER_NAME = P_USER_NAME
     AND FU.END_DATE IS NULL;

  IF P_COUNT = 1 THEN
    FND_USER_PKG.UPDATEUSER(X_USER_NAME => P_USER_NAME,
                            X_OWNER     => NULL,
                            X_END_DATE  => P_USER_END_DATE1);
  ELSE
    P_MESSAGE := '權限已經關閉';
  END IF;

  COMMIT;

EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK;
    P_MESSAGE := DBMS_UTILITY.FORMAT_ERROR_BACKTRACE ||
                 DBMS_UTILITY.FORMAT_ERROR_STACK;
END;

 

沒有留言:

張貼留言