Parent-Child Join on tables in Database Adapter
Hi,
We are doing a join on two tables(T1 and T2) in Database adapter for an Insert operation. There is no Reference Integrity between these two tables in Database, but join is done through bpel database adapter.
Here is a scenario - when we try to insert a record(parent-child), into these two tables, If there is any data issue in any of the child record, Adapter inserts parent-record, also inserts few child-records it processed before it encountered this data issue and terminates.
Issue here is , We want this to be transactional, it means, If any of the child record fails adapter should rollback the entire insert operation both from parent and child tables and exit with an error. Instead BPEL inserting half records into child table.
Is there any parameter I need to set or am I missing anything? Someone please suggest.
Thanks,
Phani
There are a few options I guess.
1. Add the referential key constraint.
2. Add custom logic in your BPEL project to compensate for any errors you encounter in your BPEL processes.
Similar Messages
-
Sub Total value is empty in parent child hierarchy pivot table
Hi All,
I am using obiee 11.1.1.6.2 in Test environment. Is it a known issue/bug for 11.1.1.6.2 to show empty/blank values for sub total when using parent child hierarchy pivot table. The sub total for parent value is showing but sub total for child value is coming blank. However, in 11.1.1.5.0, we do not have any issue with this.
Is it a known bug in obiee 11.1.1.6.2?
Thanks,
SushilYes it is a known bug...
Thanks. -
Options for loading parent-child SQL 2005 tables
I was reading about a few examples of using Table types and a stored procedure to load tables that are joined by a foreign key (parent-child). Seems straight forward enough. However, that requires at least SQL 2008 and the system we are using
is on 2005 still for the time being. As much as I would like to upgrade, there is no time for it, even though we have other 2008 and 2012 instances. So with that said, what are my options for getting data from BTS to SQL where the destination is 2 tables
that have relations.
There are probably a dozen or more, but my first thought is a stored procedure with an xml parameter, then use xquery and xpath statements to pull the data out and insert. TRY/CATCH and RAISEERROR to return error codes back to the BTS application.
Thoughts?First, how many records are you dealing with? I don't even think of terms of 'bulk' until 10,000 or so. And once that threshold is crossed, the first tool out of the box is SSIS.
Second, are you debatching or is there a triple confirmed requirement that all records be loaded in a single transaction?
Finally, the 'DB round-trip' issue is often misunderstood in real world settings. In a typical db transaction, the most expensive operation is establishing the connection. Once that's done, the SQL Client is very efficient in transporting data
to and from the database. Since the wcfSqlBinding uses a Connection Pool, that setup is only done once to some high-water mark.
Consider, the data has to be sent no matter what and in every conseivable scneario*, the byte count of a stored procedure over TDS would be less than sending the same data wrapped in Xml. The network adds considerable latency to the conversation.
This is why I'm skeptical of using OPENXML() without a provable benefit.
So, don't get caught up in theoritical 'performance' issues without understanding the entire scenario first.
*SQL Code being the primary exception. -
Creating View for a table with parent child relation in table
I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
Base Table
PARENT_OBJ
PAREBT_OBJ_TYPE
DESCEN_OBJ
DESCEN_OBJ_TYPE
JOB_A
JOB
WF_1
WORKFLOW
JOB_A
JOB
DF_1
DATAFLOW
WF_1
WORKFLOW
DF_2
DATAFLOW
DF_1
DATAFLOW
ADF_1
ADF
JOB_B
JOB
WF_2
WORKFLOW
JOB_B
JOB
WF_3
WORKFLOW
WF_2
WORKFLOW
DF_3
DATAFLOW
WF_3
WORKFLOW
DF_4
DATAFLOW
DF_4
DATAFLOW
ADF_2
ADF
View
Job_Name
Flow_Name
Flow_Type
Job_A
WF_1
WORKFLOW
Job_A
DF_1
DATAFLOW
Job_A
DF_2
DATAFLOW
Job_A
ADF_1
ADF
Job_B
WF_2
WORKFLOW
Job_B
WF_3
WORKFLOW
Job_B
DF_3
DATAFLOW
Job_B
DF_4
DATAFLOW
Job_B
ADF_2
ADF
I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
Regards,
MeghaI think what you need is recursive CTE
Consider your table below
create table basetable
(PARENT_OBJ varchar(10),
PAREBT_OBJ_TYPE varchar(10),
DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
('JOB_A','JOB','DF_1','DATAFLOW'),
('WF_1','WORKFLOW','DF_2','DATAFLOW'),
('DF_1','DATAFLOW','ADF_1','ADF'),
('JOB_B','JOB','WF_2','WORKFLOW'),
('JOB_B','JOB','WF_3','WORKFLOW'),
('WF_2','WORKFLOW','DF_3','DATAFLOW'),
('WF_3','WORKFLOW','DF_4','DATAFLOW'),
('DF_4','DATAFLOW','ADF_2','ADF')
ie first create a UDF like below to get hierarchy recursively
CREATE FUNCTION GetHierarchy
@Object varchar(10)
RETURNS @RESULTS table
PARENT_OBJ varchar(10),
DESCEN_OBJ varchar(10),
DESCEN_OBJ_TYPE varchar(10)
AS
BEGIN
;With CTE
AS
SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
FROM basetable
WHERE PARENT_OBJ = @Object
UNION ALL
SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
FROM CTE c
JOIN basetable b
ON b.PARENT_OBJ = c.DESCEN_OBJ
INSERT @RESULTS
SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
FROM CTE
OPTION (MAXRECURSION 0)
RETURN
END
Then you can invoke it as below
SELECT * FROM dbo.GetHierarchy('JOB_A')
Now you need to use this for every parent obj (start obj) in view
for that create view as below
CREATE VIEW vw_Table
AS
SELECT f.*
FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
WHERE NOT EXISTS (SELECT 1
FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
)b
CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
GO
This will make sure it will give full hieraracy for each start object
Now just call view as below and see the output
SELECT * FROM vw_table
Output
PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
JOB_A WF_1 WORKFLOW
JOB_A DF_1 DATAFLOW
JOB_A ADF_1 ADF
JOB_A DF_2 DATAFLOW
JOB_B WF_2 WORKFLOW
JOB_B WF_3 WORKFLOW
JOB_B DF_4 DATAFLOW
JOB_B ADF_2 ADF
JOB_B DF_3 DATAFLOW
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to filter parent & child rows from tables while export usingData export
Hi,
I have a requirement of export schema. Assume there is a account details table and account transactions table under schema.They have parent child relation exist. if i filter accounts from account details the corresponding transactions in account transactions table should be filterd.How to achieve this?
Regards,
Venkat Vadlamudi
Mobile:9850499800Not sure if this is a SQL and PL/SQL question or whether it's an Oracle Apps type question or a Database General.
Whatever, you've posted in the wrong forum (http://forums.oracle.com/forums/ann.jspa?annID=599)
You should post in a more appropriate forum e.g.
PL/SQL
General Database Discussions
etc.
locking this thread -
Polling table with Database Adapter
Hi All,
I have created a Database Adapter to poll the table for the new record or modified.
I have added a receive activity to that Adapter and deployed.
However the instance is not completing and its in always running state and waiting at receive activity.
Can you please help me out
Thankshello,
i have to do database polling..this is wat i have done.but instance is not getting created in BPEL..
i have created a sequence in databse.
i have created a source table in database which has three colums id,name,sequence.(generated by doin seq.nextval)
i have created a table as seqhelper table which has two fields table_name and seqid.
now i hav dragged a db adapter.I hav chosen poll,update seq table..and given my seq table name,seqname filed as table_name,seqvalue field as seqid.and sequence fiels ad sequence column of source table ...and done polling frequency as 5 seconds.
now created a bpel process,chosen interface as based on wsdl and selected db adapters wsdl file and linked to bpel after removing the default exposed service of bpel..so bpel as one receive activity joined to db adapter...
WHEN<
i am inserting any new records to source table....instance is not getting created...please help.. -
Oracle SOA Suite 10.1.3.4 Polling database table with Database Adapter
We are trying to use the database adapter to poll for new and changed data in a database. To do that we try to use a sequencing table on an external database. But for that we need to specify the data-source name for the external sequencing table. Where do we need to define this data-source? We have tried with data-source defined in the Enterprise Manager, but it's not right. Also tried with the name of database connection in JDeveloper, still not working.
Any ideas?Hi,
If you are trying to understand how to create a connection pool for a data source, then this document might be helpful
http://blogs.oracle.com/fusionmiddlewarereallife/soa_11g_bpel_composite_and_database_adapter.html -
Joining Two Tables by Database View
HI There,
I'm trying to join two tables BNKA and LFBK to get the Bank details according to the requirement.
Now, I wanted to go head and create a Generic datasource and bring the fields from these two tables by Vew.
Can someone please explain me step by step to create the database view?
One more thing, do we need to have anything in common between two tables BNKA and LFBK ?
I really appreciate if someone can guide me through step by step method to create Database Table view?
Thanks
MadhuriHi Madhuri,
With out having common fields, we can not create data base view based on two tables.
1) goto SE11
2) select data base view and give the name and create.
3) in left side give the tables names
4) In left side define the relation
check the below article
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10a89c00-7dd7-2d10-6f83-cd24ee6d517c?QuickLink=index&overridelayout=true
Regards,
Venkatesh -
Multiple messages enqueuing into one table using Database Adapter
Hi All,
I am trying to fetch records from one table and insert into another table in the same database using two DB adapters each for one function.When trying for one record,it is working fine.But for more than one records using for-each loop I am unable to insert the records into the table.Can anyone suggest any solution.
For DB Adapter 1 and 2 I am selecting "Perform an operation on a Table".
Options being selected in case of both adapters:-
DB Adapter1-'select' and DB Adapter2- 'Insert'
Regards,
Niva DasDo not know the exact implementation how you have done but this is what you can do to narrow down the issue.
you can check out the instance to know whether you are able to fetch multiple records from the first table.
If that works fine then you can check the transformation whether the data is getting transformed in to correct format.
If that too works fine check out whether the invocation to second db adapter is fine or not. -
Parent Child In Same Table Management
I have a simple entity (Process) which has ID and Name.
It also has Parent property which reference the parent Process of this one.
When the user ask to delete a process, I have to disconnect its children from it, otherwise I'll have a reference integrity violation, and the logic of the application permit to delete a process in the middle of hierarchy.
The question is where is it best to put the code that will handle it?
In a session bean managing the processes, the bad thing is that there are other places that delete processes. so the logic will be have to be duplicated.
Maybe in an entity listener, the problem is how to get hold of an EntityManager there to update the child processes when a parent process is deleted?
Thank you,
Ido.Hi,
In a CONNECT BY query, related rows will always come together. That is, if row r p has children, then the row immediately after p will be one of p's children, and all of the descendants of p will come before any row that is not a descendant of p.
An ORDER BY clause will cancel the above, but an ORDER SIBLINGS BY clause will keep to the rules above.
For example:
SELECT *
FROM t1
START WITH col1 NOT IN ( SELECT col2
FROM t1
WHERE col2 IS NOT NULL
CONNECT BY col1 = PRIOR col2
ORDER SIBLINGS BY id -- Optional
;It just so happens that the rows appear in order by id. It might have been better if you had chosen ids that did not show the correct order.
The tricky part of the CONNECT BY query above is choosing the START WITH set. There's noting in each row by itself that tells if a row is a root; you have to do a sub-query to find all the children, and START WITH a row if it is not on that list. -
Database adapter :: Creating table relationship
Hi,
I have created a db adapter to read from database tables using pk-fk 1:M relationship.
DB design is already done and relationships are defined at db level. Do we still need to create 1:M relationship in adapter as well ? Please let me know.
I guess it will be an overhead if we should create all 1:M relationship once again.
Regards,
APHello,
In same way i am using two parent-child(header-line) tables. they have one to many relationship.
I want to generate XML which contains multiple line items under a child elements for header elements.
I have tried it but i am getting only one line under that child item. i am using jdev10.0.3.3.0
can u help me please.
-regards
satyendra -
SHOW THE PARENT CHILD TABLE RELATIONSHIP TABLE
hi experts,
I want show the parent child relation ship tables
for exmple iam passing the emp table then display related child tables like dept,grade after that again child table(dept,grade) related to child relationship tables like recursive
Regards,
VENKATProbably something like below. This may not be exactly what you are looking for, but one way to get what you are asking for.
Only if you can give specifics, of your Input being passed and the Output, it might be possible to provide more help. But you also need to help us with your best effort on this.
select *
from (
select prior table_name Child, table_name Parent
from user_constraints
start with constraint_name = some_constraint_name_of_Parent_Table
connect by constraint_name = prior r_constraint_name
) a
where a.child is not null; -
Parent child tables - how to maintain RI
Here is my scenario:
In our model, we have parent child relationship between tables.
We are not sure how the parent tables are populated. If incremental update, it should be fine (assuming if needed rows will be inserted in the child table manually). If the tables are truncated and data is inserted again – that might be a problem since there exist relationship with child tables. What are the various options for handling such cases?
Option1: cascade delete
Option 2: ...?I'm not sure I understand the goal here...
- Are you trying to design a data model? If so, wouldn't the business and data requirements tell you whether you need to truncate and reload the parent table or whether you can do an incremental load? It wouldn't seem to make sense to design a data model with no understanding of how the model is going to be used.
- Are you trying to design a load process that works with an existing data model? If so, are you trying to design an incremental load? Or a load that involves a truncate and reload? Does the existing data model have foreign key constraints?
Specifying the Oracle version and a bit of information about the application (i.e. is this an OLTP application, a data warehouse, something else) would probably also be helpful.
Justin -
Database adapter not importing table having data type as WF_EVENT_T
Hi All,
I have a requirement to import a table in the Database adapter. That table is having a column of data type “WF_EVENT_T”.
When I tried to import the table in database adapter I got the error as "The following tables are not supported in the Database Adapter and were not imported".
Then I modified the table by adding one more column with some other data type and tried to import that table.
It got imported successfully but I was not able to see the column with data type WF_EVENT_T in the table.
Any pointers to this would be of great help.
Thanks.Hi Harish
Thanks for your response.
I can create the table with the data type 'String'. However, the problem is when I try to update the table from a program in SE38 or a Function Module in SE37.
When I try to activate the PROGRAM or FUCNTION, I GET A MESSAGE THAT I MENTIONED EARLIER.
Here is the simple program that I have created that I am not able to activate
==========================================
REPORT ZTEST_STRING1.
tables: ztest.
ztest-zid = 2.
ztest-zstring1 = 'ABC'.
insert ztest.
===========================================
ztest has two fields
zid which is NUMC type
and zstring1 which is STRING type.
When I try to activate I get an error message as follows:
'ztest' must be a flat structure. You cannot use internal tables,
strings, references, or structures as components.
Edited by: Ram Prasad on Mar 20, 2008 6:08 PM -
Database adapter not returning all the records
I've taken over a BPEL from a developer who left the organization and have been having an issue during our User Acceptance Testing. We are querying a table that will return the insurance enrollment information for employee's and their dependants. When an employee change plans, or adds people, the old plan is terminated and a new once is created. When this happens there will be two records on the database to show the old plan and the new plan.
When we run the SQL thru JDEV or SQLDeveloper, the data comes out fine. When we run it through a BPEL Database Adapter we are only getting one of the rows returned.
I have created a small tester BPEL that is easily modified and deployed to run the same query to try multiple configurations changes within the DBAdapter. What I have found is all the records are returned when the "Return single result set" box on the DBAdapter Wizard is unchecked. When it's checked then it only returns one record for the employees with an old and a new plan.
Can someone explain what the "Return single result set" option does, and what the impact will be if it's unchecked?Hello,
In same way i am using two parent-child(header-line) tables. they have one to many relationship.
I want to generate XML which contains multiple line items under a child elements for header elements.
I have tried it but i am getting only one line under that child item. i am using jdev10.0.3.3.0
can u help me please.
-regards
satyendra
Maybe you are looking for
-
Having trouble saving my .psd images in PSE11
Often, but not always, when I try to resave my image after editing it, I get an error message saying it can't be saved because it is already in use or open in another application (which is not the case.) Sometimes if I close the Organizer, or if I em
-
Copying files via File Sharing, files get locked
Hey, Folks! I've just begun sharing files from my Mac Pro with my wife's laptop. I have no problems dragging-and-dropping files from one computer to another, but the copied folders are locked, meaning, for example, if I put a video file into iTunes,
-
Hey all: In the past week, I've been seeing a variety of my projects encounter problems with people using IE7 on XP. When they go to the page, it says there's no Flash Player installed and gives them the alternate HTML. If they click thru to install
-
Getting random friend requests on BBM
I have gotten about 30 friend requests from people i don't know on BBM. Any way I can change my PIN? Any help would be great!
-
Variable export results based on machine
I have a very bizarre situation. I have two iMacs, both running the exact same version of FCP X and Compressor 4 (I did a clean install to make sure... including cleaning out preference files, etc...), using the exact same settings. When I export vid