Line graph parent table child
i have a page where i have a line graph as parent and a table as its child. i want to have a master detail relationship through a view link of cardinality 1 to many.
when user selects appropriate points of line graph, the child table should refresh accordingly.
child table shows only children of firts record of line graph.
is there a problem with line graph being a parent. i could find examples which used bar / pie graph but not line graph. although i had checked the checkbox while creating graph.
i am using bind variables for both parent and child VO.
do i need to execute child VO query again to be able to display corresponding children for a parent on a line graph.
jdev 11 1 1 5
Hi,
when you create a line graph by dragging a collection (View Object) from the Data Controls panel to the page then, in the second dialog of the wizard, there is a check box "Set current row for master-detail". Check this check box and then create the table from the dependent view object. No bind variables required
Frank
Similar Messages
-
Parent Table - Child Form(bounded task region)- Commit-Rollback Button's
Hello,
Here's my simple scenario:
Jdev 11.1.1.2
One Am(datacontrol).
One vertical panel splitter
On top A panel collection with a read-only table(employees VO), The table lists just a few of the attributes, so it's really just for browsing, and a toolbar with createinsert, commit and rollback button's.
At bottom: A PanelTab with a bounded task flow - region. The child region(bounded task flow) contains an editable ADF form(same VO) will all attributes available for editing. The form(child region) also contains a 'submit' button (to post changes).
When run the page commit and rollback button are disable. (ok)
Navigation and sincronize between table and task flow works fine because i set partialtrigger. (ok)
When i change some attribute in the form and then press summit button, I want the commit and rollback button's became active..
. . any help would be much appreciated.
Edited by: user7056373 on 08-ene-2010 3:23Hi Bart,
if your bounded task flow is placed in .jspx using region it is possible to reach binding container of that task flow.
You can use handies by Edwin Biemond:
# // main jsf page
# DCBindingContainer dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
# // taskflow binding
# DCTaskFlowBinding tf = (DCTaskFlowBinding)dc.findExecutableBinding("dynamicRegion1");
# // pagedef of a page fragment
# JUFormBinding form = (JUFormBinding) tf.findExecutableBinding("regions_employee_regionPageDef");
# // handle to binding container of the region.
# DCBindingContainer dcRegion = form; but ExecuteWithParam works for me in bounded task flow - I think you have mistake in your NDValue="#{pageFlowScope.pclNummer}". you should use $ instead #
regards,
Branislav -
Can't delete from parent table if FK constraint on the out-of-line table
Using Oracle XML DB 11g
I am using out-of-line storage table to store a collection of XML elements in conjuction with storeVarrayAsTable="true". So what I have is a parent table containing a nested table of VARRAY of REFs to rows in the out-of-line table.
In addition, I have a foreign key constraint placed on a column in the out-of-line table.
My problem is that I am not able to delete rows from the parent table when the FK constraint is placed on the out-of-line table. Only when I drop the FK constraint does the deletion work - all associated rows in the nested table and out-of-line table
gets deleted correctly.
With the FK constraint, deleting the child document like this
dbms_xdb.deleteResource('/project-1.xml')
gives me this error:
ORA-31018: Error deleting XML document
ORA-03001: unimplemented feature
*Cause: The XMLType object pointed to by the given REF could not
be deleted because either the REF was invalid or it pointed to a non-existent table.
*Action: Either use FORCE deletion or supply a valid REF.
I have tried deleting with the FORCE options as well with no success.
Using DBMS_XDB.DELETE_RECURSIVE_FORCE option doesn't produce an error, but doesn't perform the deletion either.
Here is the XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xlink="http://www.w3.org/1999/xlink"
elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd"/>
<xs:element name="project" xdb:defaultTable="PROJECT_TAB">
<xs:complexType xdb:SQLType="PROJECT_TYP">
<xs:sequence>
<xs:element name="resourceList" minOccurs="0" xdb:SQLName="RESOURCE_LIST">
<xs:complexType xdb:SQLType="RESOURCE_LIST_TYP">
<xs:sequence>
<xs:element name="aResource" type="refType" minOccurs="0" maxOccurs="unbounded" xdb:SQLInline="false"
xdb:SQLName="A_RESOURCE_REF" xdb:defaultTable="RESOURCE_REF_TAB"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="aguid" type="xs:string" use="required" xdb:SQLName="AGUID"/>
</xs:complexType>
</xs:element>
<xs:element name="aResource" xdb:defaultTable="A_RESOURCE_TAB">
<xs:complexType xdb:SQLType="A_RESOURCE_TYP">
<xs:complexContent>
<xs:extension base="contactType">
<xs:attribute name="aguid" type="xs:string" use="required" xdb:SQLName="AGUID"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="contactType" xdb:SQLType="CONTACT_TYP">
<xs:sequence>
<xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
<xs:element name="email" type="xs:string" minOccurs="0" xdb:SQLName="EMAIL"/>
<xs:element name="phone" type="xs:string" xdb:SQLName="PHONE"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="refType" xdb:SQLType="REF_TYP">
<xs:attribute ref="xlink:href" use="required"/>
<xs:attribute name="oref" type="xs:string" use="optional" xdb:SQLName="OREF"/>
</xs:complexType>
</xs:schema>
I registered the schema using structured storage with these options:
BEGIN
DBMS_XMLSCHEMA.registerschema(
SCHEMAURL => 'LSDProjects.xsd',
SCHEMADOC => xdbURIType('/home/LSDProject2/LSDProjects.xsd').getClob(),
LOCAL => TRUE, -- local
GENTYPES => TRUE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => TRUE -- generate object tables
END;
The PK and FK constraints were added like this:
-- Add PK constraints on aResource/@aguid attributes
ALTER TABLE A_RESOURCE_TAB ADD CONSTRAINT A_RESOURCE_AGUID_IS_UNIQUE UNIQUE (XMLDATA."AGUID");
-- Add FK constraint on out-of-line table
ALTER TABLE RESOURCE_REF_TAB
ADD (CONSTRAINT ref_resource_aguid_is_valid FOREIGN KEY (XMLDATA."OREF")
REFERENCES A_RESOURCE_TAB(XMLDATA."AGUID"));
Here are the XML instance documents:
where resource-1.xml looks like this :
<aResource aguid="resource-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LSDProjects.xsd">
<name>Jane Doe</name>
<email>[email protected]</email>
<phone/>
</aResource>
and project-1.xml looks like this :
<project aguid="project-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LSDProjects.xsd"
xmlns:xlink="http://www.w3.org/1999/xlink">
<resourceList>
<aResource xlink:href="/resource-1.xml" oref="resource-1"/>
</resourceList>
</project>
where <project> document contains a collection of <aResource> elements stored in the out-of-line table and
project/@oref attribute is a foreign key to the primary aResource/@aguid attribute.
Can someone shed some light on why I am unable to delete "project-1.xml" from the repository when the FK constraint is applied onto the out-of-line table.
Any advice/suggestions would be appreciated. Thanks!Thank you for the quick reply, mdrake.
I am currently prototyping and testing out (best) ways to achieve data integrity with XML data in XML DB.
I have instance documents that makes cross references to values in other instance documents
(not of the same root nodes). What I'm trying to enforce is a referential constraint between the documents
so that a document cannot be inserted if the referenced document doesn't exists.
In this situation, a <project> document contains a collection of elements with @oref attributes.
The collection is stored in an out-of-line table.
For example:
<project>
<resourceList>
<aResource ... oref="resource-1"/>
<aResource ... oref="resource-2"/>
</resourceList>
</project>
The @oref (FK) attribute above references a @aguid (PK) attribute in <aResource> document (below):
<aResource aguid="resource-1"> .... </aResource>
Basically, I want to ensure that the value of
/project/resourceList/aResource/@oref
correspond to a valid
/aResource/@aguid
Note that I was able to add the FK constraint on the OOL table without any issues.
And the constraint did work as expected as I was not allowed to insert a <project> document
that referenced a non-existent /aResource/@aguid.
The problem was that I could not delete the <project> document from the XML DB repository
once the FK contraint was added. Deleting with the DELETE_RECURSIVE_FORCE option did not give
me any errors - is just didn't do anything.
I guess there are certain limitations with using out-of-line tables.
BTW, sorry the examples are hard to read as the indentations are removed when posting. -
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 -
Hi all,
Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
Problem #1) How can I print out or export these 3 dbo Tables?
Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service.
--> Failed to retrieve data for this request. --> Invalid class. Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
to manage a service. --> Failed to retrieve data for this request. --> Invalid class. .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates> What causes this set of error messages? How can
I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
Thanks in advance,
Scott ChangIn the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
2) I don't know why you get that error, but any particular reason you want to run PowerShell?
4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
As for left/right join, notice that these two are equivalent:
SELECT ...
FROM a LEFT JOIN b ON a.col = b.col
SELECT ...
FROM b RIGHT JOIN a ON a.col = b.col
But please never use RIGHT JOIN - it gives me a headache!
There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
Here is an example where you can study the different join types and how they behave:
CREATE TABLE apple (a int NOT NULL PRIMARY KEY,
b varchar(23) NOT NULL)
INSERT apple(a, b)
VALUES(1, 'Granny Smith'),
(2, 'Gloster'),
(4, 'Ingrid-Marie'),
(5, 'Milenga')
CREATE TABLE orange(c int NOT NULL PRIMARY KEY,
d varchar(23) NOT NULL)
INSERT orange(c, d)
VALUES(1, 'Agent'),
(3, 'Netherlands'),
(4, 'Revolution')
SELECT a, b, c, d
FROM apple
CROSS JOIN orange
SELECT a, b, c, d
FROM apple
INNER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
LEFT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
RIGHT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
FULL OUTER JOIN orange ON apple.a = orange.c
go
DROP TABLE apple, orange
Erland Sommarskog, SQL Server MVP, [email protected] -
Update column data to Upper Case in parent and child table
Hi ,
I am facing issue while updating column value to upper case in parent table and child table. How can i do that ?
when updating parent row:
ORA-02292: integrity constraint (XXXXXXXXXXXXXX_FK) violated - child record found
When updatng corresponding child row:
ORA-02291: integrity constraint (XXXXXXXXXXXXXXXX_FK) violated - parent key not found
how can i update on both the places ?
Regards,
AAI am facing issue while updating column value to upper case in parent table and child table. How can i do that ?
Why do you need to do that?
That is just ONE of several questions you should answer before you start modifying your data.
1. What is your 4 digit Oracle version? (result of SELECT * FROM V$VERSION)
2. If both values are the same case what difference does it make what that case is?hen you don't need to alter your original data.
3. What is the source of the column values you are using now? If you change your data to upper case it will no longer be identical to the source data.
4. What is your plan for enforcing future values to be stored in UPPER case? Are you going to use a trigger? Have you written and tested such a trigger to see if it will even work the way you expect?
5. Why aren't you using a surrogate key instead of a 'business' data item? You have just demonstrated one reason why surrogate keys can be useful: their actual value is NOT important.
You should reexamine your problem and architecture and consider other alternatives.
One alternative is to add a new 'surrogate key' column to use as the primary key. Just create a new sequence and use a trigger to populate the new column. Your current plans will require a trigger to perform the case conversion so instead of the just use the trigger to provide the value.
If the change is being done to facilitate searching you could just add a VIRTUAL column UPPER_MY_COLUMN and index that instead. Then you could search on that new virtual column and the data values would still be identical to the original data source. -
How to check that my table is parent table or child table before trucating
Hi:
say i wanted to trucate a table .the table might be a parent table or might be a child table.if its a child table then there wouldnt be any problems in truncating.
if its a parent table the i believe i would have to diable all the foreign key constraints from the child table referring to the parent table ..my question is
1. i have a table say ABC. before truncating how do i find out if table ABC is a parent table or not?
2.lets assume i tried to truncate the table ABC and i got the error saying that disable the foreign keys on the child table referring to the parent table ABC.
in my schema there are say 50 tables.out of which there might be 10 odd child tables referring to my parent table ABC.
so my question here would be how do i specifically find out these 10child tables referring to the Parent table ABC so that i can disable the foreign keys on the child tables.
Thanks 4 ur time in reading this and hopefully i think u wld give me a solution!!Hi,
Try this SQL below:
select r.owner, r.table_name
from user_constraints r, user_constraints o
where r.r_owner = o.owner and r.r_constraint_name = o.constraint_name
and o.constraint_type in ('P','U') and r.constraint_type = 'R'
and o.table_name = 'ABC';Cheers -
Insert data Flatfile table to Parent and child tables
Hi All,
I have Flatfile table which is we getting from daily txt files and i want to populate flatfile data to parent as well as child tables. parent table has primary key as ID. This ID is foreign key of child tables.
Here i have mentioned our process.
1. Flatfile duplicates has to remove with condition of daily date.
2. Before Insert parent table have to check duplicate(we have Unique key of 4 columns in parent) if duplicate is there we have to delete duplicate then Insert into parent table unique records(Primary key is ID).(here why we are delete duplicate record meaning
we getting daily files so if any records updated in future that record should be insert to parent and child table so only we delete old records and insert new records).
3.After insert parent we have to populate child tables from Flatfile table as well as we have to insert parent table primary key as foreign key of child tables.
4. if any truncation error occurs that errors should go to error log table.
Right now we are using cursor for this concept and cursor has performance issue. so we are trying to optimize other way to populate parent and child table to increase performance to populate.
Please help us to which way to do this process increase of performance .
Please can any one reply.Hi RajVasu,
Since this issue is related to Transact-SQL, I will move this thread to Transact-SQL forum. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Join a Parent Table with 2 Child table based on a value
Dear Guru's
We have a Parent Table and 2 Child table . The Parent Table has a column like seqtype with only 2 possible values C and S . If the Value is C , then the details are available in Child 1 table and if the Value is S then the Details are in Child 2 table
How can we query the Data from this type of arrangement ? I am little bit confused and hit a road block
Will the following query will work ?
Select
from Parent P , Child C1, Child C2
where P.seqtype = C1.Seqtype
and P.seqtype = C2.Seqtype
With Warm Regards
ssrYou didn't mention the column names in two child tables. Whether the columns are same in 2 tables of these are different.
If the columns are same better to go and change your design to have only one child table. However if stiil business stops you having one table you can use UNION ALL (Assuming you want to fetch same column information from two child tables) like below:
SELECT p.col1
,c1.col2
,c1.col3
,c1.col4
FROM parent p
,child c1
WHERE p.seqtype = c1.seqtype
UNION ALL
SELECT p.col1
,c2.col2
,c2.col3
,c2.col4
FROM parent p
,child c2
WHERE p.seqtype = c2.seqtype Regards
Arun -
How to delete parent table data even though it has child records
hi all,
How to delete parent table data even though it has child records.
ex: delete from pa_request cascade constraints;
But this command is not working .
Regards,
P Prakash833560 wrote:
ex: delete from pa_request cascade constraints;cascade constraints is DROP table option. It can't be used with DELETE. You need to delete child rows first or drop foreign keys and recreate them with ON DELETE CASCADE. Then:
delete from pa_request will automatically delete child rows. However, personally I don't like ON DELETE CASCADE. You can, by mistake, delete half of your database without even realizing it.
SY. -
I am using a child table 'CHILD_T' and in this table the column 'CHILD_FK' is the foreign key and it is pointing to some parent table. In my oracle editor I can see only synonyms but not actual tables. Is there any way to find out the parent table for this child table. Why I am asking this is because , I am getting below error while trying to execute the below script.
Here I think my question is pretty simple but I would like to know how to find a parent table of a child table as I can see only synonyms instead actual tables.
Script :
INSERT INTO CHILD_T ( EM_ID, DFLT_COST_CNTR_TXT, ACCT_TYP_ID, DFLT_ORD_TYP_ID ) VALUES ('abcd', 'NA', '1', '1' );
Error:
SQL Error: ORA-02291: integrity constraint (AFM.USR_PROF_EM_ID) violated - parent key not found.
Any one have any idea your help is well appreciated.select table_name from user_constraints where constraint_name in
(select r_constraint_name from user_constraints where constraint_name='YOUR_CONSTARINT_NAME'); -
Sql server partition parent table and reference not partition child table
Hi,
I have two tables in SQL Server 2008 R2, Parent and Child Table.
Parent has date time, and it is partitioned monthly, there is a Child table which just refer the Parent table using Foreign key relation.
is there any problem the non-partitioned child table referring to a partitioned parent table?
Thanks,
AreefThe tables will need to be offline for the operation. "Offline" here, means that you wrap the entire operation in a transaction. Ideally, this transaction would:
1) Drop the foreign key.
2) Use ALTER TABLE SWITCH to drop the old data.
3) Use ALTER PARTITION FUNCTION to drop the old empty partition.
4) Use ALTER PARTITION FUNCTION to add a new empty partition.
5) Reapply the foreign keys WITH CHECK.
All but the last operation are metadata-only operation (provided that you do them right). To perform the last operation, SQL Server must scan the child tbale and verify that all keys are present in the parent table. This can take some time for larger tables.
During the transaction, SQL Server holds Sch-M locks on the table, which means that are entirely inaccessible, even for queries running with NOLOCK.
You avoid this the scan by applying the fkey constraint WITH NOCHECK, but this can have impact on query plans, as SQL Server will not consider the constraint as trusted.
An alternative which should not be entirely dismissed is to use partitioned
views instead. With partitioned views, the foreign keys are not an issue, because each partition is a pair of tables, with its own local fkey.
As for the second question: it appears to be completely pointless to partition the parent, but not the child table. Or does the child table only have rows for a smaller set of the rows in the parent?
Erland Sommarskog, SQL Server MVP, [email protected] -
DB Adapter wizard – WHERE clause on parent and child tables not working.
I have two tables, SECURITY and SECURITY_POSITIONS, where SECURITY has a 1:M relationship with SECURITY_POSITIONS. I used the DB-adapter wizard to create the relationship and the following WHERE clause expression which is looking at both the parent and the child tables;
The expression builder looks like this:
AND
|--- 1. partitionKey EQUAL p_SearchKey
|--- 2. securityType EQUAL “DBT”
|--- 3. securityPositionsCollection.dealReference EQUAL “NA”
The primary key on SECURITY = PARTITION_KEY and SECURITY_REFERENCE
The foreign key from SECURITY_POSITIONS to SECURITY = PARTITION_KEY and SECURITY_REFERENCE
securityType is on SECURITY table (master)
securityPositionsCollection.dealReference is on SECURITY_POSITIONS table (child)
The invoke on the database adapter is selecting a row in securityPositionsCollection for each child row, rather than just those with dealReference = “NA”!
I turned on DEBUG logging in the BPEL console and I can see that there are 2 SELECT queries run (guess this is how Toplink does it!), where the 1st query appears to select the parent rows and the 2nd query selects the child rows.
However the 2nd query is not working because it is failing to select only those child rows where dealReference = “NA”. Also, don’t know why the 2nd SELECT query needs to specify the child SECURITY_POSITIONS table twice in the FROM clause, because that seems to be causing the problem.
1st query executed is as follows;
SELECT DISTINCT t0.PARTITION_KEY, t0.SECURITY_REFERENCE, t0.SECURITY_TYPE
FROM CENTRAL.SECURITY t0, CENTRAL.SECURITY_POSITIONS t1
WHERE ((((t0.PARTITION_KEY = ?) AND (t0.SECURITY_TYPE = ?)) AND (t1.DEAL_REFERENCE = ?)) AND ((t1.SECURITY_REFERENCE = t0.SECURITY_REFERENCE) AND (t1.PARTIT
ION_KEY = t0.PARTITION_KEY)))
bind => [200706200000, DBT, NA]
2nd query executed is as follows, where child table appears twice! ;
SELECT DISTINCT t0.DEAL_REFERENCE, t0.PARTITION_KEY, t0.SECURITY_REFERENCE
FROM CENTRAL.SECURITY_POSITIONS t0,
CENTRAL.SECURITY_POSITIONS t2,
CENTRAL.SECURITY t1
WHERE ((((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND (t0.PARTITION_KEY = t1.PARTITION_KEY)) AND
(((t1.PARTITION_KEY = ?) AND (t1.SECURITY_TYPE = ?)) AND
(t2.DEAL_REFERENCE = ?))) AND
((t2.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND
(t2.PARTITION_KEY = t1.PARTITION_KEY)))
bind => [200706200000, DBT, NA]
Anyone experienced the same problem e.g. why is toplink making the query more complicated that it needs to be, because the query only needs to reference the SECURITY_POSITIONS table once, as follows;
SELECT DISTINCT t0.DEAL_REFERENCE, t0.PARTITION_KEY, t0.SECURITY_REFERENCE
FROM CENTRAL.SECURITY_POSITIONS t0,
CENTRAL.SECURITY t1
WHERE ((((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND (t0.PARTITION_KEY = t1.PARTITION_KEY)) AND
(((t1.PARTITION_KEY = '200706200000') AND (t1.SECURITY_TYPE = 'DBT')) AND
(t0.DEAL_REFERENCE = 'NA'))) AND
((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND
(t0.PARTITION_KEY = t1.PARTITION_KEY)))Hello,
It looks like you have configured your 1:M relationship to use batch reading. This causes the query to bring in the Security_Position table's objects to use the same selection criteria as was used on the initial query, with a join statement. This is more efficient in most cases as it ensures only the Security_positions needed for the Security objects to be fully built are read, in a single query.
The selection criteria added is only used to filter out the Security objects. All referenced Security_Positions must be read in for the returned Security objects so that the data matches what is in the database. If you do not want the Security_Positions, you might try using indirection on the mapping which will delay the second query until you need the Security_Positions. Or, if you want only the Security_Positions with dealReference EQUAL “NA", you could do a query specifically to filter on them.
Best Regards,
Chris -
Delete entries over 1 month old in parent and child tables
Hi guys,
Im new to oracle (2days old) and im struggling to find out how to delete all entries over 1 month old in a database but also delete entries from the child table. I have read about delete cascading etc but im really strugging at the moment. Any tip or ideas? thank youYou just need to delete data in parent table using the right WHERE clause that requires some timestamp column that stores data age. If the foreign key constraint is created with ON DELETE CASCADE child rows are automatically deleted.
Assuming P is the parent table and C the child table and the timestamp column is stored in the parent table here is an example.
SQL> create table p(px int primary key, d date);
Table created.
SQL> create table c(cx int, cy int references p on delete cascade);
Table created.
SQL>
SQL> insert into p values(1, '01/01/2011');
1 row created.
SQL> insert into p values(2, '15/01/2011');
1 row created.
SQL> insert into p values(3, '31/01/2011');
1 row created.
SQL> insert into c values(10,1);
1 row created.
SQL> insert into c values(20,2);
1 row created.
SQL> insert into c values(30,3);
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> delete p where months_between(sysdate, d) >= 1;
2 rows deleted.
SQL>
SQL> select * from p;
PX D
3 31-01-2011
SQL> select * from c;
CX CY
30 3
SQL>Edited by: P. Forstmann on 15 févr. 2011 13:45 -
Update key in parent and child tables
Situation:
Parent table (p) has a PK, p.parent_id. Child table (c) has a FK c.parent_id which, of course, points back to PK, p.parent_id.
I need to UPDATE the key in both tables but I am concerned about throwing a FK constraint violation. How does one get around this? Does one update the child first then the parent or vice versa? Seems either way a FK violation will occur...
thank u.1) If you ever anticipate wanting to update a key, that key should not be the primary key of a table. Primary keys should be immutable. If this is going to happen with any regularity, you need to re-examine the underlying data model.
2) If the constraints were declared to be deferrable, you would simply mark them as deferred, update both tables, and commit (at which point the constraint would be validated). If the constraints were not declared to be deferrable, you will probably need to end up dropping and re-creating one or the other (presumably as a deferrable constraint this time).
Justin
Maybe you are looking for
-
Kde and Pam related problems[solved]
And here they are, from /var/log/errors: Jun 28 14:47:58 DreaM kdm: :0[2780]: PAM unable to dlopen(/lib/security/pam_console.so) Jun 28 14:47:58 DreaM kdm: :0[2780]: PAM [dlerror: /lib/security/pam_console.so: cannot open shared object file: No such
-
Hello Many pops in my music bed in an NTSC DV sequence - I checked and the audio which came from a CD is 44k. Seq is 48k. Do I have to change the audio to 48, if so how, or won't FCP 4.5 do it automatically when I render? Thanks KB
-
HI all, I want to learn more about CRM EHP1. But I could not access blogs of SDN.I am in china. May you have any suggestion about access it in china ?
-
HI I hope might be a number of issues has reported like this, I am gettnig confused about the direction of an acl, when it is on a router's physical interface and when it is on a Layer Switch SVI interface, I think my understanidng about acl needs to
-
Itunes latest revision how do I delete old podcasts?
Used to select items, right click mouse, select delete, and done. Now, right click mouse, no delete choice, what's up?