Foreign-key autocreation in child table giving issue in the application
Hi,
I am facing an issue with partitioning a table that foreign key relationship is created on the original table with interim table. This gives exception in the application because of its existence. Please suggest me how to get rid of this issue.
Let's say my table T_TABLENAME has to be partitioned. It has a child table T_CHILD_TABLENAME which references (FK_T1) ID column of T_TABLENAME.
While partitioning, COPY_TABLE_DEPENDENTS function copies/creates the key/index/trigger objects for the interim table. [I need copy_constraints => TRUE in COPY_TABLE_DEP call], Fine.
But, after partitioning is done, the foreign key (TMP$$_FK_T1) object exists with the child table which should absolutely not happen as this forms dependency with interim table as well along with parent table.
Here my script goes:
i) Creating interim table
CREATE TABLE T_TABLENAME_PT
PARTITION BY RANGE (CREATED_DATE)
(PARTITION P_2007 VALUES LESS THAN (TO_DATE('01-JAN-2008','dd-MON-yyyy')),
PARTITION P_2009 VALUES LESS THAN (TO_DATE('01-JAN-2010','dd-MON-yyyy')),
PARTITION P_2011 VALUES LESS THAN (TO_DATE('01-JAN-2012','dd-MON-yyyy')),
PARTITION P_2012 VALUES LESS THAN (TO_DATE('01-JAN-2013','dd-MON-yyyy')),
PARTITION P_RECENT VALUES LESS THAN (MAXVALUE))
AS SELECT * FROM T_TABLENAME WHERE 1=2;
ii) Partitioning Script
declare
v_username varchar2(50);
v_exception varchar2(220);
l_num_errors PLS_INTEGER;
v_source_table varchar2(35) := 'T_TABLENAME';
v_interim_table varchar2(35) := 'T_TABLENAME_PT';
BEGIN
select USERNAME into v_username from USER_USERS where rownum <= 1;
begin
DBMS_REDEFINITION.CAN_REDEF_TABLE(v_username, v_source_table, DBMS_REDEFINITION.CONS_USE_PK);
DBMS_REDEFINITION.START_REDEF_TABLE(
uname => v_username,
orig_table => v_source_table,
int_table => v_interim_table);
DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS(
uname => v_username,
orig_table => v_source_table,
int_table => v_interim_table,
copy_indexes => 1,
copy_triggers => TRUE,
copy_constraints => TRUE,
copy_privileges => TRUE,
ignore_errors => TRUE,
num_errors => l_num_errors);
DBMS_REDEFINITION.SYNC_INTERIM_TABLE(v_username, v_source_table, v_interim_table);
begin
DBMS_REDEFINITION.FINISH_REDEF_TABLE(
UNAME => v_username,
ORIG_TABLE => v_source_table,
INT_TABLE => v_interim_table);
EXCEPTION
WHEN OTHERS THEN
DBMS_REDEFINITION.ABORT_REDEF_TABLE(
UNAME => v_username,
ORIG_TABLE => v_source_table,
INT_TABLE => v_interim_table);
end;
exception
when others then
v_exception :=substr(SQLERRM,1,150);
end;
exception
when others then
v_exception := substr(SQLERRM,1,175);
END;
Thanks for your information. I am using Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit.
1) I am logging the exceptions in a logger table.
2) If CAN_REDEF_TABLE gives exception, flow goes to the final EXCEPTION block and program terminates. So if no exceptions, the other steps comes into the flow of execution.
Complete Details
(1) Parent Table (existing): T_SOH_SUBREQ_INSTALLATION_ADDR
create table T_SOH_SUBREQ_INSTALLATION_ADDR
ACCOUNT_ADDRESS_ID NUMBER(10),
SUBREQ_ADDRESS_ID NUMBER(10) not null,
COMMUNITY_ID NUMBER(10),
STREET_ID NUMBER(10),
BUILDING_ID NUMBER(10),
CREATED_USER_ID VARCHAR2(40) not null,
MODIFIED_USER_ID VARCHAR2(40) not null,
CREATED_DATE TIMESTAMP(6) not null,
MODIFIED_DATE TIMESTAMP(6) not null,
DELETION_STATUS CHAR(1) not null
alter table T_SOH_SUBREQ_INSTALLATION_ADDR
add constraint PK_T_SOH_SUBREQ_INST_ADDR primary key (SUBREQ_ADDRESS_ID);
alter table T_SOH_SUBREQ_INSTALLATION_ADDR
add constraint FK_T_SOH_SUBREQ_INSTALLATIO624 foreign key (ACCOUNT_ADDRESS_ID)
references T_SOH_ACCT_INSTALLATION_ADDR (ACCOUNT_ADDRESS_ID);
(2) Child Table (existing): T_SOH_SUBREQ_LINKED_INST_ADDR
create table T_SOH_SUBREQ_LINKED_INST_ADDR
CREATED_DATE TIMESTAMP(6) not null,
CREATED_USER_ID VARCHAR2(40) not null,
MODIFIED_DATE TIMESTAMP(6) not null,
MODIFIED_USER_ID VARCHAR2(20) not null,
DELETION_STATUS CHAR(1) not null,
SUBREQ_ADDRESS_ID NUMBER(10) not null,
SUBREQUEST_ID NUMBER(10) not null,
CIRCUIT_POINT NUMBER(10)
alter table T_SOH_SUBREQ_LINKED_INST_ADDR
add constraint PK_T_SOH_SUBREQ_LINK_INST_ADDR primary key (SUBREQ_ADDRESS_ID, SUBREQUEST_ID);
alter table T_SOH_SUBREQ_LINKED_INST_ADDR
add constraint FK_T_SOH_SUBREQ_LINKED_INST626 foreign key (SUBREQ_ADDRESS_ID)
references T_SOH_SUBREQ_INSTALLATION_ADDR (SUBREQ_ADDRESS_ID);
(3) Partitioning is done on Parent Table
CREATE TABLE T_TMP_PARTITION_LOGS
LOG_MSG VARCHAR2(250),
LOG_TIME TIMESTAMP(6)
CREATE TABLE T_SOH_SUBREQ_INSTALL_ADDR_PT
PARTITION BY RANGE (CREATED_DATE)
(PARTITION P_2007 VALUES LESS THAN (TO_DATE('01-JAN-2008','dd-MON-yyyy')),
PARTITION P_2009 VALUES LESS THAN (TO_DATE('01-JAN-2010','dd-MON-yyyy')),
PARTITION P_2011 VALUES LESS THAN (TO_DATE('01-JAN-2012','dd-MON-yyyy')),
PARTITION P_2012 VALUES LESS THAN (TO_DATE('01-JAN-2013','dd-MON-yyyy')),
PARTITION P_RECENT VALUES LESS THAN (MAXVALUE))
AS SELECT * FROM T_SOH_SUBREQ_INSTALLATION_ADDR WHERE 1=2;
insert into t_tmp_partition_logs(log_msg,log_time) values('01_CreateTable: T_SOH_SUBREQ_INSTALL_ADDR_PT Table Created', systimestamp);
(4) Script for REDEFINITION
declare
v_username varchar2(50);
v_exception varchar2(220);
l_num_errors PLS_INTEGER;
v_source_table varchar2(35) := 'T_SOH_SUBREQ_INSTALLATION_ADDR';
v_interim_table varchar2(35) := 'T_SOH_SUBREQ_INSTALL_ADDR_PT';
v_file_name varchar2(20) := '02_Redefine';
BEGIN
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name || '.sql --> Starts', systimestamp);
select USERNAME into v_username from USER_USERS where rownum <= 1;
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name || ': UserName-'|| v_username, systimestamp);
begin
DBMS_REDEFINITION.CAN_REDEF_TABLE(v_username, v_source_table, DBMS_REDEFINITION.CONS_USE_PK);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': '|| v_source_table ||' After CAN_REDEF_TABLE', systimestamp);
DBMS_REDEFINITION.START_REDEF_TABLE(
uname => v_username,
orig_table => v_source_table,
int_table => v_interim_table);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': '|| v_source_table ||' After START_REDEF_TABLE', systimestamp);
DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS(
uname => v_username,
orig_table => v_source_table,
int_table => v_interim_table,
copy_indexes => 1,
copy_triggers => TRUE,
copy_constraints => TRUE,
copy_privileges => TRUE,
ignore_errors => TRUE,
num_errors => l_num_errors);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': '|| v_source_table ||' After COPY_TABLE_DEPENDENTS - l_num_errors:' || l_num_errors, systimestamp);
DBMS_REDEFINITION.SYNC_INTERIM_TABLE(v_username, v_source_table, v_interim_table);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': After SYNC_INTERIM_TABLE on '|| v_source_table, systimestamp);
begin
DBMS_REDEFINITION.FINISH_REDEF_TABLE(
UNAME => v_username,
ORIG_TABLE => v_source_table,
INT_TABLE => v_interim_table);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': After FINISH_REDEF_TABLE on '|| v_source_table, systimestamp);
EXCEPTION
WHEN OTHERS THEN
DBMS_REDEFINITION.ABORT_REDEF_TABLE(
UNAME => v_username,
ORIG_TABLE => v_source_table,
INT_TABLE => v_interim_table);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': Aborted '|| v_source_table, systimestamp);
end;
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||': '|| v_source_table ||' redefined', systimestamp);
exception
when others then
v_exception :=substr(SQLERRM,1,150);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||'-EXCEPTION:'|| v_source_table ||'-' || v_exception, systimestamp);
end;
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||'.sql <-- Ends', systimestamp);
exception
when others then
v_exception := substr(SQLERRM,1,175);
insert into t_tmp_partition_logs(log_msg,log_time) values(v_file_name ||'-EXCEPTION:' || v_exception, systimestamp);
END;
==> NOW THE ISSUE
My child table T_SOH_SUBREQ_LINKED_INST_ADDR is having another foreign key column TMP$$_FK_T_SOH_SUBREQ_LIN4 with the interim table T_SOH_SUBREQ_INSTALL_ADDR_PT.
Similar Messages
-
Finding foreign keys of a child table,grandchild and all dependendents
Hi All,
I just came up with this sceanrio
I have to delete a record in a parent table with a condition provided will have to find all the child tables depends on it and should recursively find all the dependents of the child table.
How to achieve this.Please help with a query or guide.Thanks in advanceThanks visakh it gave me an idea and this script helped me
DECLARE @mytable VARCHAR(30) SET @mytable = 'test'
DECLARE @RecordID VARCHAR(8)
SET @RecordID = '00000001'
DECLARE @Order INT SET @Order = 0
DECLARE @Count INT
declare @tblname varchar(100),@query NVARCHAR(max)
if OBJECT_ID('tempdb..#OrderList','U') is not null
DROP TABLE #OrderList
CREATE TABLE #TEMP
OrderNo INT,
TableName VARCHAR(50)
CREATE TABLE #OrderList
RecordNo INT,
OrderNo INT,
TableName VARCHAR(50)
INSERT INTO #TEMP
VALUES ( @Order,
@mytable )
WHILE ( EXISTS(SELECT TableName
FROM #TEMP
WHERE OrderNo = @Order) )
BEGIN
SET @Order= @Order + 1;
INSERT INTO #TEMP
SELECT @Order,
t1.TABLE_NAME AS PointsFrom
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS r
JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t1
ON t1.CONSTRAINT_NAME = r.CONSTRAINT_NAME
JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t2
ON t2.CONSTRAINT_NAME = r.UNIQUE_CONSTRAINT_NAME
WHERE t2.table_name IN (SELECT TableName
FROM #TEMP
WHERE OrderNo = ( @Order - 1 ))
END
INSERT INTO #OrderList
SELECT Row_number() OVER (ORDER BY OrderNo, TableName),
#TEMP.OrderNo,
#TEMP.TableName
FROM #TEMP
DROP TABLE #TEMP
--SELECT * FROM #OrderList
SET @Count = (SELECT Max(RecordNo)
FROM #OrderList)
WHILE (@Count <> 0 )
BEGIN
select @tblname = TableName FROM #OrderList WHERE RecordNo = @Count
select @query = 'DELETE from '+ @tblname
select @query
exec sp_executesql @query
SET @Count = @Count-1
END -
Foreign Keys for a Logical Table
Hi All,
I want to know in which scenarios we create the Foreign Keys for a Logical Table. Once we create the foreign key for the logical table, does it mean that it will automatically override if any joins are there.
Physical Table A, B ( no physical joins)
Logical Table A, B (logical join B(Dim)-->A(Fact))
created the foreign key in logical table A with B .(A.1=B.1)
Will the rpd generate sql with A.1=B.1 join condition for reports.
I tried to create the logical foreign key for logical table A, I could not see any corresponding table option.Here is its snapshot
http://tinypic.com/r/jq1gkz/6
Thanks,
ViratIn general when we go complex joins in Physical layer we go for Logical foreign key joins in BMM layer, best examples is SCD Type-II.
Physical Table A, B ( no physical joins)
-->You need to have a physical join so that this can be override by BMM layer
created the foreign key in logical table A with B .(A.1=B.1) Will the rpd generate sql with A.1=B.1 join condition for reports.
-->Yes you can see this join in BI Physical query.
I tried to create the logical foreign key for logical table A, I could not see any corresponding table option.Here is its snapshot
-->2 cases: 1)You need to delete existing logical joins 2) You might not have join in physical layer.
Hope this helps
Let me know for issues
Edited by: Srini VEERAVALLI on Jan 18, 2013 1:29 PM
BTW: You got very good name, why dont you update in your profile to see your name instead of some number
Edited by: Srini VEERAVALLI on Jan 18, 2013 1:29 PM -
Adding a foreign key to an access table
I have set up two tables in access and I am using SQL insert
with the form to populate the database. When I “submit”
the form I receive the following error:
Element CUST_ID is undefined in CUSTOMER_INFO.
The error occurred in
C:\Inetpub\wwwroot\spl_web_site\public_records\order_insert.cfm:
line 23
21 : <cfquery datasource="#odbc_datasource#"
name="desc">
22 : insert into rec_results (customer_info.cust_id,rec_desc)
23 : values('#customer_info.cust_id#',
24 : '#rec_desc#')
25 : </cfquery>
How do I get cust_id into the second table to be used as the
foreigh key when it “has not been created (defined)” in
the first table?If your cust_id is an autonumber primary key field in your
first table, then you will have to create that record first, then
retrieve the primary key value to be used as your foreign key in
your second table, especially if you have foreign key constraints
on the table. This is normal relational database behavior, since it
isn't really possible to have a child if there is no parent. In
this case, you will need some sort or SELECT between your two
inserts in order to determine the newly created cust_id. Or, you
may need some other means of gerating your unique PK value for
cust_id outside of Access. If you do the SELECT method, you would
do something like SELECT MAX(cust_id) FROM customer_info (assuming
that cust_id is generated sequentially), and you should enclose all
three database transactions within CFTRANSACTION tags so that you
don't accidentally grab the wrong cust_id from another simultaneous
transaction.
Phil -
Create foreign keys to delete child records
I am unfamiliar with foreign keys, I have 3 tables one is the parent table if a record is deleted in the parent table I would like the record to be deleted from the child record but I think that I am also confused about which should be the parent table
(purpose is to use in a form)
parent table (i think)
AdminEntry table
entryid ,
date1,
date1desc,
date2,
date2desc,
date3,
date3desc
In a form each date and its description is placed in the following table
CalendarEntry table
calendarid,
date,
datedesc
entryid (fk)?
so CalendarEntry will have many entries at least 3 from one entryId, this I get but what if I want to delete lets say date2 and date2desc record. If I delete it from AdminEntry table how will calendarEntry table know which one to delete?
Please help very confused.
(the other table also inserts to the CalendarEntry table)There is a demo of this functionality in Morgan's Library at www.psoug.org under Foreign Keys.
Look for ON DELETE CASCADE. -
Multiple foreign keys to a single table
Hi,
I need to write an SQL sentence to bring a unique row formed from multiple foreign keys which are dependent on the same table. The two tables as follow:
CREATE TABLE UNIDADMEDIDA (
IDUNIDADMEDIDA NUMERIC(3) NOT NULL,
DESCRIPCION VARCHAR2(128) NOT NULL,
CONSTRAINT PKUM PRIMARY KEY(IDUNIDADMEDIDA)
CREATE TABLE TRANSPORTE (
IDBOLETA NUMERIC(12) NOT NULL,
CORRELAVEHICULO NUMERIC(2) NOT NULL,
TIPOVEHICULO NUMERIC(1),
TIPOGASOLINA NUMERIC(1),
CANTIDAD NUMERIC(8),
RECORRIDOPROMEDIO NUMERIC(10,2),
IDUMRECORRIDO NUMERIC(3),
CONSUMOPROMEDIO NUMERIC(10,2),
IDUMCONSUMOPROM NUMERIC(3),
CONSUMOTOTALANUAL NUMERIC(10,2),
IDUMCONSUMOTOT NUMERIC(3),
CONSTRAINT PKTRANSPORT PRIMARY KEY(IDBOLETA, CORRELAVEHICULO),
CONSTRAINT FKUMRECORRI FOREIGN KEY(IDUMRECORRIDO) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA),
CONSTRAINT FKUMCONSUMO FOREIGN KEY(IDUMCONSUMOPROM) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA),
CONSTRAINT FKUMCONSTOT FOREIGN KEY(IDUMCONSUMOTOT) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA)
The columns IDUMRECORRIDO, IDUMCONSUMOPROM and IDUMCONSUMOTOT depend on the table UNIDADMEDIDA (specifically from the IDUNIDADMEDIDA field). I need to bring back the description (DESCRIPCION field) from the different values stored in TRANSPORTE table.
Thanks for your help!!!
MarioWelcome to the forum!
Have you thought about joining against the parent table three times to pick up each different description?
SELECT <COLUMN LIST>
, UNI_A.DESCRIPCION
, UNI_B.DESCRIPCION
, UNI_C.DESCRIPCION
FROM TRANSPORTE
JOIN UNIDADMEDIDA UNI_A ON UNI_A.IDUNIDADMEDIDA = TRANPORTE.IDUMRECORRIDO
JOIN UNIDADMEDIDA UNI_B ON UNI_B.IDUNIDADMEDIDA = TRANPORTE.IDUMCONSUMOPROM
JOIN UNIDADMEDIDA UNI_C ON UNI_C.IDUNIDADMEDIDA = TRANPORTE.IDUMCONSUMOTOT
;It is always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
You provided #2 partially. If you provide the rest we may be able to help you even further. -
Questions about creating a foreign key on a large table
Hello @ll,
during a database update I lost a foreign key between two tables. The tables are called werteart and werteartarchiv_pt. Because of its size, werteartarchiv_pt is a partitioned table. The missing foreign key was a constraint on table werteartarchiv_pt referencing werteart.
Some statistics about the sizes of the mentioned tables:
werteart 22 MB
werteartarchiv_pt 223 GB
werteartarchiv_pt (Index) 243 GB
I tried to create the foreign key again, but it failed with the following error (Excuses for the german error message):
sqlplus ORA-00604: Fehler auf rekursiver SQL-Ebene 1
sqlplus ORA-01652: Temp-Segment kann nicht um 128 in Tablespace TEMPS00 erweitert
The statement I used:
alter table werteartarchiv_pt
add constraint werteartarchiv_pt_fk1
foreign key (schiene, werteartadresse, merkmale)
references werteart (schiene, werteartadresse, merkmale)
on delete cascade
initially deferred deferrable;
So the problem seems to be, that Oracle needs a lot of temporary tablespace to generate the foreign key and I do not know how much and why.
My questions now are, and hopefully someone is here, who can answer all or a part of it:
1) Why does Oracle need temporary tablespace to create the foreign key? The foreign key uses the same columns like the primary key.
2a) Is it possible to tweak the statement without using the temporary tablespace?
2b) If it is not possible to avoid the usage of the temporary tablespace, is there a formula how to calculate the needed temporary tablespace?
3) Is it possible to modify data in the tables while the foreign key is created or is the whole table locked during the process?
Any help or hint is appreciated.
Regards,
BjoernRollinHand wrote:
My questions now are, and hopefully someone is here, who can answer all or a part of it:
1) Why does Oracle need temporary tablespace to create the foreign key? The foreign key uses the same columns like the primary key.Because it's validating the data to ensure the foreign key won't be violated. If you had specified ENABLE NOVALIDATE when creating it then the existing data in the table wouldn't need to be checked and the statement should complete instantly (future data added would be checked by the constraint).
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/general005.htm
Search for "Enable Novalidate Constraint State" -
Two foreign keys in one single table
i have a table 'customers' with a 'customerid' as its primary key and another table 'drinks' with a primary key 'drinkid'.now i have to create a table 'customerdrink' with its primary key as 'customerdrinkid' , and 'customerid' & 'drinkid' as
its two foreign keys.how can i write the script in sql server to connect the first two tables with the last one ie how can i relate one primary key(customerdrinkid) with two foreign keys(customerid and drinkid) in a single query?pls help me out!!!>> I have a table 'customers' ...<<
How nice for you, but where is the DDL? Oh, I see you are the Great and Wonderful “shubha2323” who does not have to follow Netiquette or treat anyone with minimal respect when he demands they do his work him!
Where is what you already tried? Oh, the Great and Wonderful “shubha2323” does not try anything! His forum slaves should serve him!
Do you understand how rude you are when you ignore the basic forum rules?
CREATE TABLE Customers
(customer_id CHAR(16) NOT NULL PRIMARY KEY,
CREATE TABLE Drinks
(drink_id CHAR(10) NOT NULL PRIMARY KEY,
>> with a customer_id as its primary key and another table Drinks with a primary key drink_id. now I have to create a table 'customer_drink' with its primary key as 'customer_drink_id' <<
You do not know what single quotes mean in ANSI/ISO Standard SQL, or how to follow ISO-11179 Standards for data element names. And this is a stupid idea. You have a key!! Do you know what a key is?
CREATE TABLE Drink_Preferences
(customer_id CHAR(16) NOT NULL
REFERENCES Customers(customer_id)
ON DELETE CASCADE,
drink_id CHAR(10) NOT NULL
REFERENCES Drinks(drink_id)
ON DELETE CASCADE,
PRIMARY KEY (customer_id, drink_id),
etc
Stop posting until you have manners and you have read a book on RDBMS.
--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 -
SSAS 2008 Linking two cubes on the foreign key between two fact tables
Hi, all --
I have two cubes:
Cube 1 has Fact1 (F1, "Events") and 3 dimensions (D1, D2, D3)
Cube 2 has Fact2 (F2, "Sales") and 3 dimensions (D4, D1, D6)
As you can see, two cubes reuse D1 as their common dimension. In addition, F2 foreign keys into F1, e.g. F1 is "Events", and F2 is "Sales". Every "sale" is an "event", but not every "event" is
a "sale".
The question is, how to I link the two cubes and their two respective fact tables on the foreign key?
Thanks, Austin.Hi Austin,
According to your description, you want to retrieve data from two different cubes, right? In Analysis Services, to query multiple cubes from a single MDX statement you can use the LOOKUPCUBE function (you can't specify multiple cubes in your FROM statement).
The LOOKUPCUBE function will only work on cubes that utilize the same source database as the cube on which the MDX statement is running. For the detail information about it, please refer to the link below to see the blog.
Retrieving Data From Multiple Cubes in an MDX Query Using the Lookupcube Function
If I have anything misunderstood, please point it out.
Regards,
Charlie Liao
TechNet Community Support -
DBAT Child table Reconciliation issue
I have the following environment
IDM 11gR2 (11.1.2.1) Activedirectory-11.1.1.5.0, Database_App_Tables_9.1.0.5.0. Target Database Oracle 11gR2.
I have created a DBAT connector for the Target Database that is having One Master Table and One Child table.
The issue is that the Target reconciliation doesn’t work.
If I run the reconciliation with a single target table it works fine (setting up a new connector for test) but if I run a reconciliation with a target that is having a child table as well it fails.
Summry:
Reconciliation of a target DB with Master-Child Tables is not working.there is an existing issue with child table recon in oim11gr2
http://docs.oracle.com/cd/E27559_01/relnotes.1112/e35820/id_mgr.htm#CHDDGDCC
Raise SR to oracle -
Foreign Keys and import of tables (ORA-02297)
How can i get all the foreign keys for a particular schema, basically i'm trying to import tables into a particular schema so i'm trying to disable the constraints, truncate the table , import data and then enable the constraints.
but i'm having error like these when i disable all the constraints in this particular schema
Table altered.
alter table STANDINGS disable constraint P_STANDINGS
ERROR at line 1:
ORA-02297: cannot disable constraint (SCDAT.P_STANDINGS) - dependencies exist
alter table STANDPMTS disable constraint P_STANDPMTS
ERROR at line 1:
ORA-02297: cannot disable constraint (SCDAT.P_STANDPMTS) - dependencies existI use a dynamic SQL-Plus script to generate all the constraints for a schema. I then run this SQL to disable the constraints. Sometimes need to run the script more than once depending on the order the constraints are disabled. Once your scripts runs clean, then you can truncate your tables, import your data, and re-enable constraints.
To re-enable, just use and editor to do REPLACE DISABLE WITH ENABLE....
Here is sample of my dynamic sql. Needs to be run as SYSDBA...
set heading off;
spool c:\disable_constraints.sql;
select 'ALTER TABLE ' || owner || '.' || table_name || ' DISABLE CONSTRAINT ' || constraint_name || ';'
from dba_constraints
where owner = '<owner_name>';
spool off;
Hope that helps.. -
Multiple foreign key joins between two tables
Hi,
I have a question about building a repository.
I have a date dimension and one fact. The fact table has about 10 foreign key columns that link to the date Dimension.
In this case should I create 10 aliases to create joins in the Physical and BMM layer or is there any other way to handle this situation.
I am asking this question because 10 aliases can get very confusing for me at the later point of time while creating reports.
Using OBIEE 10.1.3Hi
I have a follow up question on this.
I am okay with not seeing the different date tables under the Subject area. Even if it just shows a it as a Simple DATE Dimension I am good with it.
In this case which is the efficient way, creating 10 aliases or creating 10 joins in the physical layer. I just figured out that we can create multiple joins between the same set of two tables but do not know how will that effect the way BI server works.
Please help me in understanding this concept.
thanks
This request id for OBIEE 10.1.3 -
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. -
Adobe Version 9: Memory Leak Issue causing the application to crash .
We are facing an issue with Adobe Acrobat Reader Version 9. The application is getting crashed with an unhandled system exception (Access violation reading location 0x1003a24e).
Our application is a .NET Windows based application, where we are using webbrowser control to view the pdf files.
The application works fine with Adobe Version 8 and 10. But there is an issue specific to Version 9, even described in the Adobe Forum
We tried using CoFreeUnusedLibraries Function on the form close event of the document viewer as a work around, but it didn’t help.
The client is not willing to move to the Adobe Reader Version 10. Can anyone facing similar issue with Adobe Version 9, please assist.
Thanks,
DevWe are having the same issue. Have you found a way to fix this or to work around it?
Thank you,
Susan -
Creation of table or grid in the application
Hi,
Can we create a table or grid in the front end to display some values selected from some multiselect list or a list manager... or is there any other way to do the same.. Help me
Regards,
PaAn Oracle table is different from front-end table/grid.
Maybe you are looking for
-
Send to home screen doesn't work
I used to be able to pull up a web page in Safari, then press the arrow and it would give me: "send to home screen" as an option. Now all I get is "add bookmark, add to reading list, mail link, tweet or print".... Any ideas? using new OS5 and all up
-
how can I access randon to java object file thanks
-
Mantain a Session in one application after opening another application
Hi My Requirements is like this.. I have one ear apllication running in one place.. We we click a link on this applcation it has to open up a third party application in another widow., and session in the current application has be maintained until th
-
Programmatically Add Formatted AutoCorrect: Outlook Word Excel
There are many posts available regarding the addition of AutoCorrect entries, formatted or not, using VB or PowerShell. These have been very helpful in my efforts to give marketing what they want: a helping-hand to ensure that users are using proper
-
I have just recently lost use of 2 USB ports and my isight camera. My keyboard works fine, but there is not any indication of connections when probing USB in "About this MAC". I have rebooted, executed a PRAM reset, and reloaded my OS, but to no av