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!!!
Mario

Welcome 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • 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

  • 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.3

    Hi
    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

  • Update query with multiple foreign key parameters

    I am trying to perform an update query on one field that uses multiple foreign key parameters from one table to update the other table. The data in all three foreign key parameter fields are not constant. Accuracy is absolutely critical. I tied this as well as other various scenarios with no success. Can anyone help?
    Update A_table a
    set a.rate = (
    select b.rate
    from B_table b
    where b.id = a.id
    and b.transdate = a.transdate
    and b.orgnum = a.orgnum
    and b.transdate = to_date('31/12/2007', 'dd/mm/yyyy')
    )

    I would check symbols by a user name and number of posts before calling anyone a hot shot, especially damorgon.<br><br>
    Yes version matters (due to bugs and features in each version).<br>
    DDL matters because of indexes and associations.<br>
    Data matters because it makes a difference on how SQL can be written.<br>
    Reasons why an SQL statement don't work is because we aren't looking over your shoulder at your screen.<br><br>
    damorgon did leave off his list that the best place for this question is on the PL/SQL, where they will ask you similar questions in addition to your explain plan and data volumes.

  • 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,
    Virat

    In 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

  • 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

  • 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,
    Bjoern

    RollinHand 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"

  • Multiple Date Keys in a Fact Table

    Do you guys see a problem with having multiple date keys (all date keys are referencing one date demension table) on a fact table?
    RESERVATION_DATE_KEY
    SHIP_DATE_KEY
    CONTRACT_DATE_KEY
    SHIP_DATE_KEY
    CANCEL_DATE_KEY
    APPLICANT_KEY
    BRANCH_KEY
    ENLST_CAT_KEY

    Nope, this is 100% natural for the type of fact table you are building. Happens all the time.
    Scott
    use the "role" to define the multiple ways the time dime is used.

  • 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 exist

    I 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..

  • 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.

  • I need to have multiple foreign keys on one column, can Designer do this?..

    Basically I've a table that needs to link to three other tables. As far as I can tell Designer will only let me have the foreign keys on seperate columns;
    Column_1 - FK1
    Column_2 - FK2
    Column_3 - FK3
    I think it's a much better database design is to have all three link to one column and have a Type column denoting which table to references
    Column_1 - FK1, FK2, FK3
    Column_2 - Type (FK1, FK2, FK3)

    Can you tell us more about the problem you're trying to solve?
    Thanks, George

  • Multiple clob fields in a single table

    Are there any known performance issues associated with having 4 CLOB fields in a single table... the table as such will be relatively small.. like 100 MB... with most rows being << 50k.

    Not really. If you need 4 CLOB columns and it makes sense to have alll the columns in a single table, go for it.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to remove multiple components border inside a single table column cell

    Hi,
    I'm adding multiple components to a table cell. To provide a good layout I'm using the following component hierarchy in a table column - table-->groupPanel--> gridPanel-->staticText Components 1 ..2 ..3. Now when I do preview in browser or run the app, the table shows up fine, but textComponent s(1,2,3) in the column are each surrounded by a border (which is the width of gridPanel border). Is there a way to get rid of this border?
    This only occurs when you add multiple components in table cell, under gridpanel layout component.
    I've tried searching for a way to remove the grid pane layout component border but couldn't find any info. Used style class border setting to not set but that doesn't help either. I checked forums, tutorial, learning sections etc., but no success. Any help or direction is appreciated..
    Thanks
    -Vinod

    Hi ,
    Can you please post the query ..what u have tried ...
    SQL&gt; select sub from coa1;
    SUB
    XY
    XY
    XY
    XY
    XY
    HXY
    HXY
    HXY
    8 rows selected.
    SQL&gt; select obj from coa1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    8 rows selected.
    SQL&gt; SELECT OBJ FROM COA1
    2 UNION ALL
    3 SELECT SUB FROM COA1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL&gt; insert into coa2 (obj)
    2 (
    3 SELECT OBJ FROM COA1
    4 UNION ALL
    5 SELECT SUB FROM COA1
    6 );
    16 rows created.
    SQL&gt; select * from coa2;
    OBJ SUB MCU DOC F
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ SUB MCU DOC F
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL&gt;
    i tried the same it worked fine .....
    so u can combine select and insert statements .. you can get the required result.....!
    Thanks
    Ananda
    Edited by: Ananda on Feb 2, 2009 7:38 PM
    Edited by: Ananda on Feb 2, 2009 7:52 PM

  • Insert items from two different Multiple Select Lists into a single table

    I need help. I have a training tracking system that tracks the courses taken by employees.
    I have created two multiple select lists, one is SelectEmployees and the other is SelectCourses. I want to insert
    the selected item from those two multiple select lists into Training_Record table.
    Note, SelectEmployees" is from Employee table and SelectCourses is from Courses table. Those two table has no intersetion.
    Train_Record is the table that joins those two together.
    Please advice and your help is appreciate.

    Thank you for your help.
    I tried your code and changed the table/field name to my actual table/field name and the iitem name to actual item name.
    declare
    cursor c_Employees is
    select PERSONNEL_NEW.EMPLOYEEID from PERSONNEL_NEW where PERSONNEL_NEW.EMPLOYEEID in (:P15_SELECTEDEMP);
    cursor c_Courses is
    select COURSES.COURSE_ID from COURSES where COURSES.COURSE_ID in
    (:P15_SELECTEDCOUR);
    begin
    foreach :=r_employee in c_Employees loop
    foreach :=r_course in c_Courses loop
    insert
    into COPYOFTRAINREC ( EMPLOYEEID, COURSEID )
    values ( r_employee.EMPLOYEEID, r_course.COURSE_ID );
    end loop;
    end loop;
    end;
    I got error message as :
    ORA-06550: line 12, column 25: PLS-00103: Encountered the symbol "C_EMPLOYEES" when expecting one of the following: (
    Error
    OK

Maybe you are looking for

  • Start up app won't go away!

    I've had my iBook G4 for about a year, and I've never had one iota of a problem until more recently. At my college we were required to have Sophos anti-virus (or something like that) on all personal computers connected to the network, so they provide

  • It policy application control

    Hey, i need some help with removing my applications. Whenever i try to the error pops up and says: It policy application control. When i try to delete the module stuff it says that to. I personally have never ben involved in any company or IT network

  • Upgrading from Apex 3.2.1 (mod_plsql) to Apex 4.0 with Oracle Listener

    Hi, We have some applications developed in Apex 3.2.1 (which is mod_plsql) that have not been moved into Production yet. We are planning to upgrade to Apex 4.0 with Oracle Listener as soon as they are available (we don't want to turn on mod_plsql on

  • Best audio format for Flash Video?

    Someone is doing a voiceover and she said she can send the file to me in whatever format I need it in. Would anyone know what the best one would be that would be the best quality and easiest to work with in Flash/After Effects? I'm on a Mac, btw. Tha

  • How Order Status is updated in O2A PIP cartridge

    Hi I was trying to understand the flow of PIP cartridge.I want to know how the updateSalesOrder notification is sent to CRM in the code,As I could see there is no specific updatesalesOrder task that will send order update after each milestone(like In