0% found this document useful (0 votes)
3 views

Creating+New+User+Through+API

The document is a PL/SQL script that creates a user in a database using the FND_USER_PKG.CREATEUSER procedure. It sets various user attributes such as username, password, start date, and email address, and checks if the user was successfully created. If an error occurs during the process, it captures and displays the error message.

Uploaded by

mohmmedhdx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Creating+New+User+Through+API

The document is a PL/SQL script that creates a user in a database using the FND_USER_PKG.CREATEUSER procedure. It sets various user attributes such as username, password, start date, and email address, and checks if the user was successfully created. If an error occurs during the process, it captures and displays the error message.

Uploaded by

mohmmedhdx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SET SERVEROUTPUT ON;

DECLARE
L_USER_NAME VARCHAR2 (100) := 'BADGER2';
L_USER_PASSWORD VARCHAR2 (100) := 'welcome1';
L_USER_START_DATE DATE := SYSDATE;
L_USER_END_DATE VARCHAR2 (100) := NULL;
L_PASSWORD_LIFESPAN_DAYS NUMBER := 90;
L_DESCRIPTION VARCHAR2 (150) := 'User created from API';
L_EMAIL_ADDRESS VARCHAR2 (100) := '[email protected]';
L_USER_CNT NUMBER;
L_MSG_DATA VARCHAR2 (3000);
BEGIN
DBMS_OUTPUT.PUT_LINE ('********************************');
FND_USER_PKG.CREATEUSER (X_USER_NAME => L_USER_NAME
,X_OWNER => NULL
,X_UNENCRYPTED_PASSWORD => L_USER_PASSWORD
,X_START_DATE => L_USER_START_DATE
,X_END_DATE => L_USER_END_DATE
,X_DESCRIPTION => L_DESCRIPTION
,X_PASSWORD_LIFESPAN_DAYS => L_PASSWORD_LIFESPAN_DAYS
,X_EMAIL_ADDRESS => L_EMAIL_ADDRESS);

SELECT COUNT (USER_ID)


INTO L_USER_CNT
FROM FND_USER
WHERE USER_NAME = L_USER_NAME;

IF (L_USER_CNT > 0) THEN


DBMS_OUTPUT.PUT_LINE ('User created!');
COMMIT;
ELSE
DBMS_OUTPUT.PUT_LINE ('User creation failed');
END IF;

DBMS_OUTPUT.PUT_LINE ('********************************');
EXCEPTION
WHEN OTHERS THEN
L_MSG_DATA := SUBSTR (SQLERRM, 0, 1000);
DBMS_OUTPUT.PUT_LINE ('***************************');
DBMS_OUTPUT.PUT_LINE ('Error: ' || L_MSG_DATA);
DBMS_OUTPUT.PUT_LINE ('***************************');
END;

You might also like