Validation in a Multi Row Delete
Hi all,
i made a page with an updateable report region - all works fine.
But now i want to do a validation in the process 'Multi Row Delete'.
The aim is to guarantee that the specific row is not deleted if the validation for that row fails.
How can i achieve that?
Any feedback is welcome.
Best regards
Martin
Hi,
many thanks for your reply.
Yes in my case it is a tabular form and the validation should be done vor 'multi row delete'. Accordingly to the article you mentioned i created a validation with the following PL/SQL code:
DECLARE
vRow PLS_INTEGER;
BEGIN
FOR i in 1..apex_application.g_f01.COUNT LOOP
IF apex_application.g_f01(i) IS NOT NULL THEN
vRow := TO_NUMBER(apex_application.g_f01(i));
IF lpkom_api.checkPersonAssigned(apex_application.g_f03(vRow)) THEN
RETURN 'Delete is not allowed for this row.';
END IF;
END IF;
END LOOP;
END;
Best regards
Martin
Similar Messages
-
Tabular form - Multi row delete error
Apex 4.0.2
We have a simple CRUD type of application on a bunch of tables built using Apex v1.6 that has, over the years, been upgraded to v4.0.2 and it is working mostly fine. It uses all out-of-the-box standard components, forms, classic reports, nothing too fancy. Recently one of the tabular forms started to misbehave, the multi-row-delete process raises a No Data Found error. The tabular form is based on a view with a INSTEAD OF trigger to handle the DML. Manually deleting the row in SQL*Plus works fine delete from mytab here pk_id = :pk_id but selecting the same row in Apex and clicking Delete raises the error.
How does one go about troubleshooting & fixing this sort of thing? I tried re-saving the region in the Builder, exporting/importing the entire app, nothing. Running in Debug mode doesn't really provide any additional information, just that the MRD process failed. Tabular forms are the most frustrating, opaque component in Apex, wish they were easier to troubleshoot.
Any ideas?Hello Vikas,
>> How does one go about troubleshooting & fixing this sort of thing?
By given us a bit more information :)
• Is it a manual Tabular Form (using the ITEM API) or a wizard created one?
• Are the Insert/Update operations work correctly? If not, what is the type of your PK column(s)?
• If the problem is limited to the Delete operation, maybe the problem lies with the checkbox column. Are you sure that on page it is rendered as the f01 column?
• As triggers are involved, can you save the PK that the trigger sees? Is it the expected value?
• Are there any other processes that are fired before the DML process? If so, maybe the problem is with them. You can temporarily disable them and see if it change anything.
>> Tabular forms are the most frustrating, opaque component in Apex, wish they were easier to troubleshoot
Yes, I agree. However, I believe that 4.1 made some serious advancement where Tabular Form is concerned. Having simplified Tabular Form related Validations and Process should make things easier, and as a result, prone to less errors. Still, the main problem is that the type of error you are talking about is usually the result of metadata problems and these are indeed very hard to track.
Regards,
Arie.
♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
♦ Author of Oracle Application Express 3.2 – The Essentials and More -
Multi-row Delete (MRD) on a view?
All,
I created a tabular form on a view, using an instead of trigger to encapsulate the logic for the data manipulations. Works great--until someone checks a row and hits the delete button, at which point APEX throws this error:
ORA-20001: Error in multi row delete operation: row= 107970-18527, ORA-06502: PL/SQL: numeric or value error: character to number conversion error,
Error multi row operation failedAs far as I can tell, it's not even getting to the trigger; I commented out the body of the instead of delete trigger (replacing it with null), and I'm still getting the same error. I have no validations or processes on the page at this point.
The underlying data of the view requires three columns for a unique identifier, so I've concatenated two of them together as an extra column in the view (creating a varchar2 column), and told the MRD to use the calculated column and the third column as the primary key columns. But even using two of the three numeric columns (tweaking the trigger to use a hard-coded value for the third) as an ID fails miserably.
Any idea what's going on?
Thanks,
-David
(In case it makes a difference, we're on APEX 4.0.1.)Hi David,
This might help:
http://oraclequirks.blogspot.com/2011/07/ora-20001-error-in-multi-row-delete.html
Hope it helps!
Regards,
Kiran -
Multi Row Delete and then I get a unique contraint violation on my PK
I have a simple table with 2 columns, one a PK. I have a checkbox style, multi-row delete function setup on this (to be honest, APEX set this up automatically).
I removed the add/edit functionality to keep just the delete button and delete procedure.
When I select an item, and then click delete, I get a unique constraint violation that I'm violating my Primary Key.
How can I fix this, or see what it's doing when it tries to delete the row?Hi,
It sounds as though you haven't properly removed all of the add/edit functionality or that you still have some form of validation and/or computation in place or that you have a trigger that is trying to insert records into, for example, a history table (is the constraint on the table you are deleting from - the error message should tell you this?)
Check that the only process you have is ApplyMRD and that this is pointing to the correct table and has the correct primary key set. Ensure that this has Conditional Processing set for a Request of "MULTI_ROW_DELETE".
Check for any validations - there is no need to perform validations if your user can not insert or update data unless you want to check that they've ticked one or more checkboxes.
Check for processes that could run if the user clicks the Delete button. Validations and processes could be conditional on either the button click or on request = "MULTI_ROW_DELETE".
Review any triggers that you have on the table to ensure that deletions do not try to insert records into another table where the primary key on that table is not being populated.
Regards
Andy -
Hi, I'm new in apex and I tried to build master detail report on some view. Everything is cool but "delete checked" doesn't work.
"ORA-20001: Error in multi row delete operation: row= , ORA-06502: PL/SQL: numeric or value error: NULL index table key value,"
the problem is that I don't know what is wrong :), I have a special trigger "instead of delete on MY_VIEW", but in this error problem is not explained.
Anybody knows what can be wrong? It is probably a problem with trigger or multi row doesn't work with views? I couldn't find how MRD knows what kind of statement use to delete rows so I don't know if the statement that program used is correct. In debug it lokks that:
0.32: ...Do not run process "ApplyMRU", process point=AFTER_SUBMIT, condition type=REQUEST_IN_CONDITION, when button pressed=
0.32: ...Process "ApplyMRD": MULTI_ROW_DELETE (AFTER_SUBMIT) #OWNER#:MY_VIEW:ITEM1:ITEM2
0.33: Show ERROR page...
0.33: Performing rollback...
thanks for any help
//sorry for english mistakes
edit: it doesn't matter if I use in trigger delete from ... where item1=:OLD.item1 ; or if I use item1=:P4_item1 (which actually saves correct values)
Edited by: user5931224 on 2009-06-13 08:55I realised that this is not a problem with trigger, I changed trigger to "NULL;" and problem is the same. Maybe sb used master detail on view not only on tables and know what can be wrong in this situation?
-
ORA-20001: Error in multi row delete operation: ORA-01403: no data
Whenever I attempt a multi-row delete on my master detail page, I recieve the error:
ORA-20001: Error in multi row delete operation: ORA-01403: no dataI have seen in other threads that the primary key attribute of the underlying table needs to be set to 'Show' in the report attributes. I have tried this both with it displaying as 'Hidden' ('Show' is unchecked) and with it displaying as text. Either way still gives me the same error.
Is there anything else not mentioned in the other threads that could be causing this error for me?
Thanks.
BoilerUPJimmy,
In your multi row delete process you specify schema name, table and column name. Your report needs to be of type âSQL query (Updateable report)â. And your report needs to include the primary key column of your table. The column or alias name of that report column needs to correspond with the actual column name of your table.
Marc -
Multi Row Delete & Row selector in 1.5
Hi All,
Please forgive my ignorance.
But, are these processes (Multi Row Delete, Row selector) not available for HTML DB 1.5.
What is the other way to do this.
Thanks
MonikaHi Monika,
It's been a while since I used 1.5 so I can't answer that, however whilst I'm not generally in favour of upgrading just for the sake of it, is there a reason why you wouldn't consider upgrading to a later release? -
Hi,
Am trying to do a multi row delete on a report. Have added a [row selector] to the report and a 'multi row delete' process. Copied this from a sample app i got, but when i try and delete a row(s) i get the following error message:
Unexpected error, unable to find item name at application or page level.
ERR-1002 Unable to find item ID for item "P2_ROWS" in application "120".
Can anyone give me any hints as to why this might be happeneing?
Best regards
SimonSimon,
Are you still having trouble with this?
Scott -
Multi-Row Delete from a table via a button without submitting the page
Hi,
I have a simple page based on a (temporary) table. There is a submit button that calls a PL/SQL process. However, I would like to have an 'Abort' button that deletes all rows from the table belonging to a specific user.
I had a look at 'Processes -> Data Manipulation --> Multi Row Delete' but this can only be linked to a page level event such as onSubmit. My onSubmit is linked to another process so this is not an option for me.
I thought of creating a PL/SQL function for the deletion and calling it from Javascript linked to a button. I have done the PL/SQL and the button but don't know how to call PL/SQL from JS. And is this the correct way of doing something like a deletion? Any documents that show how can this be done will be much appreciated....
I had a look at the forum and the documentation but could not find anything for multil-row deletion triggered from a button.
Your help is appreciated as I'm a newbie :-)
Thanks
AngelaHi,
I actually found the solution. I created a button (that submits) and a computation that calls the PL/SQL function conditional on that button being pressed. Initially I got confused because I already had another PL/SQL function attached to different button. I didn't think that having two buttons that submit the page and call different functions was possible.
Thanks
Angela -
Hello,
I want to display a checkbox in a multi-row query for deletion.
when the user will submit, I want to delete all checked record.
I've tried to do it by creating a checkbox in the select statement of the query (select HTMLDB_ITEM.CHECKBOX (1, 'Y') checkbox, ...) and create a process to do the delete. Here my process code:
declare
l_val_rows varchar2(400) default null;
begin
for i in 1..htmldb_application.g_f01.count loop
if instr(nvl(htmldb_application.g_f01(i),0),1) > 0 then
delete gsr_corporates where id = htmldb_application.g_f02(i);
end if;
end loop;
end;
2 problems:
1)
When I submit, if my checkbox is not checked, I get error "Error in mru internal routine: ORA-20001: no data found in tabular form". If checked, it is working.
2)
When checked, I get the error "Error in mru internal routine: ORA-20001: Checksum column ("FCS") is required and was not supplied".
So, is it a good way to do what I want? If yes, what's wrong? If no, what is your suggestion?
Thank you
JeanJean,
Please take a look at this example:
http://www.oracle.com/technology/products/database/htmldb/howtos/checkbox.html#HANDLE
The problem is that when a checkbox is not checked, there is no corresponding entry in the array. Thus, the array indexes for f01 and f02 will be out of sync. To fix this, make the value of a checkbox, when checked, the primary key of the row you want deleted. Then you can simply walk through one array and delete every row that corresponds to an entry in it.
Sergio -
Multi-Row Form Validations - Cannot Re-Use Phone Nos from select LOV
1) I need some help with a "Multi-Row" data-entry form (page 9)...I have a select list of phone-no's that user picks from the drop-down lov list on a page multi-row select list-drop down - P9_PHONE_ID (has built in lov). The data form is built on 'site_phone_assign' table.
However, I need to put a page-level validation where the user CANNOT select a pre-assigned phone id (reuse a phone) that's already been assigned (used) and a record exists in the site_phone_assign table. I built the following page level validation on the multi-row edit form which is built on 'site_phone_assign' table...NOT WORKING!
PLEASE HELP WITH THE BEST WAY TO DO THIS..Thanks!
--validation type: Function returning boolean
<code>
DECLARE
v_count pls_integer default 1;
BEGIN
IF (:P9_PHONE_ID IS NOT NULL) THEN
select count(*)
into v_count
from datahub.site_phone_assign s
where s.phone_id = :P9_PHONE_ID
and s.ASSIGN_START_DATE <= SYSDATE
AND NVL(s.ASSIGN_END_DATE,SYSDATE+1) >= SYSDATE;
END IF;
IF (v_count) > 0 THEN
RETURN (FALSE);
ELSE
RETURN (TRUE);
END IF;
END;
</code>
2) How can I apply validations on a multi-row edit form page where say - start_date is always less than end_date? Both start/end dates are date-picker type of items.
3) Can ITEM NOT NULL validation be applied on a multi-row edit page? I guess its page-level validation right? Please advice.
Edited by: Shravanv on Feb 18, 2010 1:50 PMHello,
In a Tabular Form you need to loop through the records on the screen, so doing a check on :P9_PHONE_ID doesn't work...
Patrick Wolf made a general solution for this problem, you can read about it here: http://www.inside-oracle-apex.com/plug-play-tabular-form-handling/
Regards,
Dimitri
http://dgielis.blogspot.com/
http://www.sumneva.com/ -
Multi Row Delelte - Delete all rows
I have a multi row delete button with multi row checkboxes. When I tried to delete the selected rows, actually all rows are deleted. I have a multi row delete process.
Other information:
This tabular form displays all related users for one particular department. The department ID is the primary key in this reference table.
I am using APEX 2.2 and IE as browser. Any one else here know what settings I should set.After review previous thread, I created the following PL/SQL expression for the multi row delete process in the condition field:
FOR I IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
DELETE FROM tbl
WHERE colNM = APEX_APPLICATION.G_F02(APEX_APPLICATION.G_F01(I))
END LOOP;
END;
I also tried htmldb_application.g_f01.count to reference the selected rows. Both of them are not working. Someone, please help, where should I put this PL/SQL expression. I am pretty to APEX.
Thanks. -
I have read a few posts that mention a multi-row-insert but I can't find it.
There is a multi row update and a multi row delete.
I am using html db 1.6. We will be upgrading after we get this version of our app up and running, but don't want to take time out for the upgrade right now.
Is multi_row_insert new to Application Express 2.0?
Thanks,
GregoryNo, the multi row insert is not new to 2.0
The builtin MRU processes handle multi-row updates and multi-row inserts. However, the default Add Rows process that the wizard creates on a tabular form does create only 1 blank row when you click the Add Row button. To increase this, just open the Add Rows process page and change 1 to a different number. -
Need to perform multi-row update/delete
Gday,
I have a request to have one update button for a multi-row form. Also needed will be a checkbox as part of the row.
The check boxes only purpose is to signify the record should be deleted. Thus I am assuming I cannot use default
apex functionality and must manually build the multi-row form. I guess I would loop through and check to see if a
record is checked delete otherwise loop through and update all columns for that record? I am assuming I should
use the examples in http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
is that all still valid for apex 3.2.1?
CheersHello:
You could also do the following
Generate the tabular form page using the wizard
Delete or not display the 'Delete' button
Delete or not execute the 'ApplyMRD' process
Create a new page process with a sequence higher than the standard MRU processes. Make this process conditional on the 'Submit' button. Use code similar to the one below for this page processfor i in 1..apex_application.g_f01.count loop --- f01 is the selector checbox, f02 is the hidden column with the table's PK
delete from emp where empno=apex_application.g_f02(apex_application.g_f01(i));
end loop;Now, when you click 'Submit' records with their selector checkbox checked will be deleted by the newly added page process. The rest of the functionality of the tabular form remains the same.
varad -
Forms Multi-row validation
I have a requirement to show a validation error at form ‘At least one reviewer should have more than zero amount limit'. So we need identify highest amount limit entered in multiple rows, that highest amount limit should be >=1 if not show an error.
Level Reviewer Amt limit
1 ABC 0
2 MNP 0
3 XYZ 0
In the above case I need show an error msg. I tried pre-insert. It didn’t work because built-in not supports pre-inserts.
Pls advice the best methodology to has shown error in this kind of scenario.Hi,
Create a Summary item based on Amt limit.
Then in pre-insert check the value of summary item. If it is < 1 then, raise error .
Regards
Maybe you are looking for
-
Trying to use laf project for the first time
hi all , i need help , please i am trying to use laf project for the first time as i said , and i want help on the installation process step by step please , i am soo junior here i've just downloaded the zip file as the site said (http://fdtool.free.
-
How to restrict the attribute values for the user in query designer
Hi All, I have a requirment where certain user would see certain vailes in the query desiner of the attribute. The requirment is we have planing material which is attribute of material When X user want to restrict the values for planning material ,w
-
Any way to capture a webstream?
I've been asked to edit a web seminar, and the only way that it seems to exist as a sound file is via some kind of web stream. I'm looking for a way to take the sound and feed it into Logic. Does anyone know how to feed the 'outputs' of Safari into L
-
Illustrator CS file saving issues
Since migrating to Vista from XP, my Illustrator CS will not allow me to save documents. Every time I try to save, an error message comes up reading "This is a read only file or it is open in another program", which it is not. I must use a save-as
-
Specified load buffer resource usage is above currently available value
Hello, I am trying to load data into my ASO database. The .mxl and the rules file have worked fine on the development machine but now on another PC I get this error while executing the .mxl Initialize load_buffer with buffer_id 3 Execution Message: S