Home » Developer & Programmer » Forms » Probs in forms....
Probs in forms.... [message #79180] Sat, 11 May 2002 06:47 Go to next message
sharath
Messages: 5
Registered: April 2001
Junior Member
Hi,

I'm working on a project in which I'm using Oracle with D2k as front end. I have put one screen for Changing the password. Actually I'm storing the user details in a table named "logins" which is defined as (create table logins (uname varchar2(15) PRIMARY KEY, password varchar2(15) ; ). And I'm able to log into the system. But, while changing the password, I'm getting the runtime error as "FRM-40600 Record has already been inserted". Why it's not updating is one question and the second one is how come it's giving that Record is already present, when I found no such record to be present in the sql* plus, where the tables are stored. ((Pl. find the code for changing the password here, at the bottom))

Also sometimes, though we change the password in the table by explicitly going into the SQL*plus, it's not accepting the changes in the runtime form. Once we shut down it (not simply by closing the form but,) and restart, then it's responding properly for the changes.
So, as I'm struggling with this for the last 3 days by this mystique behaviour, pl. kindly help me in solving this problem.

Sometimes I doubt, whether anything is wrong with the computer. Is that so???? Please clarify.

Thanx in advance and Regards,

Sharath.

declare
user varchar2(15);
pass varchar2(15);
bool number;
begin
user:=NULL;
pass:=NULL;
bool:=0;
select uname,password into user,pass from logins where
:uname=uname and :password=password;
message('User Name is'||user||'Password is'||pass); --This I have kept for checking whether it's working or not. And it's working and correct values are being displayed.

if user is not NULL and pass is not NULL then
bool:=1;
end if;

if :newpasswd=:confirmpasswd and bool=1 then
begin
update logins set password=:newpasswd where
uname=:uname;

create_record;
commit_form;
message('Password has been Modified');
end;
else
if :newpasswd <> :confirmpasswd then
begin
message('Retype the Password Exactly in the Same manner');
:uname :=NULL;
:password:=NULL;
:newpasswd:=NULL;
:confirmpasswd:=NULL;
go_item('uname');
end;
end if;
end if;

EXCEPTION
when no_data_found then
message('UserName/Password Not Matching');
raise form_trigger_failure;
end;
Re: Probs in forms.... [message #79184 is a reply to message #79180] Mon, 13 May 2002 01:28 Go to previous messageGo to next message
Remash
Messages: 52
Registered: November 2000
Member
Probably the 'create_record' statement before 'commit_form' is giving the problem. You may have a block with the LOGINS table attached to it. Create_record creates an empty record with null value to the field UNAME, which is not allowed since it is a primary key
Re: Probs in forms.... [message #79197 is a reply to message #79180] Tue, 14 May 2002 22:46 Go to previous messageGo to next message
rama krishna
Messages: 97
Registered: December 2001
Member
hi..
ur problem is simple..
u've creates a base table block with table as Login.
now if u enter any values in items in ur block. it will take as a 'change' to ur block and if u say commit_form any 'changes' to ur block will be inserted as new rows to ur table and not as ur updates. since there is a primary key in the table obviously it gives an error 'record already existing'
so what u can do is create a control block and write the same script without create_record built-in it'll work...
ie., control block is the one u create manually wothout using any wizard..

cheers
ram
Re: Probs in forms.... [message #79199 is a reply to message #79180] Tue, 14 May 2002 22:51 Go to previous message
rama krishna
Messages: 97
Registered: December 2001
Member
hi..
ur problem is simple..
u've creates a base table block with table as Login.
now if u enter any values in items in ur block. it will take as a 'change' to ur block and if u say commit_form any 'changes' to ur block will be inserted as new rows to ur table and not as ur updates. since there is a primary key in the table obviously it gives an error 'record already existing'
so what u can do is create a control block and write the same script without create_record built-in it'll work...
ie., control block is the one u create manually wothout using any wizard..

cheers
ram
Previous Topic: Re: help needed urgently
Next Topic: Eliminating client runtime using Oracle forms 6i
Goto Forum:
  


Current Time: Fri Apr 26 08:24:08 CDT 2024