I have an app that has two patch functions. The first patch runs fine, no issues.
So now time for the second patch. When I run this, I constantly get the message:
message": "Oracle: ORA-22816: unsupported feature with RETURNING clause\r\n inner exception: Oracle: ORA-22816: unsupported feature with RETURNING clause"
In the first table, there is a field called ABSTRACT_ID. In the second table, we have the same field and there is a relationship between RPU_ABSTRACT and RPU_ABSTRACT_PROGRESS_UPDATE.
I understand the logic that there has to be an ABSTRACT_ID in the first table that the second table is looking for.
I can go into SQL Developer and manually perform the insert queries and all is well.
I can also add them manually in the patch functions and everything works. It's only when I am trying to do everything using data from the form that I am having an issue.
Here is the code:
Also, the form that is triggering these patches only has two fields, a text input field and a list box and it's not wrapped in a form. They are stand-alone controls.
// Initialize variables
Set(varPatchSuccess, false);
Set(varNavigate, false);
// Attempt to Patch to RPU_ABSTRACT
If(
!IsBlank(LookUp('NCERDB.RPU_ABSTRACT', EPA_ID = dcEPAID.Value)),
// If a record exists
Notify("The grant number already exists. Redirecting to the next screen to continue editing.", NotificationType.Error);
Set(varNavigate, true);
Navigate('Abstract Header', ScreenTransition.Fade)
,
// Else, attempt to Patch
If(
IsError(
Patch(
'NCERDB.RPU_ABSTRACT',
Defaults('NCERDB.RPU_ABSTRACT'),
{
EPA_ID: dcEPAID.Value,
ABS_TYPE: lstType.Selected.Value,
ABSTRACT_ID: varnewAbstractID,
CRE_BY_USER_NM: varUserName,
PROJ_START_DT: Today(),
PROJ_END_DT: DateAdd(Today(), 365, "Days"),
CRE_DT: Today(),
ABS_TITLE: "Test Title",
RFA_ID: If(IsBlank(ddRFAID.Selected), 0, ddRFAID.Selected.RFA_ID)
}
)
),
// If the patch fails
Notify("Failed to create record in RPU_ABSTRACT.", NotificationType.Error);
Set(varPatchSuccess, false)
,
// If the patch is successful
Set(varPatchSuccess, true);
Notify("Record successfully created.", NotificationType.Success)
)
);
// Check if the record exists in RPU_ABSTRACT and proceed with the second patch
If(
varPatchSuccess || !IsBlank(LookUp('NCERDB.RPU_ABSTRACT', ABSTRACT_ID = varnewAbstractID)),
// Patch to RPU_ABSTRACT_PROGRESS_UPDATE
If(
IsError(
Patch(
'NCERDB.RPU_ABSTRACT_PROGRESS_UPDATE',
Defaults('NCERDB.RPU_ABSTRACT_PROGRESS_UPDATE'),
{
REPORT_ID: varNewReportID,
ABSTRACT_ID: varnewAbstractID,
RPT_YR: 0,
CRE_DT: Today(),
CRE_BY_USER_NM: varUserName,
SEQ_NO: 1
}
)
),
// If the second patch fails
Notify("Failed to create record in RPU_ABSTRACT_PROGRESS_UPDATE.", NotificationType.Error);
// Delete the record from RPU_ABSTRACT if the second patch fails
RemoveIf('NCERDB.RPU_ABSTRACT', ABSTRACT_ID = varnewAbstractID);
Notify("Record deleted from RPU_ABSTRACT due to patch failure.", NotificationType.Error)
,
// If the second patch is successful
Notify("Flow executed successfully.", NotificationType.Success);
Navigate('Abstract Header', ScreenTransition.Fade)
)
,
// If the first patch was not successful and the record doesn't exist
Notify("Patch failed. Please check the data and try again.", NotificationType.Error)
);