DECLARE
v_user_name VARCHAR2(30):=UPPER('&Enter_User_Name');
v_password VARCHAR2(30):='&Enter_Password';
v_session_id INTEGER := USERENV('sessionid');
BEGIN
fnd_user_pkg.createuser (
x_user_name => v_user_name,
x_owner => NULL,
x_unencrypted_password => v_password,
x_session_number => v_session_id,
x_start_date => SYSDATE,
x_end_date => NULL
);
COMMIT;
DBMS_OUTPUT.put_line ('User:'||v_user_name||'Created Successfully');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Unable to create User due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
ROLLBACK;
END;
BEGIN
fnd_user_pkg.addresp ('&Enter_User_Name','SYSADMIN','SYSTEM_ADMINISTRATOR','STANDARD','Add Responsibility to USER using pl/sql',SYSDATE,SYSDATE + 100);
commit;
dbms_output.put_line('Responsibility Added Successfully');
exception
WHEN others THEN
dbms_output.put_line(' Responsibility is not added due to ' || SQLCODE || substr(SQLERRM, 1, 100));
ROLLBACK;
END;
DECLARE
P_USER_NAME VARCHAR2(200) := 'SYSCNTEST' ;
P_OWNER VARCHAR2(200) := NULL;
P_UNENCRYPTED_PASSWORD VARCHAR2(200) := 'oracle123';
P_SESSION_NUMBER NUMBER := userenv('sessionid');
P_START_DATE DATE := SYSDATE;
P_END_DATE DATE := NULL;
P_LAST_LOGON_DATE DATE := NULL;
P_DESCRIPTION VARCHAR2(200) := 'teamsearch';
P_PASSWORD_DATE DATE := SYSDATE - 1;
P_PASSWORD_ACCESSES_LEFT NUMBER := 1000;
P_PASSWORD_LIFESPAN_ACCESSES NUMBER := 1000;
P_PASSWORD_LIFESPAN_DAYS NUMBER := 1000;
P_EMPLOYEE_ID NUMBER := NULL;
P_EMAIL_ADDRESS VARCHAR2(200) := NULL;
P_FAX VARCHAR2(200) := NULL;
P_CUSTOMER_ID NUMBER := NULL;
P_SUPPLIER_ID NUMBER := NULL;
v_user_id NUMBER;
BEGIN
FND_USER_PKG.CREATEUSER(
x_USER_NAME => P_USER_NAME,
x_OWNER => P_OWNER,
x_UNENCRYPTED_PASSWORD => P_UNENCRYPTED_PASSWORD,
x_SESSION_NUMBER => P_SESSION_NUMBER,
x_START_DATE => P_START_DATE,
x_END_DATE => P_END_DATE,
x_LAST_LOGON_DATE => P_LAST_LOGON_DATE,
x_DESCRIPTION => P_DESCRIPTION,
x_PASSWORD_DATE => P_PASSWORD_DATE,
x_PASSWORD_ACCESSES_LEFT => P_PASSWORD_ACCESSES_LEFT,
x_PASSWORD_LIFESPAN_ACCESSES => P_PASSWORD_LIFESPAN_ACCESSES,
x_PASSWORD_LIFESPAN_DAYS => P_PASSWORD_LIFESPAN_DAYS,
x_EMPLOYEE_ID => P_EMPLOYEE_ID,
x_EMAIL_ADDRESS => P_EMAIL_ADDRESS,
x_FAX => P_FAX,
x_CUSTOMER_ID => P_CUSTOMER_ID,
x_SUPPLIER_ID => P_SUPPLIER_ID
);
SELECT user_id
INTO v_user_id
FROM fnd_user
WHERE user_name = P_USER_NAME;
DBMS_OUTPUT.PUT_LINE ('User_id : ' ||v_user_id);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error while creating a user: '||sqlerrm);
END;