Home » Developer & Programmer » Forms » Update from forms (Oracle IDS 10g,Windows XP)
Update from forms [message #384729] Thu, 05 February 2009 00:11 Go to next message
anugraha
Messages: 15
Registered: February 2009
Junior Member
Hi !

I have a block in my form based on ch_pwd
Table name:ch_pwd block:ch_pwd
 
employeeid,old_password,new_password,confirm_new_password
 
Table name:emp_login
employeeid,password


In block ch_pwd, i have placed 2 buttons, one for save and other for update..

After the clicking save, i would click update to update the records saved in this table to another table(emp_login)..

I used the coding
Table Name:ch_pwd,emp_login
 
UPDATE emp_login A
SET password = (SELECT new_password FROM ch_pwd WHERE EMPLOYEEID = A.EMPLOYEEID);



and also tried with
UPDATE emp_login
        SET password = ( SELECT password
                    FROM ch_pwd
                    WHERE emp_login.employeeid = ch_pwd.employeeid)
               
               WHERE EXISTS
          ( SELECT password
                    FROM ch_pwd
                    WHERE emp_login.employeeid = ch_pwd.employeeid);



Both didnt work .. the data is not getting updated..

Pls help to overcome this..

Thanks and Regards
anu
Re: Update from forms [message #384777 is a reply to message #384729] Thu, 05 February 2009 02:58 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You "forgot" to join table columns with forms data block columns; something like
UPDATE emp_login A SET 
  password = (SELECT new_password FROM ch_pwd WHERE EMPLOYEEID = :your_data_block.EMPLOYEEID)
  where employeeid = :your_data_block.employeeid;

However, you might probably do that as
update emp_login set
  password = :your_data_block.new_password
  where employeeid = :your_data_block.employeeid;

[Updated on: Thu, 05 February 2009 02:59]

Report message to a moderator

Re: Update from forms [message #384781 is a reply to message #384777] Thu, 05 February 2009 03:12 Go to previous messageGo to next message
anugraha
Messages: 15
Registered: February 2009
Junior Member
Hi Sir !

Tried with the coding u suggested still its not working!

Thanks and Regards,
anu

[Updated on: Thu, 05 February 2009 03:21]

Report message to a moderator

Re: Update from forms [message #384926 is a reply to message #384781] Thu, 05 February 2009 14:54 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you commit at the end of the transaction?
Re: Update from forms [message #384955 is a reply to message #384926] Thu, 05 February 2009 22:00 Go to previous messageGo to next message
anugraha
Messages: 15
Registered: February 2009
Junior Member
yes sir i did..

If give commit its updating all the rows of the table instead of updating a single row corresponding to the employeeid..

Thanks and Regards
anu
Re: Update from forms [message #384956 is a reply to message #384955] Thu, 05 February 2009 22:39 Go to previous message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
All the records? In that case, I'm afraid that you didn't look carefully enough into my example - your UPDATE misses the WHERE condition which tell Oracle to update exactly one record - the one that belongs to that particular employee:
UPDATE ...
SET ...
where employeeid = :your_data_block.employeeid;   --> you are missing this line


By the way, saying that "it does not work" isn't very descriptive. Why didn't you post your current UPDATE statement? Without it, all we can do is guess.
Previous Topic: HELP-ORA106551
Next Topic: Canvas - Graphic object properties
Goto Forum:
  


Current Time: Mon Dec 05 05:09:46 CST 2016

Total time taken to generate the page: 0.05039 seconds