Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a database

Status
Not open for further replies.

hluash

Programmer
Aug 7, 2001
10
0
0
UG
I want to save a record the I edited but I want to put the code under the save button and I have something like this:
DECLARE
l_rowid VARCHAR2(30);
CURSOR exists_cur
IS SELECT ROWID FROM tab_A
WHERE id = :tab_A .id;

BEGIN
IF :global.l_add = 't' THEN
COMMIT_FORM;
END IF;

IF :global.l_edit = 't' THEN
FETCH exists_cur INTO l_rowid;
IF exists_cur%FOUND THEN
UPDATE tab_a
SET field_1=:tab_A .field1, tab_A .SURNAME =:tab_A .SURNAME
WHERE ROWID = l_rowid;
ELSE
COMMIT_FORM;
END IF;
END IF;

CLEAR_FORM;
GO_FIELD('add_btn');

END;


Instead this just makes the my pc to hang can somebody tell me what makes it(pc) hang and how can save the updated info.
 
Try to check whether the row you're trying to update is not locked by another session. Use select for update nowait in your cursor. This also prevents from changing/deleting already selected row by others.
BTW why do you select rowid explicitly instead of updating with 'where current of' clause? And I also can not see your open/close cursor statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top