Home » Developer & Programmer » Forms » I wanna to delete a single record from a data block based on table in database (oracle 10g , win 8 x64)
icon9.gif  I wanna to delete a single record from a data block based on table in database [message #673855] Thu, 13 December 2018 02:56 Go to next message
Oraclinho
Messages: 6
Registered: December 2018
Junior Member
that`s my code of delete button:

declare
v_alert number;

begin
v_alert:=show_alert('Q_alert');

if v_alert = alert_button1 then

GO_BLOCK('estlam_asnaf');

delete_record;

commit;

end if;
end ;

after I pressed in that button. It inserts the record not delete it. any help to apply this deletion without inserting any record?
Re: I wanna to delete a single record from a data block based on table in database [message #673865 is a reply to message #673855] Thu, 13 December 2018 07:37 Go to previous messageGo to next message
cookiemonster
Messages: 13419
Registered: September 2008
Location: Rainy Manchester
Senior Member
It'll be inserting because there is a record in the block with record_status = 'INSERT'.
The commit causes that record to be inserted.

Is it in inserting the record you're deleting?
If so does that mean the record you're deleting doesn't current exist in the DB?
Re: I wanna to delete a single record from a data block based on table in database [message #673870 is a reply to message #673865] Thu, 13 December 2018 11:26 Go to previous messageGo to next message
Oraclinho
Messages: 6
Registered: December 2018
Junior Member
yea it inserts it .....

I noticed that when I select record from LOV to preview in the canvas and try to delete it. It makes it disappearing from the form only but it still existing in the table and there is notice that there is no change to save.

Also I noticed that I must make ctrl+F11 (execute_query) first then choose the record and press delete button to make a real deletion for the record.

I cannot understand your speech about record_status?! how I can handle something like that to make a real deletion for the record??
Re: I wanna to delete a single record from a data block based on table in database [message #673882 is a reply to message #673870] Fri, 14 December 2018 03:33 Go to previous messageGo to next message
cookiemonster
Messages: 13419
Registered: September 2008
Location: Rainy Manchester
Senior Member
read up on the :system.record_status system variable in form builder help
Re: I wanna to delete a single record from a data block based on table in database [message #673891 is a reply to message #673882] Fri, 14 December 2018 09:36 Go to previous messageGo to next message
Oraclinho
Messages: 6
Registered: December 2018
Junior Member
I did, so I can solve the deletion issue. thanks so much for your help.
Re: I wanna to delete a single record from a data block based on table in database [message #673911 is a reply to message #673891] Mon, 17 December 2018 03:12 Go to previous messageGo to next message
cookiemonster
Messages: 13419
Registered: September 2008
Location: Rainy Manchester
Senior Member
Thanks for letting us know
Re: I wanna to delete a single record from a data block based on table in database [message #673920 is a reply to message #673911] Mon, 17 December 2018 20:38 Go to previous message
Oraclinho
Messages: 6
Registered: December 2018
Junior Member
for sharing the benefit "the main aim of orafaq.com" for all readers of my question. This is the solution.

After reading the help I change my mind to solve that issue. I used the technique of master detail form and the child one. I changed the search technique totally which was depending on LOV. In the other side I used a text item to text search word or date and search button and make it trigger when button pressed as the following:

go_block('master_details_block_name');

commit;

the change where clause of the master details block to make text item = search text item. Also I put the other buttons like save and delete in the master details block and the search and clear buttons in the sub-block. So I solved the problem of delete as the query will be in that new case in execute_query mode then it performs the real deletion instead of insert in the first case. Also it solved the update problem by save button instead of inserting new row because of the same reason of execute_query mode.
Previous Topic: hide password in sql
Next Topic: Oracle 11G Forms Freezes ocassionaly and Oracle 11G Application Freezing (3 threads merged by bb)
Goto Forum:
  


Current Time: Fri Jan 18 23:58:45 CST 2019