Expansion of Child table rows under each master table rows
Hi,
I am using JDeveloper 11.1.1.5 version for developing ADF application.
I need to display a master table rows and its child table rows such that
When I expand master table row, I need to display child rows under the master row which is I expanded.
Like this each master table row should expand its child rows between the next master table row (like ShowDetail or detailStamp)
So kindly suggest ideas on what can be used to bring out this requirement on page.
If any links available for reference or guidance , kindly mention it and help me out.
Thanks,
Vino
You can use a tree table for this. A sample you can find at http://andrejusb.blogspot.ch/2009/11/tree-table-component-in-oracle-adf.html
or http://dstas.blogspot.ch/2011/11/master-detail-detail-using-tree-table.html
Timo
Similar Messages
-
How to refresh a child table each time I select a row in the master table
I've 2 tables, a master table and a child table.
When i click on each row of the master table, the child table needs to be refreshed.
I've given the id of table1(master) as the CreatePartialTrigger value in table2(child).
The refresh does happen but it happens in an inconsistent manner.
For eg. in my scenario,
1.I add a row to the master table
2.Click on the create button of the child table, this opens a popup and i enter a few values and the child row gets added.
3.Now when i toggle between the rows in my master table, the refresh does not happen and I see duplicate rows in the child table but in the datebase only one record gets stamped..
Is there any clean way to refresh the child table based on the row selection in the master table.
Kindly let me know.
Table1
<fnd:applicationsTable tableId="table">
<af:table value="#{bindings.Actions1.collectionModel}" var="row"
rows="#{bindings.Actions1.rangeSize}"
fetchSize="#{bindings.Actions1.rangeSize}"
selectedRowKeys="#{bindings.Actions1.collectionModel.selectedRow}"
selectionListener="#{bindings.Actions1.collectionModel.makeCurrent}"
rowSelection="single" id="table1"
contentDelivery="immediate" editingMode="clickToEdit"
columnSelection="multiple" autoHeightRows="10"
summary="#{HcmActionsTopGenBundle['Header.Action.ActionCode']}" rowBandingInterval="0"
styleClass="AFStretchWidth"
partialTriggers="::create ::createMenuItem">
<af:column id="column1" headerText=" " width="5"
rowHeader="true"/>
<af:column sortProperty="ActionCode" sortable="true"
headerText="#{bindings.Actions1.hints.ActionCode.label}" width="150"
showRequired="true" rendered="true" id="c1">
<af:inputText value="#{row.bindings.ActionCode.inputValue}"
label="#{bindings.Actions1.hints.ActionCode.label}"
required="#{bindings.Actions1.hints.ActionCode.mandatory}"
columns="#{bindings.Actions1.hints.ActionCode.displayWidth}"
maximumLength="#{bindings.Actions1.hints.ActionCode.precision}"
shortDesc="#{bindings.Actions1.hints.ActionCode.tooltip}" id="it1"
autoSubmit="true"
/>
</af:column>
</fnd:applicationsTable>
Table 2
<fnd:applicationsTable tableId="table2"
styleClass="AFStretchWidth"
id="AT2"
actionsMenuRendered="false"
secondaryToolbarRendered="false"
createPatternType="secondaryWindow"
createText="#{hcmActionsBundle['Action.Add']}"
createAction="#{backingBeanScope.SetupUiBean.invokeCreatePopUp}"
createPopupId="create1"
editEnabled="false"
createPartialTriggers="table1"Hi Frank,
As you mentioned I already have the id of my master table which is 'table1' as the createPartialTrigger in my child table.
In my case there are 2 scenarios.
I add a row to the Master table and when I click on the create button on the chile table, I get a pop with 'Yes' , 'No' and 'Cancel'
Scenario1
If I click 'Yes' , then I get another popup where I enter the values for the ActionReasonsActionReasonUsagesVO which is a combination of the ActionReasonsEO and the ActionReasonUsagesEO, now when I click on OK, a new row gets created in the ActionReasonsActionReasonUsagesVO.
In the above scenario things work fine, as I toggle between the rows in the Master table the child table gets refreshed.
Scenario2
If I click 'No' I get a search popup where I can query up the ActionReasonsVO and select existing data,on clicking OK, the values get mapped from the ActionReasonsVO to the ActionReasonsActionReasonUsagesVO.
Now when I toggle between the rows in my master table, I observe 2 types of behaviors
1.Due to incorrect refresh, the child table rows vanishes from the UI.
2.There are duplicate rows in the child table.
The issue is specific to this scenario where the refresh of the child table rows does not happen correctly.
Edited by: 944295 on Apr 18, 2013 5:16 PM -
Master Child tables how to get the latest rows from both
Hi,
Need some help with the sql. I have two tables Master & Child. In my Master table I have multiple rows for the same record and in the child table also multiple rows for the same master row how can I get the latest one's from both.
For example Data in my Master table looks like
CONT_ID SEQ_NUM DESCRIPTION
1 189 Update 2
1 188 Update 1
1 187 NewNow in the child table for the same CONT_ID I may have the following rows
CONT_ID UPDATED_DATE STATUS
1 3/16/2010 2:19:01.552700 PM P
1 3/16/2010 12:29:01.552700 PM A
1 3/16/2010 12:29:01.552700 PM P
1 3/16/2010 12:19:01.552700 PM NIn my final query how can I get the row with seq_num 189 as it's the latest in Master table and from child table the row with status of P as it's the latest one based on the time. Here is the query i have but it returns the latest row from the child table only and basically repeats the master table rows as opposed to one row that is latest from both:
ThanksHi,
You can use the analytic ROW_NUMKBER function to find the latest row for each cont_id in each table:
WITH got_m_rnum AS
SELECT cont_id, seq_num, description
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY seq_num DESC
) AS m_rnum
FROM master_table
-- WHERE ... -- any filtering goes here
, got_c_rnum AS
SELECT cont_id, updated_date, status
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY updated_date DESC
) AS c_rnum
FROM child_table
-- WHERE ... -- any filtering goes here
SELECT m.cont_id, m.seq_num, m.description
, c.updated_date, c.status
FROM got_m_rnum m
JOIN got_c_rnum c ON m.cont_id = c.cont_id
AND m.m_rnum = c.c_rnum
AND m.m_rnum = 1
;If you'd like to post CREATE TABLE and INSERT statements for the sample data, then I could test this.
If there happens to be a tie for the latest row (say, there are only two rows in the child_table with a certain cont_id, and both have exactly the same updated_date), then this query will arbitrarily choose one of them as the latest. -
Hi,
I am using JDeveloper 11.1.1.4 version.
In my page I have master child relation to be displayed.
I am displaying this by following the standard adf-bc master child example.
i.e add the id of the master child as partialTrigger to the child table.
But my requirement is that, multiple row selection is enabled for the master table and when multiple rows are selected in master table,
child table should not display any records.
How can I achieve this??
Also,I have a details panel displayed right under master table which displays selected row values in a form.
Here also,when multiple rows are selected,I should not display any values in the details panel.
Please advice on how to achieve this.
Thanks,
PraveenHi,
have a selection listener set on tabe to bean method and in bean getAllSelectedRowKeys from table. If you get more than or equal 2 entries hide the detail panel or write code so that u reresh ur detail vo to contain no rows -
Problem with Master and Child table
Hi,
Working in jdev 11.1.1.2.0. I have one strange issue. i have master and child tables, the model is working fine with the view link. but when drag drop the same into my jsff. when i query the result 1st time 2 tables are refershing properly and data is coming. but the when i trying to select another row in the 1st table my 2nd table(child table) is not refreshing.
i put partial trigger of the 2nd table as 1st table id.
can any one help wht is issue here.
Edited by: user5802014 on Jul 15, 2010 3:44 PMCheck this post might help you
http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html -
I have a master table and i need to import the rows into the parent and child table.
Master table name is Flatfile_Inventory
Parent Table name is INVENTORY
Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
Error details will be goes to LOG_INVENTORY_ERROR
I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
Again when i run the query using stored procedure,
its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
Please help me to write the query i have attached the Full stored procedure Script..
Arunraj KumarHi Santhosh,
This is my Script.
-- =============================================
-- Stored Procedure for FLATFILE_INVENTORY
-- =============================================
-- Drop stored procedure if it already exists
DROP PROCEDURE SP_Flatfile_Inventory
GO
CREATE PROCEDURE SP_Flatfile_Inventory
AS
--USE IconicMarketing
GO
DECLARE
@FileType varchar(50) ,
@ACDealerID varchar(50) ,
@ClientDealerID varchar(50) ,
@DMSType varchar(50) ,
@StockNumber varchar(50) ,
@InventoryDate datetime ,
@StockType varchar(100) ,
@DMSStatus varchar(50) ,
@InvoicePrice numeric(18, 2) ,
@CostPack varchar(50) ,
@SalesCost numeric(18, 2) ,
@HoldbackAmount numeric(18, 2) ,
@ListPrice numeric(18, 2) ,
@MSRP varchar(max) ,
@LotLocation varchar(50) ,
@TagLine varchar(max) ,
@Certification varchar(max) ,
@CertificationNumber varchar(max) ,
@VehicleVIN varchar(50) ,
@VehicleYear bigint ,
@VehicleMake varchar(50) ,
@VehicleModel varchar(50) ,
@VehicleModelCode varchar(50) ,
@VehicleTrim varchar(50) ,
@VehicleSubTrimLevel varchar(max) ,
@Classification varchar(max) ,
@TypeCode varchar(100) ,
@VehicleMileage bigint ,
@EngineCylinderCount bigint ,
@TransmissionType varchar(50) ,
@VehicleExteriorColor varchar(50) ,
@VehicleInteriorColor varchar(50) ,
@CreatedDate datetime ,
@LastModifiedDate datetime ,
@ModifiedFlag varchar(max) ,
@InteriorColorCode varchar(50) ,
@ExteriorColorCode varchar(50) ,
@PackageCode varchar(50) ,
@CodedCost varchar(50) ,
@Air varchar(100) ,
@OrderType varchar(max) ,
@AgeDays bigint ,
@OutstandingRO varchar(50) ,
@DlrAccessoryRetail varchar(50) ,
@DlrAccessoryCost varchar(max) ,
@DlrAccessoryDesc varchar(max) ,
@ModelDesc varchar(50) ,
@Memo1 varchar(1000) ,
@Memo2 varchar(max) ,
@Weight varchar(max) ,
@FloorPlan numeric(18, 2) ,
@Purchaser varchar(max) ,
@PurchasedFrom varchar(max) ,
@InternetPrice varchar(50) ,
@InventoryAcctDollar numeric(18, 2) ,
@VehicleType varchar(50) ,
@DealerAccessoryCode varchar(50) ,
@AllInventoryAcctDollar numeric(18, 2) ,
@BestPrice varchar(50) ,
@InStock bigint ,
@AccountingMake varchar(50) ,
@GasDiesel varchar(max) ,
@BookValue varchar(10) ,
@FactoryAccessoryDescription varchar(max) ,
@TotalReturn varchar(10) ,
@TotalCost varchar(10) ,
@SS varchar(max) ,
@VehicleBody varchar(max) ,
@StandardEquipment varchar(max) ,
@Account varchar(max) ,
@CalculatedPrice varchar(10) ,
@OriginalCost varchar(10) ,
@AccessoryCore varchar(10) ,
@OtherDollar varchar(10) ,
@PrimaryBookValue varchar(10) ,
@AmountDue varchar(10) ,
@LicenseFee varchar(10) ,
@ICompany varchar(max) ,
@InvenAcct varchar(max) ,
@Field23 varchar(max) ,
@Field24 varchar(max) ,
@SalesCode varchar(max) ,
@BaseRetail varchar(10) ,
@BaseInvAmt varchar(10) ,
@CommPrice varchar(10) ,
@Price1 varchar(10) ,
@Price2 varchar(10) ,
@StickerPrice varchar(10) ,
@TotInvAmt varchar(10) ,
@OptRetail varchar(max) ,
@OptInvAmt varchar(10) ,
@OptCost varchar(10) ,
@Options varchar(max) ,
@Category varchar(max) ,
@Description varchar(max) ,
@Engine varchar(max) ,
@ModelType varchar(max) ,
@FTCode varchar(max) ,
@Wholesale varchar(max) ,
@Retail varchar(max) ,
@Draft varchar(max) ,
@Inventoryid int;
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY];
OPEN Inventory_Cursor
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @VehicleVIN ;
-- ****************** insert into Inventory Table ***********
INSERT INTO INVENTORY
IconicDealerID,
StockNumber,
DMSType,
InventoryDate
VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
set @Inventoryid = scope_identity();
PRINT @Inventoryid;
--Insert into Inventory_Details Table
INSERT INTO [INVENTORY_DETAILS]
InventoryID,
StockType,
DMSStatus,
LotLocation,
TagLine,
Certification,
CertificationNumber,
CreatedDate,
LastModifiedDate,
ModifiedFlag,
PackageCode,
OrderType,
AgeDays,
OutstandingRO,
Memo1,
Memo2,
Purchaser,
PurchasedFrom,
DealerAccessoryCode,
InStock,
AccountingMake,
SS,
Account,
AccessoryCore,
ICompany,
InvenAcct,
Field23,
Field24,
SalesCode,
Draft,
FTCode
VALUES (
@InventoryID,
@StockType,
@DMSStatus,
@LotLocation,
@TagLine,
@Certification,
@CertificationNumber,
@CreatedDate,
@LastModifiedDate,
@ModifiedFlag,
@PackageCode,
@OrderType,
@AgeDays,
@OutstandingRO,
@Memo1,
@Memo2,
@Purchaser,
@PurchasedFrom,
@DealerAccessoryCode,
@InStock,
@AccountingMake,
@SS,
@Account,
@AccessoryCore,
@ICompany,
@InvenAcct,
@Field23,
@Field24,
@SalesCode,
@Draft,
@FTCode
--Insert into Inventory_Amount Table
INSERT INTO [dbo].[INVENTORY_AMOUNT]
InventoryID,
AllInventoryAcctDollar,
OtherDollar,
PrimaryBookValue,
AmountDue,
LicenseFee,
CalculatedPrice,
OriginalCost,
BookValue,
TotalReturn,
TotalCost,
DlrAccessoryRetail,
DlrAccessoryCost,
DlrAccessoryDesc,
InternetPrice,
InventoryAcctDollar,
BestPrice,
Weight,
FloorPlan,
CodedCost,
InvoicePrice,
CostPack,
SalesCost,
HoldbackAmount,
ListPrice,
MSRP,
BaseRetail,
BaseInvAmt,
CommPrice,
Price1,
Price2,
StickerPrice,
TotInvAmt,
OptRetail,
OptInvAmt,
OptCost,
Wholesale,
Retail
VALUES (
@InventoryID,
@AllInventoryAcctDollar,
@OtherDollar,
@PrimaryBookValue,
@AmountDue,
@LicenseFee,
@CalculatedPrice,
@OriginalCost,
@BookValue,
@TotalReturn,
@TotalCost,
@DlrAccessoryRetail,
@DlrAccessoryCost,
@DlrAccessoryDesc,
@InternetPrice,
@InventoryAcctDollar,
@BestPrice,
@Weight,
@FloorPlan,
@CodedCost,
@InvoicePrice,
@CostPack,
@SalesCost,
@HoldbackAmount,
@ListPrice,
@MSRP,
@BaseRetail,
@BaseInvAmt,
@CommPrice,
@Price1,
@Price2,
@StickerPrice,
@TotInvAmt,
@OptRetail,
@OptInvAmt,
@OptCost,
@Wholesale,
@Retail
--Insert into Inventory_Vehicle Table
INSERT INTO [dbo].[INVENTORY_VEHICLE]
InventoryID,
InteriorColorCode,
ExteriorColorCode,
Air,
ModelDesc,
VehicleType,
VehicleVIN,
VehicleYear,
VehicleMake,
VehicleModel,
VehicleModelCode,
VehicleTrim,
VehicleSubTrimLevel,
Classification,
TypeCode,
VehicleMileage
VALUES (
@InventoryID,
@InteriorColorCode,
@ExteriorColorCode,
@Air,
@ModelDesc,
@VehicleType,
@VehicleVIN,
@VehicleYear,
@VehicleMake,
@VehicleModel,
@VehicleModelCode,
@VehicleTrim,
@VehicleSubTrimLevel,
@Classification,
@TypeCode,
@VehicleMileage
-- Move cursor to Next record
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
END
CLOSE Inventory_Cursor;
DEALLOCATE Inventory_Cursor;
GO
SET ANSI_PADDING OFF
GO
Arunraj Kumar -
How to find the level of each child table in a relational model?
Earthlings,
I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
So: How to find the level of each child table in a relational model?
I have a relacional database (9.2), all right?!
O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
/↑\ Fks
O"O O" <-- level 2 for first table (circle)
/↑\ Fks
"o"o"o" <-- level 1 for middle table (circle)
↑ Fk
"º"Tips:
- each circle represents a table;
- red tables no have foreign key
- the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
I started thinking about the following:
First I have to know how to take the children:
select distinct child.table_name child
from all_cons_columns father
join all_cons_columns child
using (owner, position)
join (select child.owner,
child.constraint_name fk,
child.table_name child,
child.r_constraint_name pk,
father.table_name father
from all_constraints father, all_constraints child
where child.r_owner = father.owner
and child.r_constraint_name = father.constraint_name
and father.constraint_type in ('P', 'U')
and child.constraint_type = 'R'
and child.owner = 'OWNER') aux
using (owner)
where child.constraint_name = aux.fk
and child.table_name = aux.child
and father.constraint_name = aux.pk
and father.table_name = aux.father;Thinking...
Let's Share!
My thanks in advance,
Philips
Edited by: BluShadow on 01-Apr-2011 15:08
formatted the code and the hierarchy for readbilityJustin,
Understood.
Nocycle not work in 9.2 and, even that would work, would not be appropriate.
With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
-- 1
declare
type udt_roles is table of varchar2(30) index by pls_integer;
cRoles udt_roles;
begin
execute immediate 'create user philips
identified by philips';
select granted_role bulk collect
into cRoles
from user_role_privs
where username = user;
for i in cRoles.first .. cRoles.count loop
execute immediate 'grant ' || cRoles(i) || ' to philips';
end loop;
end;
-- 2
create table philips.root1(root1_id number,
constraint root1_id_pk primary key(root1_id)
enable);
grant all on philips.root1 to philips;
create or replace trigger philips.tgr_root1
before delete or insert or update on philips.root1
begin
null;
end;
create table philips.root2(root2_id number,
constraint root2_id_pk primary key(root2_id)
enable);
grant all on philips.root2 to philips;
create or replace trigger philips.tgr_root2
before delete or insert or update on philips.root2
begin
null;
end;
create table philips.node1(node1_id number,
root1_id number,
node2_id number,
node4_id number,
constraint node1_id_pk primary key(node1_id)
enable,
constraint n1_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n1_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable,
constraint n1_n4_id_fk foreign key(node4_id)
references philips.node4(node4_id) enable);
grant all on philips.node1 to philips;
create or replace trigger philips.tgr_node1
before delete or insert or update on philips.node1
begin
null;
end;
create table philips.node2(node2_id number,
root1_id number,
node3_id number,
constraint node2_id_pk primary key(node2_id)
enable,
constraint n2_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n2_n3_id_fk foreign key(node3_id)
references philips.node3(node3_id) enable);
grant all on philips.node2 to philips;
create or replace trigger philips.tgr_node2
before delete or insert or update on philips.node2
begin
null;
end;
create table philips.node3(node3_id number,
root2_id number,
constraint node3_id_pk primary key(node3_id)
enable,
constraint n3_r2_id_fk foreign key(root2_id)
references philips.root2(root2_id) enable);
grant all on philips.node3 to philips;
create or replace trigger philips.tgr_node3
before delete or insert or update on philips.node3
begin
null;
end;
create table philips.node4(node4_id number,
node2_id number,
constraint node4_id_pk primary key(node4_id)
enable,
constraint n4_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable);
grant all on philips.node4 to philips;
create or replace trigger philips.tgr_node4
before delete or insert or update on philips.node4
begin
null;
end;
-- out of the relational model
create table philips.node5(node5_id number,
constraint node5_id_pk primary key(node5_id)
enable);
grant all on philips.node5 to philips;
create or replace trigger philips.tgr_node5
before delete or insert or update on philips.node5
begin
null;
end;
-- 3
create table philips.dictionary(table_name varchar2(30));
insert into philips.dictionary values ('ROOT1');
insert into philips.dictionary values ('ROOT2');
insert into philips.dictionary values ('NODE1');
insert into philips.dictionary values ('NODE2');
insert into philips.dictionary values ('NODE3');
insert into philips.dictionary values ('NODE4');
insert into philips.dictionary values ('NODE5');
--4
create or replace package body philips.pck_restore_philips as
procedure sp_select_tables is
aExportTablesPhilips utl_file.file_type := null; -- file to write DDL of tables
aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
aExportIndexesPhilips utl_file.file_type := null; -- file to write DDL of indexes
aExportGrantsPhilips utl_file.file_type := null; -- file to write DDL of grants
aExportTriggersPhilips utl_file.file_type := null; -- file to write DDL of triggers
sDirectory varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02
cTables udt_tables; -- collection to store table names for the relational depth
begin
-- omits all referential constraints:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
-- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
-- append a SQL terminator (; or /) to each DDL statement:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
-- create/open files for export DDL:
aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
select d.table_name bulk collect
into cTables -- collection with the names of tables in the schema philips
from all_tables t, philips.dictionary d
where owner = 'PHILIPS'
and t.table_name = d.table_name;
-- execution
sp_seeks_ddl(aExportTablesPhilips,
aExportReferencesPhilips,
aExportIndexesPhilips,
aExportGrantsPhilips,
aExportTriggersPhilips,
cTables);
-- closes all files
utl_file.fclose_all;
end sp_select_tables;
procedure sp_seeks_ddl(aExportTablesPhilips in utl_file.file_type,
aExportReferencesPhilips in utl_file.file_type,
aExportIndexesPhilips in utl_file.file_type,
aExportGrantsPhilips in utl_file.file_type,
aExportTriggersPhilips in utl_file.file_type,
cTables in out nocopy udt_tables) is
cDDL clob := null; -- colletion to save DDL
plIndex pls_integer := null;
sTableName varchar(30) := null;
begin
for i in cTables.first .. cTables.count loop
plIndex := i;
sTableName := cTables(plIndex);
* Retrieves the DDL and the dependent DDL into cDDL clob *
* for the selected table in the collection, and writes to file.*
begin
cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTablesPHILIPS, cDDL);
exception
when dbms_metadata.object_not_found then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportReferencesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
sp_writes_ddl(aExportIndexesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportGrantsPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTriggersPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
end loop;
end sp_seeks_ddl;
procedure sp_writes_ddl(aExport in utl_file.file_type,
cDDL in out nocopy clob) is
pLengthDDL pls_integer := length(cDDL);
plQuotient pls_integer := null;
plRemainder pls_integer := null;
begin
* Register variables to control the amount of lines needed *
* for each DDL and the remaining characters to the last row. *
select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
into plQuotient, plRemainder
from dual;
* Join DDL in the export file. *
* ps. 32766 characters + 1 character for each line break. *
-- if the size of the DDL is greater than or equal to limit the line ...
if plQuotient >= 1 then
-- loops for substring (lines of 32766 characters + 1 break character):
for i in 1 .. plQuotient loop
utl_file.put_line(aExport, substr(cDDL, 1, 32766));
-- removes the last line, of clob, recorded in the buffer:
cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
end loop;
end if;
* If any remains or the number of characters is less than the threshold (quotient = 0), *
* no need to substring. *
if plRemainder > 0 then
utl_file.put_line(aExport, cDDL);
end if;
-- record DDL buffered in the export file:
utl_file.fflush(aExport);
end sp_writes_ddl;
begin
-- executes main procedure:
sp_select_tables;
end pck_restore_philips;<font color="red">The problem is that I still have ...
When creating the primary key index is created and this is repeated in the file indexes.
How to avoid?</font> -
Invalid XML, Expected item name child table but got 'row' UDO name
Hi expects
my client is using SAP 2007B, PL15
I have problem in uploading data via DTW in UDO master type table.
I don't have importing data
Only i have problem in updating data in UDO master type table
Detail log is Invalid XML, Expected item name 'TB_SALES_AGTDISC_CH' but got 'row' UDO_obj_sales_agt_disc
TB_SALES_AGTDISC - master type
fields are Code,Name
'TB_SALES_AGTDISC_CH -master row type
fields Code,vaidfrm,validto,disc_ltr
Please give some suggestions
PrasadHi
I checked my previous thread.
But still I am getting problem in importing one additional row in child table.
Message i was getting when i importing via DTW Re: Invalid XML, Expected item name<child table> but got 'row' UDO name
Please give me some links or procedure how to import row in child tabe
Prasad -
Need data in Child table based on master table
Need help in SQL :
I have master table name called : AA
Data is having :
Date Display Name
=====================
10/3/2009 Q3 2009
1/3/2010 Q4 2009
1/13/2010 Q1 2010
4/4/2009 Q1 2009
7/4/2009 Q2 2009
I have Child Table
===============================
ID Date Name
=======================================
101 10/3/2009 AAAAA
101 1/3/2010 AAAAB
=====================================
Reporting purpose, I need to have data in child table for every quarter.
Problem is : I dont have data in child table for every quarter date.
How I want : I want to create a view, which has data of child table along with all quarters, so that I can use that view in my report.
Data I want in view :
ID Date Name
=======================================
101 10/3/2009 AAAAA
101 1/3/2010 AAAAB
101 1/13/2010 NOT PRESENTED ( NEW ROW)
101 4/4/2009 NOT PRESENTED ( NEW ROW)
101 7/4/2009 NOT PRESENTED ( NEW ROW)
I dont want to create any procedure for this, because evey time need to run the procedure to populate data in the view / table
Thanks in advancethe Above question is answered perfectly,
I got some more extension to the above query.
Initial Question:
Need help in SQL :
I have master table name called : AA
Data is having :
Date Display Name
=====================
10/3/2009 Q3 2009
1/3/2010 Q4 2009
1/13/2010 Q1 2010
4/4/2009 Q1 2009
7/4/2009 Q2 2009
I have Child Table
===============================
ID Date Name
=======================================
101 10/3/2009 AAAAA
101 1/3/2010 AAAAB
=====================================
Reporting purpose, I need to have data in child table for every quarter.
Problem is : I dont have data in child table for every quarter date.
How I want : I want to create a view, which has data of child table along with all quarters, so that I can use that view in my report.
Data I want in view :
ID Date Name
=======================================
101 10/3/2009 AAAAA
101 1/3/2010 AAAAB
101 1/13/2010 NOT PRESENTED ( NEW ROW)
101 4/4/2009 NOT PRESENTED ( NEW ROW)
101 7/4/2009 NOT PRESENTED ( NEW ROW)
I dont want to create any procedure for this, because evey time need to run the procedure to populate data in the view / table
**New Question:* :* I have got another parent for Child for ID's : Ex : 101
Another Parent table: AP
=====================
ID
=============
101
102
103
I want to show every quarter to this ID as well Child. ( I can partition from this id, but I need some data from Child also.)
Data I want in view :
ID Date Name
=======================================
101 10/3/2009 AAAAA
101 1/3/2010 AAAAB
101 1/13/2010 NOT PRESENTED ( NEW ROW)
101 4/4/2009 NOT PRESENTED ( NEW ROW)
101 7/4/2009 NOT PRESENTED ( NEW ROW)
102 10/3/2009 NOT PRESENTED ( NEW ROW)
102 1/3/2010 NOT PRESENTED ( NEW ROW)
102 1/13/2010 NOT PRESENTED ( NEW ROW)
102 4/4/2009 NOT PRESENTED ( NEW ROW)
102 7/4/2009 NOT PRESENTED ( NEW ROW)
103 10/3/2009 NOT PRESENTED ( NEW ROW)
103 1/3/2010 NOT PRESENTED ( NEW ROW)
103 1/13/2010 NOT PRESENTED ( NEW ROW)
103 4/4/2009 NOT PRESENTED ( NEW ROW)
103 7/4/2009 NOT PRESENTED ( NEW ROW)
Thanks in advance -
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. -
Master table unknown child tables
Hi there!
Suppose there is a master table having unknown child tables
And i simply want to delete all the records of master as well as child's.
Kind Regards!
nullyour lov problem can be because of your form modules database interaction property. i have the same problem.in form module properties "INTERACTION MODE" must be blocking.
Abdullah AKOGLU
Q4) I have installed & configured the 8iAS my System is running Ok.But
my Prob. Is that when I invoke the LOV first time it takes too much time
it is ok however but when I invoke it again it takes too much time again.
Is there any way to improve performance of such database etc. activities.
null -
How to find out master tables and concern child tables
Hi,
my schema contains 219 tables. I got this result by using query "selct count(*) from user_tables".
Now i need to know about master tables and concern child tables from these 219 tables.
please guide me.
Thanks and Regards,
VenkatWhat about this one!!!
select a.owner,a.table_name,a.column_name,
'------------------>' as POINTS_TO,b.owner,b.table_name,b.column_name
from dba_constraints c
join dba_cons_columns a on ( c.constraint_name = a.constraint_name and c.owner = a.owner)
join dba_cons_columns b on ( c.r_constraint_name = b.constraint_name and c.r_owner = b.owner)
where (a.table_name = '&table' and (a.owner='&owner')) -- foreign key
-- and (b.table_name = '&table' and (b.owner='&owner') ) -- source key
and ( c.constraint_type='R' )
order by a.table_namecomment and uncomment one between theese two lines to choose the direction.
(a.table_name = '&table' and (a.owner='&owner')) -- foreign key
-- and (b.table_name = '&table' and (b.owner='&owner') ) -- source keyBye Alessandro
Edited by: Alessandro Rossi on 22-ott-2008 10.40 -
How to identify all the child tables referencing a master table
Hi,
How to identify all the child tables referencing a master table.
Could you please help me...
Thanks in advance...Hi!
You may use this query:
SELECT master.table_name, child.table_name
FROM user_constraints master, user_constraints child
WHERE master.table_name IN ('REGIONS')
AND master.constraint_name = child.r_constraint_name
/yours sincerely
Florian W. -
Query --- to find all child tables for a master table
Suppose i have a table master .
I want to know all tables which are child tables for this master table .
In other words i want to know all those table names which have foreign key constraint for the master table .
regards
shubhaYou may want to join on the owner in case you have multiple schemas with same table names and same primary key names
SELECT c.table_nameFROM all_constraints c, all_constraints p
WHERE c.constraint_type = 'R'
AND c.r_constraint_name = p.constraint_name
AND p.constraint_type = 'P'
AND c.owner = p.owner
AND p.table_name = '&YOUR_MASTER_TABLE' -
Inserting multiple rows in child table
i have two entity beans (main and child) with relationship one to many .... when i insert one row in main table (ie when i make one object for main entity bean)... how to insert multiple rows in child table...
Can anyone pls provide some sample code for the above.. how to pass a collection and populate it in the child table.
1.Where to pass the collection, to the childbean directly or to the parent bean and then itereate to the collectio and create child bean.
Much obliged if you could paste some code for the above..
Maybe you are looking for
-
Hello ! I'm using the following code (pretty much) to add items to existing sales orders : Dim oOrder As SAPbobsCOM.Documents oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders) oOrder.GetByKey(id) oOrder.Lines.Add() oOrder.Lines.It
-
LVOOP "call parent method" doesn't work when used in sibling VI
It seems to me that the "call parent method" doesn't work properly according to the description given in the LabVIEW help. I have two basic OOP functions I am doing examples for. I can get one to work easily and the other one is impossible. Backgroun
-
How to acquire data from multiple dataports at the same time
Hi, I studied the multithreading section of Labview, but still have no idea how to make it work. Let me briefly explain my situation. I need to develop a program that can control and acquire data from 4 serial ports. I have 4 buttons to control start
-
The keyboard of my 11-inch MacBook Air, purchased in November 2011, isn't working at all. None of the keys respond except the power button. I'm able to restart the computer, and have done so multiple times. I've attempted SMC and PRAM resets, but the
-
Ibooks how to do samples with the full toc visible
I am editing a sample of the book i am uploading to iBookStore. On the sample, I'd like to have the whole TOC (table of contents) visible, though the chapters that are not included on the sample would appear dimmed, in grey or something. How could I