after two days of coding, I finally found out what to do with my previous problem of being able
to prompt a username based on a table. now if anyone is kind enough to please teach me how can I
set restrictions to users based on the following conditions:
for a user to insert and update, he/she must have a username with a granted_role of doc_maint
and expiry date (NOTE: BOTH are columns in the table clm_usr together with the column username) must be NULL.
else, all users who do not meet the conditions are only allowed to view data.
here are the codes i need to edit by the way:
Code:
BLOCK5 -> LOGIN -> WHEN-BUTTON-PRESSED
DECLARE
lv_flag_txt CHAR(1);
lv_member_txt VARCHAR2(25);
BEGIN
login_sp (:BLOCK5.user, lv_flag_txt, lv_member_txt);
IF lv_flag_txt='Y' THEN
GO_BLOCK('LINE');
/*GO_ITEM('line.line_pref');*/
execute_query;
ELSE
SET_ITEM_PROPERTY('BLOCK5.login_reject', VISIBLE, PROPERTY_TRUE);
END IF;
END;
---------------------------------
PROGRAM UNITS -> LOGIN_SP(Procedure Body)
PROCEDURE login_sp
(p_user IN VARCHAR2,
p_flag OUT CHAR,
p_mem OUT VARCHAR2)
IS
lv_expiry_dt clm_usr.expiry_dt%TYPE;
BEGIN
p_flag :='N';
SELECT expiry_dt
INTO lv_expiry_dt
FROM clm_usr
WHERE UPPER(username)=UPPER(p_user);
IF SQL%FOUND THEN
p_flag := 'Y';
END IF;
EXCEPTION
WHEN no_data_found THEN
p_flag := 'N';
WHEN too_many_rows THEN
p_flag := 'Y';
END;