ADF delete from more than one table with single delete operation
Hi all,
I have a scenario in which I am trying to delete record(s) from 3 tables.
My jspx page looks like this:
Column1:drop down from 1st table
Column2:drop down from 2nd table
Column3:drop down from 3rd table
Delete Commit
I have created a view object which has these three tables as entities. I drag dropped the view object and displayed these three columns.
Now when i select any one or all three or any two out of these and click delete, only the "column 1" gets deleted from 1st table. The remaining two tables remain unaffected.
Y is this so?
Can't I use one delete operation for all three tables' DML operation in single go?
Thanks.
If you have a business case that requires deleting from 3 tables at once when removing a single row in a view object then you may look for the problem in you data model...
Until then I'd suggest to create a database view providing the information you need (plus the PKs fron the individual tables) and creating entity and view objects based on this view. An "instead of dele" trigger attached to the view can do the actual delete operation on the 3 tables.
bye
TPD
Similar Messages
-
JDBC-XI-FILE scenario. How to extract data from more than one table in JDBC
Hi,
I was asked a question like in JDBC-XI-FILE scenario........ How to extract data from more than one tables (i.e from JDBC system) ?? What is the logic to do the same ??
I am not sure whether this is a valid question..........but any help in this regards is highly appreciated.
Regards
KumarHI,
Yes it can be possible ,please see the following links
JDBC Receiver with Oracle Stored Procedures
configuring jdbc adapter with multiple tables
RFC -> XI -> JDBC Scenario Updating Multiple Tables
/people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
JDBC Adapter multiple Selects
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=jdbc%20with%20multiple%20tables&cat=sdn_all
Regards
Chilla.. -
Delete From More than 1 table without using execute immediate
Hi,
Am new to PL/SQL, I had been asked to delete few of the table for my ETL jobs in Oracle 10G R2. I have to delete(truncate) few tables and the table names are in another table with a flag to delete it or not. So, when ever I run the job it should check for the flag and for those flag which is 'Y' then for all those tables should be deleted without using the Execute Immediate, because I dont have privilages to use "Execute Immediate" statement.
Can anyone help me in how to do this.
Regards
SenthilThen tell you DBA's, or better yet their boss, that they need some additional training in how Oracle actually works.
Yes, dynamic sql can be a bad thing when it is used to generate hundreds of identical queries that differ ony in the literals used in predicates, but for something like a set of delte table statements or truncate table statements, dynamic sql is no different in terms of the effect on the shared pool that hard coding the sql statements.
This is a bad use of dynamic sql, because it generates a lot of nearly identical statements due to the lack of bind variables. It is the type of thing your DBA's should, correctly, bring out the lead pipe for.
DECLARE
l_sql VARCHAR2(4000);
BEGIN
FOR r in (SELECT account_no FROM accounts_to_delete) LOOP
l_sql := 'DELETE FROM accounts WHERE account_no = '||r.account_no;
EXECUTE IMMEDIATE l_sql;
END LOOP;
END;This will result in one sql statement in the shared pool for every row in accounts_to_delete. Although there is much else wrong with this example, from the bind variable perspective it should be re-written to use bind variables like:
DECLARE
l_sql VARCHAR2(4000);
l_acct NUMBER;
BEGIN
FOR r in (SELECT account_no FROM accounts_to_delete) LOOP
l_sql := 'DELETE FROM accounts WHERE account_no = :b1';
EXECUTE IMMEDIATE l_sql USING l_acct;
END LOOP;
END;However, since you cannot bind object names into sql statements, the difference in terms of the number of statements that end up in the shared pool between this:
DECLARE
l_sql VARCHAR2(4000);
BEGIN
FOR r in (SELECT table_name, delete_tab, trunc_tab
FROM tables_to_delete) LOOP
IF r.delete_tab = 'Y' THEN
l_sql := 'DELETE FROM '||r.table_name;
ELSIF r.trunc_tab = 'Y' THEN
l_sql := 'TRUNCATE TABLE '||r.table_name;
ELSE
l_sql := NULL;
END IF;
EXECUTE IMMEDIATE l_sql;
END LOOP;
END;and something like this:
BEGIN
DELETE FROM tab1;
DELETE FROM tab2;
EXECUTE IMMEDIATE 'TRUNCTE TABLE tab3';
END;or this as a sql script
DELETE FROM tab1;
DELETE FROM tab2;
TRUNCTE TABLE tab3;is absolutley nothing.
Note that if you are truncating some of the tables, and wnat/need to use a stored procedure, you are going to have to use dynamic sql for the truncates anyway since trncate is ddl, and you cannot do ddl in pl/sql wiothout using dynamic sql.
John -
Retriving data from more than one table
I have 6 tables with name A,B,C,D,E,F all of them have 1 column as common. I need help in developing a sql query which will give me name of table where record is present and number of its occurrences.
926085 wrote:
I have 6 tables with name A,B,C,D,E,F all of them have 1 column as common. I need help in developing a sql query which will give me name of table where record is present and number of its occurrences.You can check the table_name where column value is present by
select table_name, AVG_COL_LEN from user_tab_columns where column_name='ID' and AVG_COL_LEN != 0;You'll get the results if you have all these table analyzed -
Looking data from more than one table and inserting into another.
Hello,
I am giving you the Table structures as per my requirement..
CREATE TABLE TEMP_A
(NAME VARCHAR2(100) primary key);
CREATE TABLE TEMP_B
(STRUCTURE VARCHAR2(10));
CREATE TABLE TEMP_C
( NAME VARCHAR2(100),
STRUCTURE VARCHAR2(10),
VALUE VARCHAR2(10));
Alter table TEMP_C
add constraint fk_name_tempc foreign key(name) references TEMP_A(name)
INSERT INTO TEMP_A VALUES('SMITH');
INSERT INTO TEMP_A VALUES('ALLEN');
INSERT INTO TEMP_A VALUES('WARD');
INSERT INTO TEMP_A VALUES('JONES');
COMMIT;
INSERT INTO TEMP_B VALUES('IN');
INSERT INTO TEMP_B VALUES('IN_MIN');
INSERT INTO TEMP_B VALUES('IN_TYP');
INSERT INTO TEMP_B VALUES('IN_MAX');
INSERT INTO TEMP_B VALUES('DIP');
INSERT INTO TEMP_B VALUES('TIM');
COMMIT;
INSERT INTO TEMP_c VALUES('SMITH','C1','');
INSERT INTO TEMP_c VALUES('SMITH','C2','');
INSERT INTO TEMP_c VALUES('SMITH','D1','');
INSERT INTO TEMP_c VALUES('ALLEN','D2','');
INSERT INTO TEMP_c VALUES('ALLEN','R1','');
INSERT INTO TEMP_c VALUES('WARD','R2','');
COMMIT;
i want to say is it should insert into table 'TEMP_C' values as :
For 'SMITH' there should be (6 * 3) = 18 records.
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C1')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C2')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'D1')
For 'ALLEN' there should be (6 * 2) = 12 records.
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'D2')
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'R1')
For 'WARD' there should be (6 * 1) = 6 records.
( 6 distinct values of TEMP_B for WARD to be inserted into TEMP_C against 'R2')
Like this if there are records for JONES also , it should also do the same way( Depending on the No. of records present
in the table 'TEMP_C' for 'JONES').
Thanks in advance,
AmkotzIs this what you are looking for?
SQL> insert into temp_c (name, structure, value)
2 select c.name, c.structure, b.structure
3 from temp_a a, temp_c c, temp_b b
4 where a.name = c.name
5 ;
36 rows created.
SQL> select * from temp_c;
NAME STRUCTURE VALUE
SMITH C1
SMITH C2
SMITH D1
ALLEN D2
ALLEN R1
WARD R2
SMITH C1 IN
SMITH C1 IN_MIN
SMITH C1 IN_TYP
SMITH C1 IN_MAX
SMITH C1 DIP
SMITH C1 TIM
SMITH C2 IN
SMITH C2 IN_MIN
SMITH C2 IN_TYP
SMITH C2 IN_MAX
SMITH C2 DIP
SMITH C2 TIM
SMITH D1 IN
SMITH D1 IN_MIN
SMITH D1 IN_TYP
SMITH D1 IN_MAX
SMITH D1 DIP
SMITH D1 TIM
ALLEN D2 IN
ALLEN D2 IN_MIN
ALLEN D2 IN_TYP
ALLEN D2 IN_MAX
ALLEN D2 DIP
ALLEN D2 TIM
ALLEN R1 IN
ALLEN R1 IN_MIN
ALLEN R1 IN_TYP
ALLEN R1 IN_MAX
ALLEN R1 DIP
ALLEN R1 TIM
WARD R2 IN
WARD R2 IN_MIN
WARD R2 IN_TYP
WARD R2 IN_MAX
WARD R2 DIP
WARD R2 TIM
42 rows selected.
SQL> -
Creating data source in R/3 system from more than one table.
Hi All,
Currently I have a requirement where I need to bring data in BW from 5 different table in the CM (our R/3 system) system.
How do I achieve this?
If I create a generic datasource, how can I map 5 tables in a single datasource?
Please detail the process to achieve this.
Regards,
Kironmoy BanerjeeHi ,
We can create the DS based on No.Of tables.
But need to check the below points.
1. Is there any relation ship between the tables (Means common Key).
- If the above condition is Ok then directly you can use view.
2. If there is no relation you have to FM.
- Please check the below link (Pdf Document) for how to to create FM in Generic :
http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417100)ID0102005850DB00995891084283618218End?rid=/library/uuid/c062a3a8-f44c-2c10-ccb8-9b88fbdcb008&overridelayout=true
Regards
Ram. -
Fill more than one DataTable with single DataSet
Hello,
I would like to make a single trip to Oracle (using ODT.NET) to fill two DataTables in a single DataSet. How do I specify the Oracle Select command? I tried with a plus:
select * from customers + select * from products
I tried with/out quotes and with/out semicolon at end of each select. The error is SQL command not ended properly
Thanks,
KimI don't think you can do this, at least I've never done this before.
-
Crystal Report - More than one table from MySql
Hello, I am in need of help big time.
I have am using Visual Studio 2010 and Crystal Report 10.
The problem that I am incounting is that I am unable to retreive data from more than one table from a MySql database. I have been stuck on this for too long and need to hjump the hurdle.
I am using a MySql connection string, a dataset and a crystal report which is based on the dataset.
The main error that I am having is, the browser opens and a form appears saying "The report you requetsed requires further information" With the Server name: DataSetPropertiesDetials, while the User name and Password fields are then enabled.
I am guessing I am missing something in my code.
When I retreive data from one table the report is fine, but when I try to use more than one table it throws the error.
My Code is below and also attached:
Imports System.Data.SqlClient
Imports System.Configuration
Imports MySql.Data.MySqlClient
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Web
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As MySqlConnection
Dim rpt As New CrystalReport3()
Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim cmd As New MySqlCommand
Dim cmdUser, cmdProperty, cmdBranch As New MySqlCommand
Dim daBranch, daProperty, daUser As New MySqlDataAdapter
con = New MySqlConnection()
'Connection String
con.ConnectionString = "Server=****;Database=***;UID=***;Password=****"
Try
con.Open()
cmdBranch.CommandText = "SELECT branch FROM tblbranch"
cmdBranch.Connection = con
daBranch.SelectCommand = cmdBranch
daBranch.Fill(myData)
cmdProperty.CommandText = "SELECT ref, keys_held, key_no, keys_out, no_name, address_line1, address_line2,key_label FROM tblproperty"
cmdProperty.Connection = con
daProperty.SelectCommand = cmdProperty
daProperty.Fill(myData)
cmdUser.CommandText = "SELECT known_name FROM tbluser"
cmdUser.Connection = con
daUser.SelectCommand = cmdUser
daUser.Fill(myData)
myReport.Load("REPORT LOCATION")
myReport.SetDataSource(myData)
myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
CrystalReportViewer1.ReportSource = myReport '
Catch myerror As MySqlException
MsgBox(myerror.Message)
End Try
End Sub
End ClassHi,
You have 3 SQL commands but you are calling SetDataSource only once. You need to look through for each of the SQL Commands.
Good luck,
Brian -
Simple journalization with more than one table
Hello,
I wanted to journalize more than one table with a simpe journalization?
is it possible?
I confgured my OdiWaitForLogData like that:
OdiWaitForLogData "-CONTEXT=GLOBAL" "-GLOBAL_ROWCOUNT=2" "-LSCHEMA=employe" "-OPTIMIZED_WAIT=AUTO" "-POLLINT=2000" "-SUBSCRIBER_NAME=SUNOPSIS" "-TIMEOUT=0" "-TIMEOUT_WITH_ROWS_OK=YES" "-UNIT_ROWCOUNT=1" "-TABLE_NAME=Departement,Employe"
when I executed my interface, my interface is still at the step running.
what happened please?
Thanks
BillyroseHello,
I wanted to journalize more than one table with a simpe journalization?
is it possible?
I confgured my OdiWaitForLogData like that:
OdiWaitForLogData "-CONTEXT=GLOBAL" "-GLOBAL_ROWCOUNT=2" "-LSCHEMA=employe" "-OPTIMIZED_WAIT=AUTO" "-POLLINT=2000" "-SUBSCRIBER_NAME=SUNOPSIS" "-TIMEOUT=0" "-TIMEOUT_WITH_ROWS_OK=YES" "-UNIT_ROWCOUNT=1" "-TABLE_NAME=Departement,Employe"
when I executed my interface, my interface is still at the step running.
what happened please?
Thanks
Billyrose -
Developing forms based on more than one table
I need to develop a form which requires to insert and query data elements from
more than one table in the database. Can create a view and develop a form based on the view to achieve this functionality? Also is it better to use portal forms for this purpose or Forms developer 6i for this purpose?
Any inputs/ideas will be greatly appreciated.
Thanks,
SuzanneYes you can do more than one table per form in portal.
You can base a form on two tables in portal if they are designed as master/detail tables. You can also provide linking to other forms passing parameters from a one form to the next to work with multiple tables. Combining more than two tables into a form using portal would require using a view, I believe.
HTH -
How to delete the double records connected to one or more than one tables in SQL 2008?
Hi
Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
ThanksYou should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
those duplicate rows i.e the main or the primary personno.
SELECT * FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
UPDATE OtherTable SET personno = b.primaryid
FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
NOTE: Please take backup before applying the query. This is not tested.
Regards, RSingh -
Tables with more than one cell with a high number of rowspan (ej. 619). This cell can not be print in a page and it must be cut. But I don’t know how indesign can do this action.
set the wake-on lan on the main computer
The laptop's too far away from the router to be connected by ethernet. It's all wifi.
No separate server app on the laptop, it's all samba
The files are on a windows laptop and a hard drive hooked up to the windows laptop. The windows share server is pants, so I'd need some sort of third party server running. Maybe you weren't suggesting to use Samba to connect to the windows share though?
I'm glad that you've all understood my ramblings and taken and interest, thanks The way I see it, I can't be the only netbook user these days looking for this kind of convenience, and I certainly won't be once chrome and moblin hit the market.
Last edited by saft (2010-03-18 20:38:08) -
Can I have in one iphone 5 music from more than one itunes accounts? My daughter and I have our music in the same pc. She and I have iTunes accounts. I have not been able to load in my ophone with my itunes acct music that she purchased in her account. I have not been able to do this. Thanks
iTunes Match is not sharable across Apple IDs. The best way to get the music on her iPad is to leave hers signed into her Apple ID on the iTunes Store and sync via USB.
-
How to delete contents from more than 1 table
How to delete the entire contents from more than 1 table in a single query.
It is very urgent,
Thanks in advance
JohnGoto SE11 ->Open table ->Utility ->data base utility ->delete database table.
BTW, Do not do it.
Thanks,
Ashish -
How do u save datas more than one table using net beans ide using JSF
Hi,
I am new to JSF.
I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
and also Tell me the reference book for JSF.
Thanks in advance.
regards,
N.P.SivaSivaNellai wrote:
I am new to JSF.
So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra.
Maybe you are looking for
-
Search engine doesn't find vcards
The search engine in Address book doesn't find cards that exist in my ALL. They were cards imported via Time Machine. Any way I can get AB to index it's content ?
-
Xorg 6.8.2 is out
http://www.x.org/XOrg_Press_Releases/X11R6.8.2.html
-
Buying a PS 7.0 Upgrade on eBay ( Registering question ) !!!
Okay I'm about to purchase a copy of Photoshop 7.0 Upgrade on eBay the seller stated the copies are legit ( Whos going to bootleg a 8 years old software ? ) He's not sure if they were registered or not.Personally I never registered anything so far an
-
How to restore cancelled Item with DI API
Hello, how can I restore a cancelled Item with DI API ? Regards, Jan
-
I have been trying to work this out an I am sure is is not too difficult to do, but I cant seem to get anywhere with it. If anyone could help that would be great. Thanks RossH