By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Procedure with update

P: 31
create or replace
PROCEDURE login IS theuser VARCHAR2(30) := portal.wwctx_api.get_user;
v_forebranch VARCHAR2(10);
v_forecategory VARCHAR2(10);
v_foregroup VARCHAR2(50);
v_count NUMBER(6);

CURSOR c_branch IS
SELECT branch
FROM nyp_libportal.library_user
WHERE UPPER(user_id) = UPPER(theuser);

CURSOR c_category IS
SELECT category
FROM nyp_libportal.library_user
WHERE UPPER(user_id) = UPPER(theuser);

CURSOR c_group IS
SELECT user_grp
FROM nyp_libportal.library_user
WHERE UPPER(user_id) = UPPER(theuser);

BEGIN
IF theuser <> 'PUBLIC' THEN

OPEN c_branch;
LOOP
FETCH c_branch
INTO v_forebranch;
EXIT
WHEN c_branch % NOTFOUND;
END LOOP;

CLOSE c_branch;

OPEN c_category;
LOOP
FETCH c_category
INTO v_forecategory;
EXIT
WHEN c_category % NOTFOUND;
END LOOP;

CLOSE c_category;

OPEN c_group;
LOOP
FETCH c_group
INTO v_foregroup;
EXIT
WHEN c_group % NOTFOUND;

END LOOP;

CLOSE c_group;

htp.p('<B>' || v_forecategory || v_forebranch || v_foregroup || '</B>');

INSERT
INTO portal_home_login_log(logdatetime, category, branch, user_group, counter)
VALUES(sysdate, v_forecategory, v_forebranch, v_foregroup, 35);

END IF;

END;



I have done a procedure which when user login, the procedure will fetch the user's branch, category and user_group and then this procedure will then insert the user's branch, category and also the branch into the portal_home_login_log.

Now I need some help on the UPDATE part which IF another same user who has the same user's branch, category and user_group login, the counter will actually increase 2.


Example Result
[PHP]
DATE CAT BRANCH COUNTER
01-AUG-07 PTA SDN 6
01-AUG-07 ACS SIT 9[/PHP]
Aug 1 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.