A simple non-working UPDATE problem in Forms 4.5
Date: Tue, 12 Jan 1999 05:47:06 GMT
Message-ID: <77enkq$44t$1_at_nnrp1.dejanews.com>
[Quoted] Hi all,
There's a simple program to change the password of a user that I've made as part of a sample application. The database is in Personal Oracle7 Release 7.2.2.3.1. The program is written in Developer 2000/Forms 4.5 (Designer) Version 4.5.6.5.5 (Production). (OS is Win 98 4.10.1998 on a Pentium 150, 32 MB RAM). [Quoted] In the database there's a table by the name of 'Password' having the structure as following:
[Quoted] SQL> desc password;
Name Null? Type ------------------------------- -------- ---- USER_NAME VARCHAR2(20) PASSWORD VARCHAR2(30)
The contents are as following:
SQL> select * from password;
USER_NAME PASSWORD
-------------------- ------------------------------ supervisor supervisor
In the Forms program, I've create a block 'old_password' to accept the username and old password, the structure of which is:
USER_NAME (to accept username) PASSWORD (to accept old password) OK1 (OK button)
A trigger on OK1 is 'WHEN-BUTTON-PRESSED' with the following code:
declare
v_name varchar2(20);
V_password varchar2(30);
begin
:global.v_password := lower(:old_password.user_name);
:global.v_name := lower(:old_password.password);
select lower(user_name),lower(password) into v_name,v_password from password
[Quoted] where lower(user_name) = :global.v_password and lower(password) =
:global.v_name;
If SQL%NOTFOUND THEN
MESSAGE('INCORRECT NAME OR PASSWORD.CHANGE OFPASSWORD NOT ALLOWED');
EXIT_FORM;
ELSE
HIDE_VIEW('OLD_PASSWORD');
GO_BLOCK('NEW_PASSWORD');
SHOW_VIEW('NEW_PASSWORD');
END IF;
clear_block(no_validate);
EXCEPTION
WHEN TOO_MANY_ROWS THEN
RAISE FORM_TRIGGER_FAILURE;
END;
This code puts control in another block 'new-password' which have two text
boxes, one to accept new password, another to confirm
it. The 'OK2' item in this block has a trigger 'WHEN-BUTTON-PRESSED' with the
following code:
declare
v_pass varchar2(20);
begin
[Quoted] if lower(:NEW_PASSWORD.PASSWORD) = lower(:NEW_PASSWORD.PASSWORD1) THEN
:SYSTEM.MESSAGE_LEVEL:='20';
v_pass:=lower(:NEW_PASSWORD.PASSWORD1);
UPDATE PASSWORD SET PASSWORD = v_pass
WHERE USER_NAME = :global.v_name and
PASSWORD = :global.v_password;
clear_message;
MESSAGE('PASSWORD CHANGED.');
EXIT_FORM(DO_COMMIT);
ELSE
clear_message;
MESSAGE('PASSWORDS DO NOT MATCH. ENTER ONCE AGAIN!');
:NEW_PASSWORD.PASSWORD := '';
:NEW_PASSWORD.PASSWORD1 := '';
go_item('NEW_PASSWORD.PASSWORD');
END IF;
end;
When I execute this forms application and give a new password, say 'abc', instead of updating the password in the table, the result I get is as following:
SQL> select * from password;
USER_NAME PASSWORD
-------------------- ------------------------------ supervisor supervisor abc supervisor abc
Now where am I going wrong, can someone help me out !!
(I've also tried using an ON-UPDATE trigger on the 'new-password' block without any result)
Very thanks in advance to anyone who can help me.
Sincerely
Manish Chowdhury
(PS: I would appreciate an individual reply)
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Jan 12 1999 - 06:47:06 CET