Tables with referential integrity
Hi All,
I am generating scripts to insert data from one schema to another. something like this:
Insert into schemaA.table1
select *from schemaB.table1;There are many tables with referential integrity in the schema. how can generate the scripts in an order so that there
won' t be any referential integrity issue....
Thanks.
AJR
Hi,
Thanks.
I tried, but it gives me 6 sets of data.
SELECT TABLE_NAME--, LTRIM(SYS_CONNECT_BY_PATH(TABLE_NAME, '=>'),'=>') TABLE_NAME_PATH,CONSTRAINT_NAME, R_CONSTRAINT_NAME, LEVEL
FROM USER_CONSTRAINTS,ALL_OBJECTS B
--WHERE LEVEL > 1
WHERE
USER_CONSTRAINTS.OWNER = B.OWNER AND
USER_CONSTRAINTS.TABLE_NAME = B.OBJECT_NAME AND
B.OBJECT_TYPE = 'TABLE'
CONNECT BY R_CONSTRAINT_NAME = PRIOR CONSTRAINT_NAME
ORDER BY TABLE_NAME;AJR
Similar Messages
-
Query to display the tables with referential integrity
Hello,
I need to display the Tables which are having referential integrity..
Like need to dispaly the parent and child tables
Please give me some idea on this..
Thanks,Here's a nice query you can use:
with temp_constraints as (
select table_name
, constraint_name pkey_constraint
, null fkey_constraint
, null r_constraint_name
from user_constraints
where constraint_type = 'P'
union all
select a.table_name
, a.constraint_name pkey_constraint
, b.constraint_name fkey_constraint
, b.r_constraint_name
from user_constraints a, user_constraints b
where a.table_name = b.table_name
and a.constraint_type = 'P'
and b.constraint_type = 'R'
select rpad( '*', (level-1)*2, '*' ) || table_name relation
from temp_constraints
start with fkey_constraint is null
connect by pkey_constraint <> r_constraint_name
and prior pkey_constraint = r_constraint_name;From http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:661009003696#tom69115451356231 -
For for updating database with referential integrity
Hi:
Here is the essence of the problem:
I have created an Access database that I want the fire chiefs
to update. The database is a one to many structure with referential
integrity set. One fire truck has many capabilities. So if Fort
Myers has a truck named 'FM101' and it has several capabilities
such as 1.) pumper, 2.) extrication 3.) Advanced Life Support.
My problem is how to set up a form to do that. In particular,
how do I set up the form so that it will allow the fire chiefs to
input several capabilities at a time for a truck.
I can build a form showing the truck which was obtained from
a pick-list. And I can show another field showing a pick-list for
the capability of that truck (pumper, extrication, ALS, etc). My
question is how do I set up the form to allow the chiefs to input
multiple lines for the many capabilities of that one truck? Right
now I have one input for the truck and one input for the capability
- but I want to enable the user to input as many capabilities as
they feel necessary.
How do I do that?
thanksYou put the capabilities in a multi-select box.
<select name="capabilities" multiple="true">
<option value="capability1">Capability 1</option>
</select> -
Associted two table where referential integrity constraint is present
SELECT A.COLUMN_NAME,A.CONSTRAINT_NAME,B.CONSTRAINT_TYPE,A.TABLE_NAME FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
WHERE A.OWNER=B.OWNER
AND A.OWNER='TEST'
AND A.TABLE_NAME=B.TABLE_NAME
AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME
AND A.TABLE_NAME='CN_SMSC'
from this query we can get name of the column ,const name,type and associated sigle table name.
my question is
==============
how will i get associted two table where referential integrity constraint is presentSELECT A.COLUMN_NAME,A.CONSTRAINT_NAME,B.CONSTRAINT_TYPE,A.TABLE_NAME "Detail Table", b.R_CONSTRAINT_NAME , c.TABLE_NAME "Primary table"
FROM user_CONS_COLUMNS A,user_CONSTRAINTS B, user_constraints c
WHERE A.OWNER=B.OWNER
AND A.OWNER='TEST'
AND A.TABLE_NAME=B.TABLE_NAME
AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME
and b.CONSTRAINT_type ='R'
and c.CONSTRAINT_NAME = b.R_CONSTRAINT_NAME
AND A.TABLE_NAME='CN_SMSC' -
Issue with Referential Integrity check in Oracle VPD Policy
Hi,
Lets assume I have two tables - Customer and Order, with cust_id in Order table referring to primary key of Customer table.
Example Data;
Customer
cust_id Name
1 abc
2 def
3 ghi
Order
Order_id cust_id Order_type
1 1 A
2 2 A
3 1 B
Now I have policies defined on both the tables;
- for "Select, Insert, Update" queries on Customer table.
- for "Select" queries on Order Table.
Policy 1 on Order Table;
Irrespective of the user, predicate = 'Order_type = ''A'''
Policy 2 on Customer Table;
Irrespective of the user, predicate = '(select count(1) from order o where o.cust_id = customer.cust_id and o.order_type = ''B'') > 0'
My intention is to show only those customers who have atleast one order of type 'B'. And this policy works fine in case a user tries to read data from customer table. (for example, record for cust_id = 2 will not be returned as it don't have any orders of type "B")
However, when a user tries to insert record in Order Table, because of the existing referential integrity constraint, the Policy on Customer table is also getting triggered. And an exception is being raised "ORA-28113: policy predicate has error".
Could someone please explain why this is happening ?I'm afraid, there is no such a mean.
At least I do not know about it. -
How to get the list of tables having referential integrity connection
Hi,
I need to know the tables list of having foreign key relationship
means
I've table t1 and t2 and they have foreign key relation and t2 and t3 also having the same like i've almost 20 tables in connection...
So please help me the script to find like above....
Please let me know if i'm not clearThank you for support and i'll try...
And that is:
create table log_table1
( theKey int primary key,
theKey1 int ,
effDate date );
create table log_table2
( theKey int primary key,
theKey1 references log_table1(theKey) ,
effDate date );
create table log_table3
( theKey int primary key,
theKey1 references log_table2(theKey) ,
effDate date ); and tried the following query:
select table_name
from user_constraints
where constraint_type='R'
and r_constraint_name in
(select constraint_name
from all_constraints
where constraint_type in ('P','U')
and table_name='LOG_TABLE1');but getting
TABLE_NAME
LOG_TABLE2but i need to get the output LOG_TABLE2 & LOG_TABLE3 also -
For some strange reason when I modified a form, (commented out some code in a when-window-activated trigger) I now get the following error.
CDG-01141 ERROR: Module Component Table Usage GR1130A.CUSTOMER.GR_CUSTOMER.GC: Table usage GR_CUSTOMER requires primary key column for referential integrity
I am sure this is not related to my change, but do not know what may have caused this or how to fix it.
Anyone seen this error before? been able to fix it?
Thanks!
Windows 7
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
Designer Version 6.5.95.4.8You know that Developer/Designer 6i is not certified for Windows 7, right? Also, your version is not the latest one, so you can try to install the latest patch set first.
>Table usage GR_CUSTOMER requires primary key column for referential integrity
Check if there is a PK in the table definition (not in the database, but in Designer). -
Where statement on two different tables with same column name
Hello,
I have 2 financial tables:
tblincome, tblexpenses
in each table I have column name "monthPayed" (have values of all the months of the year).
I would like to create a balance view table that will show me the financial status for the Q1 (for example).
I have a column totalIncome and totalExpended respectively.
I've create a view table that shows me the financial balance at the moment but I want it to be devide to Quarters of the year...
Regards
Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums. Where is the code you already tried? Or are you so lazy, so rude or so privileged that you did not do anything for yourself?
In fact that silly “tbl-” prefix is so bad that it has a name! It is called Tibbling and Phil Factor even wrote a humor article on bad programmers that use it.
Your narrative is vague; it sounds like this is the DDL:
CREATE TABLE Incomes
(payment_month CHAR(10) NOT NULL PRIMARY KEY,
income_amt DECIMAL(12,2) NOT NULL
CHECK (income_amt > 0.00),
CREATE TABLE Expenses
(payment_month CHAR(10) NOT NULL PRIMARY KEY,
expense_amt DECIMAL(12,2) NOT NULL
CHECK (expense_amt > 0.00),
>> in each table I have column name "monthPayed" (have values of all the months of the year). <<
I hope not! 2014 has not gotten to September, November or December yet! And the ISO-11179 data element name should be “payment_month”; but it is still wrong! An expense is not a payment! An income is not a payment!
>> I would like to create a balance view table that will show me the financial status for the Q1 (for example). <<
Report Period Table
Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
The report period table gives a name to a range of dates that is common to the entire enterprise.
CREATE TABLE Something_Report_Periods
(something_report_name CHAR(10) NOT NULL PRIMARY KEY
CHECK (something_report_name LIKE <pattern>),
something_report_start_date DATE NOT NULL,
something_report_end_date DATE NOT NULL,
CONSTRAINT date_ordering
CHECK (something_report_start_date <= something_report_end_date),
etc);
These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
Now figure it out for yourself, show us what effort you put into this, then we will help you.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Maintaining referential integrity using MS SQL server
Some time ago I posted a question relating to the following extension:
<extension vendor-name="kodo" key="jdbc-delete-action" value="null"/>
Kodo generates a "on delete set null" constraint for this, however ms sql
server does not support this. Since I don't want to matain this referential
integrity in my java code (meaning as soon as an object is deleted, setting
all references to it to null), I tried to implement a custom dictionary with
the default ms sql server solution for this problem: creating a trigger by
overriding the "getAddForeignKeySQL" method. This works fine when creating a
database from scratch using the schema tool, however, when updating an
existing databasebase schema, this is ignored, thereby not solving the
problem of having the database maintenance automated. I suppose I have to
write code for checking whether the trigger already exists. Browsing through
the code, I couldn't figure out how this is done. Can someone give me
suggestions on how to do this (and if this takes a lot of effort).
I also would like to know whether solarmetric has intentions to deal with
this problem in their framework. To be honest, I was quite surprised that
Kodo doesnt take care of this, leaving my database in an inconsistent state.
kind regards,
Christiaan"Abe White" <[email protected]> schreef in bericht
news:caaunu$ecj$[email protected]..
>
I also would like to know whether solarmetric has intentions to dealwith
this problem in their framework. To be honest, I was quite surprisedthat
Kodo doesnt take care of this, leaving my database in an inconsistentstate.
>
Well, I would say that you're the one leaving the database in an
inconsistent state by not keeping your object model consistent :)From the manual:
6.2.2.12. jdbc-delete-action
If a field holds a relation to another object, you can use the
jdbc-delete-action field extension to control the delete action of the
database foreign key that models this relation. Possible values are:
null: Null the column(s) of this foreign key when the related record is
deleted.
It does mean that if the primary key record is deleted, all foreign keys to
the record are set to null, right? Since the jdo framework is about database
independence, not writing sql code (and of course lots more;) and Kodo
supports ms sql server, I would have expected that kodo to set the foreign
key to null if the object is deleted. Even if I do know sql server supports
does not support a 'on delete set null' sql statement;)
>
We have no plans to create triggers at this time.
What do you mean when you say "it is ignored" when you're updating?
Exactly what tool are you running, what actions are you running with, is
the foreign key extension present, and what is the outcome?Like I said, I wrote code in the "getAddForeignKeySQL" in the dictionary, so
a trigger is created when creating the database in the workbench (by running
the schematool). However, if the table already exists, but not the trigger,
refreshing the database from the workbench does not call the
getAddForeignKeySql to add the trigger to the table. -
How to join 2 tables with unequal rows without resulting in a cartesian join
Hello,
This is the first time I have ever posted in any forum so please tell me if I should be doing this better.
Basically I have 2 tables with an unequal number of rows. For demonstration purposes, assume these are my 2 tables:
Table 1:
BaseKey
Letters
A
A
A
B
A
C
B
A
B
B
Table 2:
BaseKey
Numbers
A
1
A
2
B
1
B
2
B
3
I need to join them so that the data would appear like this
BaseKey
Letters
Numbers
A
A
1
A
B
2
A
C
null
B
A
1
B
B
2
B
null
3
Does anyone have any ideas how to do this using T-SQL without creating a cartesian join of 12 rows?
Thanks.>> This is the first time I have ever posted in any forum so please tell me if I should be doing this better. <<
Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums. What you did post is useless! Can you program from it? Neither can we. And we have to do all the extra typing for you.
CREATE TABLE Foo
(base_something CHAR(1) NOT NULL,
something_letter CHAR(1) NOT NULL,
PRIMARY KEY (base_something, something_letter));
INSERT INTO Foo
VALUES ('A', 'A'),
('A', 'B'),
('A', 'C'),
('B', 'A'),
('B', 'B');
CREATE TABLE Bar
(CHAR(1) NOT NULL,
something_digit CHAR(1) NOT NULL,
PRIMARY KEY (base_something, something_digit));
INSERT INTO Foo
VALUES ('A', '1'),
('A', '2'),
('B', '1'),
('B', '2'),
('B', '3');
>> I need to join them so that the data would appear like this
base_something Letters Numbers <<
This looks like you are taking two decks of punch cards and merging them together, without any logical rules, just physical position in their decks relative to the base_something groups.
WITH Foo_Deck
AS
(SELECT base_something, something_letter,
ROW_NUMBER()
OVER (PARTITION BY base_something
ORDER BY something_letter) AS card),
Bar_Deck
AS
(SELECT base_something, something_digit,
ROW_NUMBER()
OVER (PARTITION BY base_something
ORDER BY something_digit) AS card),
SELECT F.base_something, F.something_digit, B.something_letter
FROM Foo_Deck AS F
LEFT OUTER JOIN
Bar_Deck AS B
ON B.base_something = F.base_something
AND B.card = F.card;
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
DRI (declarative referential integrity) and speed improvements.
EDITED: See my second post--in my testing, the relevant consideration is whether the parent table has a compound primary key or a single primary key. If the parent has a simple primary key, and there is a trusted (checked) DRI relation
with the child, and a query requests only records from the child on an inner join with the parent, then sql server (correctly) skips performing the join (shown in the execution plan). However, if the parent has a compound primary key, then sql server
performs a useless join between parent and child. tested on sql 2008 r2 and denali. If anyone can get sql server NOT to perform the join with compound primary keys on the parent, let me know.
ORIGINAL POST: I'm not seeing the join behavior in the execution plan given in the link provided (namely that the optimizer does not bother performing a join to the parent tbl when a query needs information from the child side only AND
trusted DRI exists between the tables AND the columns are defined as not null). The foreign key relation "is trusted" by Sql server ("is not trusted" is false), but the plan always picks both tables for the join although only one is needed.
If anyone has comments on whether declarative ref integrity does produce speed improvements on certain joins, please post. thanks.
http://dinesql.blogspot.com/2011/04/does-referential-integrity-improve.htmlI'm running sql denali ctp3 x64 and sql 2008 r2 x64, on windows 7 sp1. I've tested it on dozens of tables, and I defy anyone to provide a counter-example (you can create ANY parent table with two ints as a composite primary key, and then a child table using
that compound as a foreign key, and create a trusted dri link between them and use the above queries I posted)--any table with a compound foreign key relation as the basis for the DRI apparently does not benefit from referential integrity between those tables
(in terms of performance). Or to be more precise, the execution plan reveals that sql server performs a costly and unnecessary join in these cases, but not when the trusted DRI relation between them is a single primary key. If anyone has seen a different result,
please let me know, since it does influence my design decisions.
fwiw, a similar behavior is true of sql server's date correlation optimization: it doesn't work if the tables are joined by a composite key, only if they are a joined by a single column:
"There must be a single-column
foreign key relationship between the tables. "
So I speculate, knowing absolutely nothing, that there must be something deep in the bowels of the engine that doesn't optimize compound key relations as well as single column ones.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[parent](
[pId1] [int] NOT NULL,
[pId2] [int] NOT NULL,
CONSTRAINT [PK_parent] PRIMARY KEY CLUSTERED
[pId1] ASC,
[pId2] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Children](
[cId] [int] IDENTITY(1,1) NOT NULL,
[pid1] [int] NOT NULL,
[pid2] [int] NOT NULL,
CONSTRAINT [PK_Children] PRIMARY KEY CLUSTERED
[cId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Children] WITH CHECK ADD CONSTRAINT [FK_Children_TO_parent] FOREIGN KEY([pid1], [pid2])
REFERENCES [dbo].[parent] ([pId1], [pId2])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
/* the dri MUST be trusted to work, but it doesn't work anyway*/
ALTER TABLE [dbo].[Children] CHECK CONSTRAINT [FK_Children_TO_parent]
GO
/* Enter data in parent and children */
select c.cId FROM dbo.Children c INNER JOIN Parent p
ON p.pId1 = c.pId1 AND p.pId2 = c.pId2;
/* Execution plan will be blind to the trusted DRI--performs the join!*/ -
Referential integrity based on a view
Hi,
I am having difficulty in trying to build referential integrity based on a view.
I have explained below with an example:
I have a table called 'vehicles' which is the master table.
CREATE TABLE vehicles(
type VARCHAR2(20),
model_number NUMBER(5),
price NUMBER(5),
CONSTRAINT vehicles_pk PRIMARY KEY(type, model_number)
INSERT INTO vehicles(type, model_number, price) VALUES ('CAR', 1, 100);
INSERT INTO vehicles(type, model_number, price) VALUES ('BIKE', 1, 50);
INSERT INTO vehicles(type, model_number, price) VALUES ('CAR', 5, 200);
INSERT INTO vehicles(type, model_number, price) VALUES ('BIKE', 7, 50);
I have a view called 'vu_cars' which lists only the CAR from the table 'vehicles'.
CREATE VIEW vu_cars
AS
SELECT model_number
FROM vehicles
WHERE
type = 'CAR';
I have a table called 'car_properties' which contains the car properties and has referential integrity based on the view 'vu_cars'
-- This create statement throws an error, am I missing something ... ?
CREATE TABLE car_properties(
model_number VARCHAR2(20),
number_of_doors NUMBER(5),
PRIMARY KEY(model_number),
CONSTRAINT vu_cars_fk FOREIGN KEY (model_number) REFERENCES vu_cars(model_number)
-- Actually I wanted to execute the below insert statements, but am stuck with the above create statement of the table car_properties. Is there anyway to resolve this ?
--Below should be inserted correctly:
INSERT INTO car_properties(model_number, number_of_doors) VALUES (1, 4);
INSERT INTO car_properties(model_number, number_of_doors) VALUES (5, 2);
--This should throw an error:
INSERT INTO car_properties(model_number, number_of_doors) VALUES (7, 2);One approach would be to:
1. Add a TYPE column to CAR_PROPERTIES.
2. Add a check constraint on the TYPE column in CAR_PROPERTIES that requires it to equal 'CAR'.
3. Create a foreign key constraint on CAR_PROPERTIES referencing both MODEL_NUMBER and TYPE in VEHICLES. This requires a primary or unique constraint on these two columns in VEHICLES, but you already have one. However, both columns should have the same data type in both tables.
It might look something like this:
SQL> CREATE TABLE vehicles(
2 type VARCHAR2(20),
3 model_number NUMBER(5),
4 price NUMBER(5),
5 CONSTRAINT vehicles_pk PRIMARY KEY(type, model_number)
6 );
Table created.
SQL> INSERT INTO vehicles(type, model_number, price) VALUES ('CAR', 1, 100);
1 row created.
SQL> INSERT INTO vehicles(type, model_number, price) VALUES ('BIKE', 1, 50);
1 row created.
SQL> INSERT INTO vehicles(type, model_number, price) VALUES ('CAR', 5, 200);
1 row created.
SQL> INSERT INTO vehicles(type, model_number, price) VALUES ('BIKE', 7, 50);
1 row created.
SQL> CREATE TABLE car_properties(
2 -- Note new column with both not null and check constraint
3 type VARCHAR2(20) not null check (type = 'CAR'),
4 -- Note change in data type to be the same as vehicles table
5 model_number NUMBER(5) not null,
6 number_of_doors NUMBER(5),
7 PRIMARY KEY(model_number),
8 -- Note new constraint referencing vehicles table
9 CONSTRAINT vehicles_fk FOREIGN KEY (type, model_number) REFERENCES vehicles(type, model_number)
10 );
Table created.
SQL> INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('CAR', 1, 4);
1 row created.
SQL> INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('CAR', 5, 2);
1 row created.
SQL> INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('BIKE', 7, 2);
INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('BIKE', 7, 2)
ERROR at line 1:
ORA-02290: check constraint (TEMP.SYS_C0095831) violated
SQL> INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('CAR', 7, 2);
INSERT INTO car_properties(type, model_number, number_of_doors) VALUES ('CAR', 7, 2)
ERROR at line 1:
ORA-02291: integrity constraint (TEMP.VEHICLES_FK) violated - parent key not
found
SQL> INSERT INTO car_properties(type, model_number, number_of_doors) VALUES (NULL, 1, 4);
INSERT INTO car_properties(type, model_number, number_of_doors) VALUES (NULL, 1, 4)
ERROR at line 1:
ORA-01400: cannot insert NULL into ("TEMP"."CAR_PROPERTIES"."TYPE")Defining a default value for the TYPE column in CAR_PROPERTIES (to set it to 'CAR') might make this approach a little less obtrusive. -
Master data tables with unwanted records from transaction data upload
Hi Friends,
I have a master data table for infoobject 'C' with compounding characteristics 'A' & 'B'. I upload this master data with values given below:
<i><u> A, B, C, Short text, Long text</u></i>
<b> <b>P, 10, BBB, Apple, Big Apples
Q, 20 , XYZ , Tomatoes , Red Tomatoes</b></b>
When I load data into ODS from a source system, I may not necessarily have data for all these 3 fields in these transaction record. Example:
<i><u> A, B, C, D, E</u></i>
<b> P -1 FFF</b> 20 30
<b> Q 10 GGG </b> 10 40
The problem is when I upload the above transaction data, it populates the <b>master data table</b> too with these two new records <b>1 -1 FFF</b> and <b>2 10 GGG</b>, which I would like to avoid.
Is there any way?
Will assign full points to anyone who helps me here.
Thanks,
JBHi JB,
If you want to load transactional data and still want to prevent the population of the master data table, I don't think it is possible, as it is goes aginst the data consistency in the warehouse.
However, if you can afford not to load transactional data for such cases, you can activate referential integrity check for the infoobject C. Then neither transactional data nor masterdata enter the datawarehouse until you maintain masterdata yourself for the infoobject C.
hope this helps. -
Manually maintain master data: check referential integrity?
Dear Experts,
we want to maintain master data via transaction RSA1 oder RSDMD.
Is it possible to enforce referential integrity?
Example:
Infoobject A has attribute Infoobject B
Infoobject B has master data keys
101
103
When maintaining attributes in Infoobject A (with transaction RSDMD) only allow to maintain Infoobject B 101 or 103 but not 102.
Best regards
GregorHi Gregor,
That is because I think you have sected check inegrity box for any particular Object then.....the values which are coming are checked with masterdata table.......if the value are not existing in the masterdata then those records are not updated to the target..............
In your case 102 is not present in A
If still you want to laod then there is one setting
You have activated error handling in the BW scheduler (Tab page Update)
On the Update tab page in the BW scheduler, you have selected the option Always update data, even when no master data exists for the data.
hope it will help.
Regards,
Ganesh BOthe -
Whats is referential integrity
Hi all,
What is referential integerity found in the communication structure ? what is it significance and when do you use in real time scenario. pls explain with an real time scenario.
what is cardinality ? and when shd u used cardinality and cardinality can be only defined in infocubes isnt it? can cardinality be defined in ods ?
thanxs in advance
hariHi Hari,
Referential Integrity: Its a DataBase concept which combines(logically) the data of multiple table with the master table. Here master table has the primary key and rest of the tables have the same key as forienkey.
Here we use the characteristic (or combinations of Chars) call as referential char.
check this.
you might be knowing that generally refrential integrity is concerned with nothing but primary key and foriegn key relationship. Generally we use to check uniqueness of records.
In sap we use it during flexible updation...to check the data records of transaction data and master data.
In other words, to check before loading of data, that whether loading will be properly or not.
we will check(tick) the option in the maintainance of the
infosource--> communication structure
it will be better if you clearly mention your problem, if further help is needed.
http://help.sap.com/saphelp_nw2004s/helpdata/en/3a/14c43bb7137503e10000000a11402f/content.htm
Referential integrity is the property that guarantees that values from one column depend on values from another column.This property is enforced through integrity costraints....
see this link...
http://help.sap.com/saphelp_nw2004s/helpdata/en/6d/117c5fd14811d2a97400a0c9449261/content.htm
Please find the below url
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=referential%20integrity&cat=sdn_all
thanks
@jay
Maybe you are looking for
-
Field validation using distributed form's "Submit Form" built-in function
Hello, I am hoping someone can help me out with a small problem I'm having. I have a hidden field on a form which is the total of other numeric values on the form with code in place so that if the number doesn't equal what it should, the alert box is
-
Can no longer open PDF files in Safari 7 using Mavericks - help??
I cannot open PDF files on my iMac - not sure why - I am using Safari 7 & have downloaded Mavericks - it says I have to launch Acrobat 8 and agree to terms (or some such thing) Please help. How do you make Reader 9 the default for opening pdf's?
-
10.9.2 Reboot loop no Displayport working
Installed 10.9.2 last night, had to revert back to 10.9. Apparently if there is a display connected to the Displayport the system kernel panic. I have 2 display and if I unplug the Led CinemaDisplay from the Displayport it will boot fine on the Dvi c
-
Text (T) symbol for field kostl not found in adhoc query selection
Dear Freinds, We have developed a custom infotype , as per our requirement one of the field i have added is the Kostl field ( this i have created exactly the same way in infotype 0001). I have to devlop a report using ADHOC Query based
-
Changing quantity using bapi_salesorder_change function
hi , i am changing quantity using 'bapi_salesorder_change' function.what are the minimum parameteres that needs to be passsed to the function.i am not able to change the quantity for some items.also for some sales orders i am not getting any error me