How to restrict deletion of all rows in a child table(Ex:all emps in a Dept
I have use case where a table which has a child ID, parent ID and some other columns. I want to restrict deletion of all children of a parent.
I tried a 'before delete' trigger as follows and ended up with a mutating table error-ORA-06512 Any suggestions on how this can be done.
Following is the trigger I tried:
create or replace
TRIGGER C_MODULE_EXEC_SELECT
BEFORE DELETE ON C_MODULE_EXEC_SELECT FOR EACH ROW
DECLARE
rowcnt number;
BEGIN
SELECT COUNT(MODULE_CODE) INTO rowcnt FROM C_MODULE_EXEC_SELECT WHERE EXEC_PLAN_ID=:OLD.EXEC_PLAN_ID AND MODULE_CODE != :OLD.MODULE_CODE;
IF rowcnt = 0 THEN
RAISE_APPLICATION_ERROR(-20000, 'Cannot remove all subject areas from a execution plan');
END IF;
END;
Thanks,
Sireesha
What you have written is clear but it seems to me your rule, as stated, is not valid. At the point where you insert a parent, there will initially be no children. How is that different from any other parent with no children? Is there a guarantee, after inserting a parent, that a child record will be inserted? In one millisecond? One hour? One-hundred years?
And why is the deletion of the last child record any less valid than the deletion of any other child record? Perhaps the rule should be ... when the last child record is deleted the parent should be deleted too. This would be far easier to enforce.
Delete the children and each time check to see if the parent can be deleted. If an exception is raised then it can't be.
Similar Messages
-
Inserting a new row in a child table referencing an already existing parent
I have two tables PARENT & CHILD (one to many), both of which are populated at different times.
In our toplink mappings, parent contains a collection of child Domain Objects, & and child Domain object contains a one - one to parent.
How can I insert a new row in a child table with reference to an already existing row in parent?
When I fetch the parent Domain object and try to set it in the child Domain Object and use the unitOfWork.registerObject() it goes into a circular loop of selecting from 2 other tables.
Please suggest.Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones. -
How can I delete automatically all double photos in the library of iPhoto? jos vdp
How can I delete automatically all double photos in the library of iPhoto? jos vdp
Two apps that I've tried and work very well are iPhoto Library Manager and Duplicate Cleaner for iPhoto
OT -
My itunes library has duplicated "ALL" my files with their individual iclouds. How do I delete them all in one single swipe rather than delete each one individually?
Try Edit > Preferences > Store and untick Show iTunes in the Cloud Purchases. With luck it should be OK if you turn it on again.
tt2 -
How shall I delete the data from R/3 setup tables
Hi Experts,
How shall I delete the data from R/3 setup tables
Regards
SailekhaHi Sailekha , to delete the set up table in r/3 either u can go to tcode LBWG as already mentioned or u can also delete the same from tcode SBIW
Settings for Application-Specific DataSources (PI) -
Logistics -
Managing Extract Structures -
Initialization -
Delete the Contents of the Setup Tables .
Just click the clock there then u hace toi juct give the application component name like for Inventory 3 , then execute it , it will delete the set up table for inventory ..
Regards.. -
-How to restrict Description into single row in the report
Hello Colleagues
I have a report which shows Material number versus Revenue. In the row, material is displayed with Technical name and description.
Here, the view of the report shows the description in single line. While, in the report, description of the report runs 3 to 4 lines though description contains 5 to 6 words (which can fit easily into single line).
Let me know how to restrict each row descrption into single line.
Regards,
NingarajuHello Colleagues
Please find the format it is currently appearing in the web reports.
Material Num Material Description Revenues (In Eur)
1000001 "SAP
ERP
Professsional
User" 111
Wanted to change above format into as below in which it has to show material description in single row.
Material Num Material Description Revenues (In Eur)
1000001 "SAP ERP Professsional User" 111
Regards,
Ningaraju -
How can I delete the last row of a Matrix
Hi All,
Does anyone know whether deleting the last row of a matrix controlled by a UDO child table gives problems? I have the strange effect that I cannot delete the very last existing row in the matrix, i.e. after updating the delete the last to-be deleted row comes back into my matrix !!
I give you a snippet of my code (function getSelectedRow gives the selected row in the matrix):
==
if (evnt.ItemUID.Equals(ViewConstants.Items.DELETEBUTTON))
if (evnt.EventType == BoEventTypes.et_ITEM_PRESSED)
if (evnt.BeforeAction)
form = BusinessOne.Application.Forms.Item(formUID);
mtx = (Matrix)form.Items.Item(ViewConstants.Items.MATRIX).Specific;
int numRow = getSelectedRow(mtx);
if (numRow != -1)
mtx.DeleteRow(numRow);
form.Mode = BoFormMode.fm_UPDATE_MODE;
Item btn = (Item)form.Items.Item(ViewConstants.Items.ADDBUTTON);
btn.Enabled = true;
==
Cheers,
Marcel Peek
Alpha One
Message was edited by: Marcel Peek
Message was edited by: Marcel PeekYes, there is a problem to delete the last row.
It is fixed in version 2005. -
How to restrict the no of rows to be displayes in ALV in webdynpro
Hi All,
Can any one suggest how to restrict the no of records to be displayed in the portal in the ALV through webdynpro ABAP.
Thanks & Regards,
Sreelatha Gullapalli.HI,
If you want to change the Source (Design time) then you can do that via the alv configuration.
Something like this in the component SALV_WD_COLUMNS_UI
lr_available_model->if_salv_wd_table_settings~set_visible_row_count( lc_row_count ). -
How can I delete the All Imported folder on my ipad (imported from an SD card)
When traveling, I import all of the pictures I take each day into the photos app to view the day's results, and provide a back up copy. I then return the SD card to my camera for the next day's use. In this way, at the end of my trip, I have all of my photos on both my SD card (or cards) and also my ipad. When I return home, I load all of my photos into Photoshop on my PC for storage and editing.
I then wish to delete the entire All Imported folder from my ipad. I have not found a way to do this. I could theoretically individually select each photo and then delete them all. This is impractical, however, since I have thousands of pictures on my ipad by the ende of the trip.
I seems to me that there must be a way to delete the entire imported folder, but I can't find it. I can delete folders that I manually create using the edit function, but this doesn't work for the imported folders.
I haven't been able to find a solution on the community or using google. Any help will be appreciated.The iPhoto App can select all of the photos in the All Imported folder and delete them.
-
How to create multiple rows in a child table from the multi select Lov
Hi
We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
Any inputs on how to implement this scenario please..Maybe you can get some ideas from here -
http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html -
Can't delete newly added row in inner advanced table
Hi!
Im using advanced in advanced table and i can't delete a row after i added in detail table, i have to refresh the page in order to delete the row.
This is what i do.
execute query from master table
expand row in master table
click Add row button in detail table(standard button in footer)
add data in columns
click save button
select row with multiselect and then click delete button but nothing's happend i just can delete older rows
also i can't edit the new row just older rows.
i think that is something wrong with the cache :S
any ideas?
thanks!
Edited by: 892088 on 03-nov-2011 16:06still no answers, the problem is with the new row created because i cant delete or modify it.
any comment? -
How can i find the latest row inserted in a table
i have a table with five columns and there is no primary key and everyday 100's of rows will be inserted to this table ,infact by mistake i have inserted a row and i just want to find out which is the last row i have inserted in to this particular table is there any way to find out this please......
That's not guaranteed to give you the latest row added to the table. Oracle could place new rows anywhere depending on what happened to rows in the table previously, what space is available in the tablespace etc etc:
SQL> create sequence dt_test_rowid_seq start with 1 increment by 1;
Sequence created.
SQL>--generate some test data
SQL> CREATE TABLE dt_test_rowid as
2 select object_id,
3 object_name,
4 dt_test_rowid_seq.nextval ins_sequence
5 from
6 dba_objects
7 where
8 object_id is not null
9 and
10 rownum <10000;
Table created.
SQL>--here, the latest addition to the table....
SQL> select max(ins_sequence) from dt_test_rowid;
MAX(INS_SEQUENCE)
9999
SQL>... reflects the highest rowid
SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
INS_SEQUENCE
9999
SQL>--get rid of a load of rows
SQL> delete from dt_test_rowid where mod(object_id,2)=0;
2521 rows deleted.
SQL>--insert a load more
SQL> insert into dt_test_rowid
2 select object_id,
3 object_name,
4 dt_test_rowid_seq.nextval ins_sequence
5 from
6 dba_objects
7 where
8 object_id is not null
9 and
10 rownum <1000;
999 rows created.
SQL>--and here the latest addition to the table...
SQL> select max(ins_sequence) from dt_test_rowid;
MAX(INS_SEQUENCE)
10998
SQL>--...is NOT reflected by the highest rowid
SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
INS_SEQUENCE
9999 -
How to Restrict a user to a access a particular table
HI ,
how to restrict an user to a one particular table and he should have only dispaly authorization for that , can anyone suggest me how to do this.Hi,
Is it a standard table ? S_TABU_DIS (Client Dependant) and S_TABU_CLI (Cross client) are the the authorization objects that controls table maintenance. With Authorization group and activity 03, you can give user access only to Display.
You can look at table TDDAT to find the authorization group of the table. If it is a custom table for which original t-code is SM30 ( You can look at SU24 to verify that) and it does not have authorization group assigned to it, then you can ask your developer to assign authorization group to the table using t-code SE54. then again make use of S_tabu_dis with activity 03 and Auth group as designed to restrict access.
Also something to look for is Note 1481950 - New authorization check for generic table access using new auth object S_TABU_NAM. Remember Bernhard talking about it.
Edited by: Nishant Sourabh on Oct 1, 2010 8:13 PM -
How to get the number of rows in a HTML table in some other page
Hi,
I am incrementing HTML table rows on button click and saving number of rows in a javascript variable. But on submitting that page I need that number of row value in the following page
example:
HTML table is in the page first.jsp
and the javascript variable having the current row number is row_number
on submitting it goes to second.jsp page. There i need that row_number value.
Can anyone help me to solve this?
regards,
carryfunction buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
document.profileform.submit;
on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
Check the value of bold data
function buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
document.profileform.submit;
}try with it -
How to get the primary key names right for child tables?
I have a logical model with a parent table and two child tables. The engineering strategy is "table per child". The parent has an primary key attribute. This is a screen shot:
https://lh5.googleusercontent.com/-iKMtA3Say5c/UIkG1iktgEI/AAAAAAAAAtc/mrwFeHm4gi4/s800/child_pk_log.png
When I engineer the model I get two primary keys with the same name name, which is the name of the parent:
https://lh3.googleusercontent.com/-N88a9VwoPKw/UIkG1spbXpI/AAAAAAAAAtY/eonf8WdUZ6I/s800/child_pk_rel.png
The correct names would be CHILD1_PK and CHILD2_PK. I can change the relational model by applying the naming rules but the next engineering will trash the names again.
How can I fix this?Hi,
the problem with PK name is fixed in Data Modeler 3.2.
You can change PK name in relational model it won't be changed on next engineering
Philip
Maybe you are looking for
-
How to mount iPhone 3gs on a macbook pro with maverick ?
how to mount iPhone 3gs on a macbook pro with maverick ?
-
How to prevent modifying the same sales order in R/3 & CRM at the same time
Guys, We are using CRM 5.0& R/3 4.6C. We have the middle set up. I have noticed that its possible to open the same sales order in R/3 and CRM in the change mode. I believe this could cause inconsistenices if the users modify the same order in differe
-
Status of the sales orders is showing as open even after completed
Dear experts, I would like to know the orders which are still not completed . In Va05 Report i am getting orders which are already completed. But when i check document flow in Va02 It is showing status accounting document not cleared.I am
-
Crm_equi_load badi
Hi everyone, I have to replicate the equipment from ECC to CRM. I am using the badi CRM_EQUI_LOAD. I am able to stamp the object if field to identification by using the fm CRMP_IBASE_COMP_CHANGE. Now I have to replicate the location data (address). I
-
Unique "flash question folder" problem, doesn't boost from either HD/drive
Hello, I am pretending to be a Mac expert to my friends (Please don't laugh at me, Cornelius, Douglas, Duane or others). One of my friends went to me with a iBook G3 with a classic flashing question folder on screen. I promised her I would fix it nex