Deleting rows by key from several tables
Hello!
One of action of my stored procedure is deleting rows from several tables on a key , that I'm getting through statement :
delete from table3 where key_column in ();
delete from table4 where key_column in ();
commit;
select key_column from Table!
minus
select key_column from Table2
Unfortunately the number of lines mentioned by this statement isn't known in advance .
How do You think , is better way to
-- execute select each time for every delete-statement or
-- create table as select result set and then select again keys for each delete- ststement or
I'm usung 11.2.0.3
Thanks and regards,
Pavel
By using : 1.trigger 2. on delete cascade you can achieve this.
OraFAQ Forum: SQL & PL/SQL » delete rows from multiple tables (more than 2 tables)
Regards
Girish Sharma
Similar Messages
-
Adding or Deleting Rows and Columns from Tables
I have notices that you can't delete or add a row or columns from a table in iWeb without having problems.
You may get two added or deleted.
I should indicate that the table comes from Excel.
Does anyone know of a work-around?Problem 1 - The sub-form 'Stds' was not configured for repeating rows.
Problem 2 - The script was on the wrong event. The script should be on the 'change' event and not the 'initialize' event.
Problem 3 - Which header row in which sub-form are you referring too?
Steve -
Delete 50 Million records from a table with 60 Million records
Hi,
I'm using oracle9.2.0.7 on win2k3 32bit.
I need to delete 50M rows from a table that contains 60M records. This db was just passed on to me. I tried to use the delete statement but it takes too long. After reading the articles and forums, the best way to delete that many records from a table is to create a temp table, transfer the data needed to the temp table, drop the big table then rename temp table to big table. But the key here is in creating an exact replica of the big table.I have gotten the create table, indexes and constraints script in the export file from my production DB. But in the forums I read, I noticed that I haven't gotten the create grant script, is there a view I could use to get this? Can dbms.metadata get this?
When I need to create an exact replica of my big table, I only need:
create table, indexes, constraints, and grants script right? Did I miss anything?
I just want to make sure that I haven't left anything out. Kindly help.
Thanks and Best RegardsCan dbms.metadata get this?
Yes, dbms_metadata can get the grants.
YAS@10GR2 > select dbms_metadata.GET_DEPENDENT_DDL('OBJECT_GRANT','TEST') from dual;
DBMS_METADATA.GET_DEPENDENT_DDL('OBJECT_GRANT','TEST')
GRANT SELECT ON "YAS"."TEST" TO "SYS"
When I need to create an exact replica of my big table, I only need:
create table, indexes, constraints, and grants script right? Did I miss anything?
There are triggers, foreign keys referencing this table (which will not permit you to drop the table if you do not take care of them), snapshot logs on the table, snapshots based on the table, etc... -
How to delete the duplicate data from PSA Table
Dear All,
How to delete the duplicate data from PSA Table, I have the purchase cube and I am getting the data from Item data source.
In PSA table, I found the some cancellation records for that particular records quantity would be negative for the same record value would be positive.
Due to this reason the quantity is updated to target but the values would summarized and got the summarized value of all normal and cancellation .
Please let me know the solution how to delete the data while updating to the target.
Thanks
Regards,
SaiHi,
in deleting the records in PSA table difficult and how many you will the delete.
you can achieve the different ways.
1. creating the DSO maintain the some key fields it will overwrite the based on key fields.
2. you can write the ABAP logic deleting the duplicate records at info package level check with the your ABAPer.
3.you can restrict the cancellation records at query level.
Thanks,
Phani. -
Is there a method of deleting the developer key from the user?
Is there a method of deleting the developer key from the user?
Please help me.Hi Matt,
Could you explain from which table should be deleted..?
Thanks.
Regards,
Ramses Hutahaean -
since the last update yesterday to firefox 4.0.1 my program “asus security protect manager” doesn’t work properly. That means, that the saved keys from several websites not remembered for lock in.
Sorry you are having problems. First of all try Fifrefox's safemode.
*[[Troubleshoot Firefox issues using Safe Mode]]
If that works post back for further advice.
Next step, if safe mode did not work.
<u>First: Try a clean install, <sub>(you have had a none standard version installed previously)</sub></u><br /> that involves deleting the program files. Then if necessary try troubleshooting by creating and using a clean empty Firefox profile.
See
* this recent post [/questions/940399#answer-377134]
* http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall
<u>Second: try a New Profile</u>
*http://kb.mozillazine.org/Profile_Manager#Creating_a_new_profile
* this will be an additional profile, it is still worth backing up any existing or currently working profile on a regular basis
**[[Back up and restore information in Firefox profiles]]
* Until you are absolutely confident about the repercussions I suggest
** always use an empty folder when creating a new profile
** never delete or rename profiles, just disable or remove shortcuts
** after creating a new test profile open it and check for any addons or plugins that may be have been included by default -
How to delete some of records from wf_notifications table any API Name?
Hi All,
I want to delete some of records from wf_notifications table , can any one tell API' name and Back end delete process.
Thanks,
Ramu
Edited by: Ramu on Mar 20, 2013 5:42 AMHi ,
I hv done below script, now it's working fine.
DECLARE
CURSOR csr_transaction_id IS
SELECT hat.transaction_id,
hat.item_type,
hat.item_key,
ppx.employee_number,
hat.section_display_name
FROM hr_api_transactions hat, per_people_x ppx
WHERE hat.process_name = 'HR_PERSONAL_INFO_JSP_PRC'
AND hat.selected_person_id = ppx.person_id
AND ppx.employee_number IN
('100024773',
'100024820',
'100024859',
'100024879',
'100024902',
'100024937',
'100025137',
'100026470',
'610014755',
'610017039')
order by ppx.employee_number;
BEGIN
dbms_output.put_line('***Deleted all Transactions and Notifications of below Employee Personals Tranactions ***');
FOR my_cur_v IN csr_transaction_id
LOOP
/*Delete all Transaction_id's in hr_api_transactions,hr_api_transaction_steps,hr_api_transaction_values and hr_api_transaction_steps_bk tables */
hr_transaction_swi.delete_transaction
p_transaction_id =>my_cur_v.transaction_id,
p_validate => hr_api.g_false_num
wf_engine.abortprocess (
itemtype => my_cur_v.item_type,
itemkey => my_cur_v.item_key
/* Deleted all Notification_id's and item_key's in wf_item_activity_statuses,wf_items,wf_item_attribute_values,wf_notifications Table */
wf_purge.items (
itemtype => my_cur_v.item_type,
itemkey => my_cur_v.item_key
dbms_output.put_line('Emp No --'||my_cur_v.employee_number||'Transaction_id :'||my_cur_v.transaction_id||'Emp Personal Info :'||my_cur_v.section_display_name||
'Item Type :'||my_cur_v.item_type|| 'Item Key :'||my_cur_v.item_key);
END LOOP;
commit;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('hr_transaction_swi.delete_transaction api goest to exception block' ||sqlcode|| ' '||sqlerrm);
END;
/thanks,
Ramu -
How to speed up the deletion of 11million records from the table
Hi,
How to speed up the deletion of 11million records from the table.
I need expiditious reply. Please do the needfull in advising
RegardsPlease try to understand the question.Well it would help if you would answer some of the questions you have been asked as your question is not complete and clear and no matter how hard we try, we really need you to try and ask the question properly.
So as previously asked
Which simply supports the idea that we need:
1) better definition of the business purpose (why)
2) oracle version
3) operating system
4) hardware configuration
to give a moderately accurate answer.
I would like to add
5) How many rows in total in the table to begin with.
6) What is your delete statement
7) Is this a one time operation or will it happen regularly
8) Can you use partitioning. -
I want to delete the transactional record from database table
Hai,
I want to delete the transactional data from database table with out using the dialog programming is it there any trancation for this.
for master data we have the transaction code for delete the records. The t.code is 'OBR2'.
Plz help in that cse.
Thanks and regards,
P.Naganjana ReddyHai,
Plz help me urgent.
I am asking i want to delete transactional data from database table without using the dialog programming.
Thanks and Regards,
P.Naganjana -
Count rows from several tables
hello,
im trying to count row from multiple tables
for example i need the select statement to produce the following
table_name count
table1 5
table2 6
table3 3
i came up with the following script but it counts the number of tables i have
select object_name, (select count(*) from user_tables where table_name = object_name) from all_objects
where object_type = 'TABLE'Manik wrote:
May be possible:
Check this:
SELECT table_name,
TO_NUMBER (
EXTRACTVALUE (
xmltype (
DBMS_XMLGEN.getxml ('select count(*) c from ' || table_name)),
'/ROWSET/ROW/C'))
COUNT
FROM (select * from all_tables where table_name in ('TABLE1','TABLE2'))
WHERE owner = 'SCOTT';Cheers,
Manik.Awesome Manik... Just too good. Thanks.
I wish i could have given you the 'Correct' points. ;-)
Can you please explain the logic in brief? Will be helpful for everybody to understand... -
How To delete the Chosen line from the Table Control
Hi Friends,
i am new to Module Pool Programming , i developed a Table Control in input mode and i am getting data also into that table control. my requirement is that i want to delete the current chosen line from that table control. please help me out.HI
GOOD
GO THROUGH THIS REPORT
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
CHANGE THE CODE AS PER THIS LIGIC.
THANKS
MRUTYUN -
Delete rows on basis of other table
I am trying to delete records from table PS_BUN_CM on basis of table PS_BUN_UPDATE ...
below is the select statment which i want to convert to delete ... Please help
select * FROM PS_BUN_CM a
inner join PS_BUN_UPDATE c on a.MAP_ID = c.MAP_ID
where a.ps_map_id in ('2400') and (a.las_name = 'NA' or a.las_name = 'na')and (c.LAS_NAME <> ' ');Not sure, how it is deleting all rows at your end. Please see below test
create table PS_BUN_CM(MAP_ID number,PS_MAP_ID varchar2(10),las_name varchar2(100))
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '10', 'abc')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '100', 'NA')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '100', 'na')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(1000000, '10022', 'na')
Insert into PS_BUN_CM(MAP_ID, PS_MAP_ID, LAS_NAME)
Values(100, '2400', 'na')
COMMIT
SQL> select * from ps_bun_cm;
MAP_ID PS_MAP_ID LAS_NAME
100 10 abc
100 100 NA
100 100 na
1000000 10022 na
100 2400 na
SQL>
create table PS_BUN_UPDATE(MAP_ID number,las_name varchar2(100))
Insert into PS_BUN_UPDATE(MAP_ID, LAS_NAME)
Values(100, 'xyz')
Insert into PS_BUN_UPDATE(MAP_ID, LAS_NAME)
Values(100, ' ')
COMMIT
SQL> select a.*,length(las_name) from ps_bun_update a;
MAP_ID LAS_NAME LENGTH(A.LAS_NAME)
100 xyz 3
100 2
SQL>
SQL>select a.* from PS_BUN_CM a
2 inner join PS_BUN_UPDATE c on a.map_id=c.map_id
3 where a.ps_map_id in('2400') and (a.las_name='NA' or a.las_name='na')
4 and c.las_name=' ';
MAP_ID PS_MAP_ID LAS_NAME
100 2400 na
SQL> select * from ps_bun_cm a
2 where exists(select 1 from ps_bun_update c
3 where a.map_id=c.map_id
4 and a.ps_map_id in('2400')
5 and (a.las_name='NA' or a.las_name='na')
6 and c.las_name=' '
7 ) ;
MAP_ID PS_MAP_ID LAS_NAME
100 2400 na
SQL> ed
Wrote file afiedt.buf
1 delete from ps_bun_cm a
2 where exists(select 1 from ps_bun_update c
3 where a.map_id=c.map_id
4 and a.ps_map_id in('2400')
5 and (a.las_name='NA' or a.las_name='na')
6 and c.las_name=' '
7* )
SQL> /
1 row deleted.
SQL> select * from PS_BUN_CM;
MAP_ID PS_MAP_ID LAS_NAME
100 10 abc
100 100 NA
100 100 na
1000000 10022 na
SQL> -
Remove partition key from partitoned table
can somebody help me with a sql syntax to remove a partition key from a partiton table . The scenario is explained as follows:
create table t1 (c1 number, c2 number ,c3 number)
partition by range (c1, c2)
(partition p1 values less than 11,
partition p1 values less than 21,
partition p1 values less than 31 );
i have data in this table and lot of indexes built, so i cannot drop this table to recreate it.
All i want is to remove c1 from partition key (c1,c2).
I will appreciate if somebody can give me a SQL syntax for this.
Ajay Nerumati.Have you used the debugger and checked that the selectedRowKey is filled?
Can you elaborate what you mean by {qoute} ...does not work ...>
Do you have a reason not to use the current selection listener selectionListener="#{bindings.NotificationOfDifficultiesVO.collectionModel.makeCurrent}" on your table to let the framework do the work for you and then simply call the delete method on the VO?
Timo -
Physical deletion of WBS elements from PRPS table
Hi Experts,
In CJ20N transaction:
When I delete a project with project profile (ZABC), the following actions are performed:
- The project entry are physically deleted from 'PROJ' table.
- The WBS entries are physically deleted from 'PRPS' table.
When I delete another with with project profile (ZXYZ), the following actions are perfomed:
- The project entry are physically deleted from 'PROJ' table.
- The WBS entries are NOT physically deleted from 'PRPS' table.
What is the reason for not deleting entries physically from PRPS table?
Thank you for your valuable answers.Hi Experts,
In CJ20N transaction:
When I delete a project with project profile (ZABC):
- The project record is completely deleted from 'PROJ' table.
- The WBS records are completely deleted from 'PRPS' table.
When I delete another project with different project profile (ZXYZ):
- The project record is completely deleted from 'PROJ' table.
- The WBS records are NOT deleted from 'PRPS' table.
What is the reason for not deleting records from PRPS table for another project (Project profile: ZXYZ)?
Thanks in advance for your valuable answers. -
i have 3 tables in my database..
table1 with one column
table1
table1_id
11
12
13
14
table2 with one column
table2
table2_id
21
22
23
24
table 3 with 2 primary foreign keys from table1 and table2
table3
table1_id table2_id
11 21
11 22
12 23
12 24
13 21
14 22
i want a select statement that selects all from table2 where the specified table1_id is not in the list of the table1_id in table3
for example if i want the list for id 11 it should return (23, 24)
i came up with the following but it didn't work
select table2_id
from tabel3 c, table2 b
where table1_id <> 11 and c.table2_id = b.table2_id
i know my explanation is not that clear..
but any effort will be appreciatedThis should do it. I didn't create the tables, so untested.
SELECT t3.table2_id
FROM table_2 t2
INNER JOIN table3 t3
ON t2.table2_id = t3.table2_id
MINUS
SELECT t3.table2_id
FROM table_1 t1
INNER JOIN table3 t3
ON t1.table1_id = t3.table1_id
Maybe you are looking for
-
Can I load different songs from CD into Ipod Nano?
Paying 99 cents for a song . . in an ipod that can hold 1000 tunes. You'll have a 1000 dollar walkman before you know it SO, I was wondering could I load the existing CDs that I already own in the Ipod Nano library? New mac user, former windows user,
-
I would like to delete an unsent email. the option is the ... box are: Attach, Format, Importance, Add Bcc, Save. There is no "delete". How do I delete the draft?
-
Question on Cimsession code running as Schedule task
#I have a scheduled task running that calls a ps1 file to collect zone data. The task is set to run whether I'm logged in or not. I noticed that if I add -Cimsession to the code, it will only collect the data when I'm logged onto the machine where th
-
Hi: There is an problem with the field mapping from quick address into CRM. Sometimes the house name is mapped onto the second line of the address instead of the first line of the address. Need your immediate inputs. Regards,
-
hello experts, I have design form in screen painter , i done coding for item events , i have used 4 folder tab and with every folder i have given matrix , i have also made User define objects fields and table for document and d