Home » Developer & Programmer » Forms » FRM-40654 record updated by another user (Oracle Forms 12.2.1.4.0)
FRM-40654 record updated by another user [message #689905] Tue, 09 July 2024 14:50 Go to next message
nrussell34
Messages: 2
Registered: July 2024
Junior Member
Okay, so I am attempting to add a delete button to my form. I have a PAYEE data block, a PAYER data block, three VOUCHER related data blocks, and a DELETION_LOG data block. The Delete button on my PAYEE_CAN (which contains the PAYEE, PAYER, and VOUCHER data blocks) opens the DELETION_CAN which includes a text field for a deletion comment and CANCEL and DELETE buttons. The DELETE button should check to make sure a comment has been entered, and if it has, delete the VOUCHER record. I know I need to move the section that creates the deletion_log record into the ELSE block, so that it only creates a record if the deletion is successful. Here is my PL/SQL as it currently exists:

DECLARE
	alert_button NUMBER;
	v_main_print_date DATE;
	v_current_record NUMBER;

BEGIN
	v_current_record := :VOUCHER.VOUCHER_REC;
	
-- check for comments
	IF :DELETION_LOG.COMMENTS IS NULL THEN
		MESSAGE('Comments cannot be empty.');
		RAISE FORM_TRIGGER_FAILURE;
	END IF;

-- populate deletion log record
	GO_BLOCK('DELETION_LOG');
	DO_KEY('COMMIT_FORM');

-- delete voucher
  GO_BLOCK('VOUCHER');
  DO_KEY('DELETE_RECORD');
  DO_KEY('COMMIT_FORM');
  
  DECLARE
  	v_record_count NUMBER := 0;
  	v_record_exists BOOLEAN := FALSE;
  BEGIN
    SELECT COUNT(1) INTO v_record_count
    FROM MYAPP.VOUCHER
    WHERE VOUCHER_REC = v_current_record;

    IF v_record_count > 0 THEN
    	v_record_exists := TRUE;
    END IF;

    IF v_record_exists THEN
      -- Handle the case where the record wasn't deleted
      MESSAGE('The record was not deleted.');
      RAISE FORM_TRIGGER_FAILURE;
    ELSE
  	  -- COMMIT AND SHOW MESSAGE
      alert_button := SHOW_ALERT('DELETED_VOUCHER_ALERT');
      IF alert_button = ALERT_BUTTON1 THEN
        -- Close the deletion log canvas
        HIDE_VIEW('DELETION_CAN');
      END IF;
    END IF;
  END;
END;
The problem I have is if I try to delete a voucher immediately after creating it. I receive the FRM-40654 code, even though I already have DML Returning Value set to Yes on all of my data blocks. If I re-query the voucher before going through the delete process it works just fine, but I'm trying to avoid my users needing to take extra steps. Is there something that I could add to the trigger that opens the DELETION_CAN to prevent this?

I'll have to wait until I get back home to see if I can't find an answer in the 800+ page Oracle Forms book I purchased.

Thanks
Re: FRM-40654 record updated by another user [message #689906 is a reply to message #689905] Tue, 09 July 2024 20:17 Go to previous message
nrussell34
Messages: 2
Registered: July 2024
Junior Member
I figured it out. Added GO_BLOCK('VOUCHER') and EXECUTE_QUERY to the button that opens the DELETION_CAN to force the re-query.
Previous Topic: When_validate_item and When_validate_record Not working
Next Topic: Free software replacement for Oracle Forms
Goto Forum:
  


Current Time: Mon Jul 22 20:25:55 CDT 2024