Joins-- No primary Key

Hi ,
I have two tables Like
Table A
No Name
1 Emp_001
- Emp_002
2 Emp_003
Table B
No Salary
1 2000
1 3000
2 5000
Thers is no primary key in my table.
Is there s any way to join both a table into a single table.
Thanks in advance...
Cheers,
Shan

Try this..
select a.no, name  , salary from  a, b
where a.no=b.no(+)Regards,
Shijesh

Similar Messages

  • Inner join-select -primary key in table issue

    Hi ,
            Iam using FEBKO(header) and FEBEP(item) in inner join  select .But the datas fetching by this selct in not correct.The analysis is the is no common primary fields in the both table.
    Question 1-> Can i use inner join without common primary key in the both tables, weather it possible to make a select without common primary key in both table. Please kindly let me know.
    Question 2-> What is the other possible way to give the selct for both table(better performance)
    Regards,
    Veera

    Hi,
    When you use INNER JOIN in this case, link your tables based on KUKEY and ESNUM fields, bcoz there can be many items under a single header. So this will work for you, even from the performance point of view.
    Hope this is helpful to you. If you need further information, revert back.
    Reward all the helpful answers.
    Regards
    Nagaraj T

  • Dynamic SQL Joining between tables and Primary keys being configured within master tables

    Team , Thanks for your help in advance !
    I'm looking out to code a dynamic SQL which should refer Master tables for table names and Primary keys and then Join for insertion into target tables .
    EG:
    INSERT INTO HUB.dbo.lp_order
    SELECT *
    FROM del.dbo.lp_order t1
    where not exists ( select *
    from hub.dbo.lp_order tw
    where t1.order_id = t2.order_id )
    SET @rows = @@ROWCOUNT
    PRINT 'Table: lp_order; Inserted Records: '+ Cast(@rows AS VARCHAR)
    -- Please note Databse names are going to remain the same but table names and join conditions on keys
    -- should vary for each table(s) being configured in master tables
    Sample of Master configuration tables with table info and PK Info :
    Table Info         
    Table_info_ID    Table_Name    
    1        lp_order    
    7        lp__transition_record    
    Table_PK_Info        
    Table_PK_Info_ID    Table_info_ID    PK_Column_Name
    2                1    order_id
    8                7    transition_record_id
    There can be more than one join condition for each table
    Thanks you !
    Rajkumar Yelugu

    Hi Rajkumar,
    It is glad to hear that you figured the question out by yourself.
    There's a flaw with your while loop in your sample code, just in case you hadn't noticed that, please see below.
    --In this case, it goes to infinite loop
    DECLARE @T TABLE(ID INT)
    INSERT INTO @T VALUES(1),(3),(2)
    DECLARE @ID INT
    SELECT @ID = MIN(ID) FROM @T
    WHILE @ID IS NOT NULL
    PRINT @ID
    SELECT @ID =ID FROM @T WHERE ID > @ID
    So a cursor would be the appropriate option in your case, please reference below.
    DECLARE @Table_Info TABLE
    Table_info_ID INT,
    Table_Name VARCHAR(99)
    INSERT INTO @Table_Info VALUES(1,'lp_order'),(7,'lp__transition_record');
    DECLARE @Table_PK_Info TABLE
    Table_PK_Info_ID INT,
    Table_info_ID INT,
    PK_Column_Name VARCHAR(99)
    INSERT INTO @Table_PK_Info VALUES(2,1,'order_id'),(8,7,'transition_record_id'),(3,1,'order_id2')
    DECLARE @SQL NVarchar(MAX),
    @ID INT,
    @Table_Name VARCHAR(20),
    @whereCondition VARCHAR(99)
    DECLARE cur_Tabel_Info CURSOR
    FOR SELECT Table_info_ID,Table_Name FROM @Table_Info
    OPEN cur_Tabel_Info
    FETCH NEXT FROM cur_Tabel_Info
    INTO @ID, @Table_Name
    WHILE @@FETCH_STATUS = 0
    BEGIN
    SELECT @whereCondition =ISNULL(@whereCondition+' AND ','') +'t1.'+PK_Column_Name+'='+'t2.'+PK_Column_Name FROM @Table_PK_Info WHERE Table_info_ID=@ID
    SET @SQL = 'INSERT INTO hub.dbo.'+@Table_Name+'
    SELECT * FROM del.dbo.'+@Table_Name+' AS T1
    WHERE NOT EXISTS (
    SELECT *
    FROM hub.dbo.'+@Table_Name+' AS T2
    WHERE '+@whereCondition+')'
    SELECT @SQL
    --EXEC(@SQL)
    SET @whereCondition = NULL
    FETCH NEXT FROM cur_Tabel_Info
    INTO @ID, @Table_Name
    END
    Supposing you had noticed and fixed the flaw, your answer sharing is always welcome.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to get primary keys in some order with joins?

    Hi, I build BBS using BDB as backend database, forum database, topic database and post database share one environment. This BBS web application is multi-thread program. If user selects one forum, its topics will be listed in order of last reply time;selecting one topic, posts are listed in order of reply time as well.
    struct forum {
    UInt16 forumID;
    string forumName;
    string _lastPoster;      // who is the last one replied in this forum
    struct topic {
    UInt32 topicID;
    UInt16 forumID; // topic comes from this forum
    string title; // topic title
    UInt64 dateOfLastReply; // when last reply to this topic happen
    struct post {
    UInt64 postID;
    UInt32 topicID; // post comes from this topic
    string title; // post title as of topic
    UInt64 dateOfPost; // when this post is created
    I create one primary database and two secondary databases for topic, primary key is topicID, secondary key are forumID and dateOfLastReply respectively, and I want to show 1st 25 topics in latest reply time order on the 1st browser page, 2nd 25 topics on the 2nd browser page, and etc.
    if using SQL, it will be: SELECT topicID FROM topic WHERE forumID=xx ORDER BY dateOfLastReply DESC
    From performance perspective, I want get all topics id of one same forum, and need them come in reply time order, then retrieve topic one by one based on returned topicID, how can I do this? guess I have to use joins.
    Plus, do you have any suggestion about retrieval performance given the fact that topics retrieval will happen each time browser want to request the next page, that is, 2nd 25 topics of this forum?
    Is DB_DBT_MULTIPLE helpful to me?
    thanks.
    Edited by: tiplip on 2011-1-22 上午5:43
    Edited by: tiplip on 2011-1-22 下午5:52
    Edited by: tiplip on 2011-1-23 下午7:42

    Hi tiplip,
    Bellow I will describe how you can support "SELECT * FROM table WHERE X = key ORDER BY Y" queries using Berkeley DB, which, as you suspected, should be done by using a composite index.
    First of all, think of Berkeley DB as the storage engine underneath an RDBMS. In fact, Berkeley DB was the first "generic data storage library" implemented underneath MySQL. As such, Berkeley DB has API calls and access methods that can support any RDBMS query. However, since BDB is just a storage engine, your application has to provide the code that accesses the data store with an appropriate sequence of steps that will implement the behavior that you want.
    If you have two indices in SQL, each on a single column (call them X and Y), and you do:
    SELECT * FROM table WHERE X = key ORDER BY Y;then there are three plausible query plans:
    (1) scan the whole table, ignore both indices, filter by X = key then sort by Y;
    (2) use the index on Y to scan all rows in the required order, filter by X = key;
    (3) use the index on X, find the matching rows, then sort by Y.
    There are cases where (1) would be fastest, because it has all of the columns from one scan (the other query plans will do random lookups on the primary for each row). This assumes that the data can fit into memory and the sort is fast.
    Query plan (2) will be fastest if the selectivity is moderate to high, looking up rows in the main table is fast, and sorting the rows is very slow for some reason (e.g., some complex collation).
    Query plan (3) will be fastest if the selectivity is small (only a small percentage of the rows in the table matches). This should be the best case for us, making it the best choice in a Berkeley DB key/value application.
    The optimal plan would result from having a composite index on (X, Y), which can return just the desired rows in the desired order. Of course, it does cost additional time and space to maintain that index. But note that you could have this index instead of a simple index on X: it can be used in any query the simple index could be used in.
    Records in Berkeley DB are (key, value) pairs. Berkeley DB supports only a few logical operations on records. They are:
    * Insert a record in a table.
    * Delete a record from a table.
    * Find a record in a table by looking up its key.
    * Update a record that has already been found.
    Notice that Berkeley DB never operates on the value part of a record. Values are simply payload, to be stored with keys and reliably delivered back to the application on demand. Both keys and values can be arbitrary byte strings, either fixed-length or variable-length.
    So, in case of a "SELECT * FROM X WHERE id=Y ORDER BY Z" query, our suggestion, from Berkeley DB's point of view, would be for you to use a composite index (as it would be in SQL), where a string created as X_Y should do the trick, as explained in the following scenario.
    Primary:
        X Y
    1 10 abc
    2 10 aab
    3 20 bbc
    4 10 bba
    5 20 bac
    6 30 cbaSecondary:
    10_aab 2
    10_abc 1
    10_bba 4
    20_bac 5
    20_bbc 3
    30_cba 6If the query looks like this:
    'SELECT * FROM primarydb WHERE X = 10 ORDER by Y'the application can run a cursor on the secondary and begin the loop with the DB_SET_RANGE flag on 10. When iterating with DB_NEXT, this will return:
    2 10 aab
    1 10 abc
    4 10 bbcThe application must check for the end of the range inside the loop, in this case it should stop when it hits 20_bac.
    As in SQL, retrieving by a secondary key is remarkably similar to retrieving by a primary key and the Berkeley DB call will look similar to its primary equivalent.
    tiplip wrote:
    Plus, do you have any suggestion about retrieval performance given the fact that topics retrieval will happen each time browser want to request the next page, that is, 2nd 25 topics of this forum?As you are concerned about the performance, I think this would be the fastest solution. Of course, you can tune the performance at a later time, after you have the functionality in place. What I think you should do first is to increase the cache size and test with a bigger database page size, and maybe to configure the transactional subsystem (in case you use one).
    If you are not very familiar with how to implement the above in BDB, please read the Guide to Oracle Berkeley DB for SQL Developers, available at: http://www.oracle.com/technetwork/articles/seltzer-berkeleydb-sql-086752.html
    You will also need to be familiar with the following documentation:
    Related documentation pages:
    Secondary indexes - http://download.oracle.com/docs/cd/E17076_01/html/programmer_reference/am_second.html
    Cursor operations - http://download.oracle.com/docs/cd/E17076_01/html/programmer_reference/am_cursor.html#am_curget
    DBcursor->get() - http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/dbcget.html
    DB_SET_RANGE - http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/dbcget.html#dbcget_DB_SET_RANGE
    If my answer helps you with your question, please go ahead and rate it as Helpful or Correct, and the forum thread as answered. For each unrelated question, please create a new forum thread.
    Good luck with building your forum application,
    Bogdan Coman
    PS: If you are a BDB licensed customer, you can also use My Oracle Support (https://support.oracle.com) to visit the KM note 1210173.1, that discusses the same topic.

  • Problem in universe while joining as the primary key is NUMBER

    Hi,
    I'm trying to join TEST.SUMMARY.NUMBER to TEST.RESPONSE.FOREIGN_KEY. The problem arises from the first of these, as the primary key is in a column NUMBER. Stupid? Definitely. Rename? Not an option.
    I think NUMBER is seen as a magic word (type), and once parsing (for example in "edit join", I get the message "Exception: DBD, ORA-01747: invalid user.table.column, table.column, or column specification State: N/A" .
    Normally putting " around the word would do the trick ("NUMBER"), but is seems universe designer removes those during the parsing (?). I come to this conclusion, because if I choose the join line from the graphical menu, and then write to the function line TEST.SUMMARY."NUMBER"=TEST.RESPONSE.FOREIGN_KEY (and press enter), the " are removed. (To get the NUMBER's to the report is good, though, by creating a variable with TEST.SUMMARY."NUMBER")
    The database is oracle, and universe is on BusinessObjecs XI 3.1.  I've tried to join in the edit join, create a derived table and use ANSI92. No good so far. I also tried to join the fields on report (WebI), but the result was always too many or not enough data from one of the tables. Merging dimensions leads to other problems. I was checking on JOIN_BY_SQL as well as PARSE_SELECT_IN_JOIN in universe parameters, but at glance I didn't find how to solve this with them.
    Any ways to force the join, or achieve the data from the both tables in one report table otherwise?

    Well, I managed to sort this out somehow by using custom SQL in the Web Intelligence report, and joining the tables there with
    LEFT JOIN TEST.RESPONSE
    ON TEST.SUMMARY."NUMBER"=TEST.RESPONSE.FOREIGN_KEY
    Smells like duck tape, but it's  working at least somehow. I guess the custom SQL is passed to some lower level, and so the universe-automatic-whatever doesn't handle it in the fly.
    Any other ideas?

  • JOINED inheritance; no primary key joins being generated?

    I'm working with the Sun Application Server version 9. I'm using the javax.persistence APIs in conjunction with EJB3. I've told the app server to generate tables automatically (via toplink; I've set it to drop-and-create tables).
    I have a three-level-deep inheritance hierarchy (like Person extends Party extends BaseObject). BaseObject has its @Inheritance strategy set to JOINED. Everything comes out OK, but I am not seeing any foreign keys being created between the subclass primary keys.
    That is, there is no foreign key that enforces that a Person's PK must refer to a Party's PK, which must, in turn, refer to a BaseObject's PK.
    I've also tried using the @PrimaryKeyJoin annotation, but that doesn't seem to affect the outcome.
    So far this is not a big deal, but I'd like to know if it is a bug in Glassfish/Sun App Server or whether this is by design.
    Thanks,
    Laird

    OK,
    My apologies it seems in the aim of simplifying the explanation of what is
    occuring I missed some important pieces of information. It seems as though
    the redundant joins are only occuring when do a mapping that contains a
    constant value.
    ie
    <field name="classB">
    <jdbc-field-map type="one-one" column.columnA="columnA"
    column.columnB="XXXXXXXX" />
    </field>
    And looking at the Section 7.5 of the reference manual the SQL generated
    has the redundant join also. Can someone explain why the join is necessary
    in these circumstances. All the values of the join columns in tableB are
    known, so why does tableA need to be referenced at all?

  • Query to return list of all missing primary key ids from table T1

    I found this query online that returns a start and stop for a range of all missing primary key id values from table T1. However i want to rewrite this query to return a whole list of all the missing primary key ids and not a start and stop range. any help plz?
    select strt, stp
    from (select m.id + 1 as strt,
    (select min(id) - 1 from T1 x where x.id > m.id) as stp
    from T1 m left outer join T1 r on m.id = r.id - 1 where r.id is null)x where stp is not null

    with t as
              select  1 as id from dual union all
              select  2 as id from dual union all
              select  3 as id from dual union all
              select  5 as id from dual union all
              select  8 as id from dual union all
              select 10 as id from dual union all
              select 11 as id from dual union all
              select 20 as id from dual
    select  id_start + level missing_id
      from  (
             select  id id_start,
                     nullif(lead(id) over(order by id) - 1, id) id_end
               from  t
      start with id_end is not null
      connect by prior id_start = id_start
             and prior dbms_random.random is not null
             and level <= id_end - id_start
    MISSING_ID
             4
             6
             7
             9
            12
            13
            14
            15
            16
            17
            18
    MISSING_ID
            19
    12 rows selected.Or:
    with t as
              select  1 as id from dual union all
              select  2 as id from dual union all
              select  3 as id from dual union all
              select  5 as id from dual union all
              select  8 as id from dual union all
              select 10 as id from dual union all
              select 11 as id from dual union all
              select 20 as id from dual
    select  id_start + level - 1 missing_id
       from  (
              select  min(id) id_start,
                      max(id) id_end
                from  t
       connect by level <= id_end - id_start
    minus
    select  id
       from  t
    MISSING_ID
             4
             6
             7
             9
            12
            13
            14
            15
            16
            17
            18
    MISSING_ID
            19
    12 rows selected.SY.

  • What is the diffrence between Row id and primary key ?

    dear all
    my question is about creating materialized views parameters (With Rowid and
    With Primary kry)
    my master table contains a primary key
    and i created my materialized view as follow:
    CREATE MATERIALIZED VIEW LV_BULLETIN_MV
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT
    BCODE ID, BTYPE BTYPE_ID,
    BDATE THE_DATE,SYMBOL_CODE STOCK_CODE,
    BHEAD DESC_E, BHEADARB DESC_A,
    BMSG TEXT_E, BMSGARB TEXT_A,
    BURL URL, BTIME THE_TIME
    FROM BULLETIN@egid_sefit;
    I need to know is there a diffrence between using (with row id) and (with primary key) on the performance of the query?

    Hi again,
    fast refreshing complex views based on rowids, according to the previous subject.
    (You're example shows that) are not possible.
    Complex remote (replication) snapshots cannot be based on Rowid too.
    for 10.1
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm#sthref5054
    for 10.2
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#sthref6873
    So I guess (didn't check it) that this applies ONLY to replication snapshots.
    This is not documented clearly though (documentation bug ?!)
    Documentation states that the following is generally not possible with Rowid MVIEWS:
    Distinct or aggregate functions
    GROUP BY or CONNECT BY clauses
    Subqueries
    Joins
    Set operations
    Rowid materialized views are not eligible for fast refresh after a master table reorganization until a complete refresh has been performed.
    The main purpose of my statements was to try to give a few tips how to avoid common problems with this complex subject, like for example: being able to CREATE an MVIEW with fast refresh clause does not really guarantee that it will refresh fast in the long run (reorganisation, partition changes) if ROWID based, further the rowid mviews have limitations according to the documentation (no group by, no connect by, link see above) plus fast refresh means only to use filter columnns of the mview logs, plus for aggregates you need additional count (*) pseudo columns.
    kind regards
    Karsten

  • 1-1 mapping Primary Key association problem

    Hi, I have two tables Indiv (Id, col1, col2 ) and IndivExt(Id, col3)....where "Id" is the PKey in both the tables.
    In TopLink, I have mapped
    Indiv table --> IndivClass
    IndivExt table --> IndivExtClass
    class IndivClass{
    Integer Id;
    Integer col1;
    Integer col2;
    class IndivExtClass{
    IndivClass oIndiv; // relation - one-to-one
    Integer col3;
    While running the app, there is an Integrity TopLink exception that says that IndivClass descriptor doesnt have IndivExt table in it.
    So, I used advanced feature of multi-table info and created the Primary Key association between these two descriptors.
    If I am right, This association assumes that there is a row in IndivExt for every row in Indiv...correct me if im wrong. I assume this coz of the kinda sql query it creates when im trying to read a IndivClass object. The sql query uses a join on both the tables.
    But...For every row in Indiv table there MIGHT or MIGHT NOT be a row in IndivExt table.
    So the sql that is formed will not return the required Indiv rows (in case there are no corresponding IndivExt rows).
    How do I resolve this.
    Thanks,
    Krishna

    Hi James,
    Thanx for that update.
    So just for clarification...
    Im going to remove the multi-table info.
    And use normal foreign key reference,
    and apply the patch...then the Integrity error
    should not occur.
    Right ?
    One more question... If I also want to refer IndivExt from the Indiv object...then I would change my classes
    to be like...
    class IndivClass{
    Integer Id;
    Integer col1;
    Integer col2;
    IndivExt oIndivExt; //relation - one-to-one (rel2)
    class IndivExtClass{
    IndivClass oIndiv; // relation - one-to-one (rel1)
    Integer col3;
    and the mapping (for rel2) in IndivClass descriptor will use the same reference that was used by rel1...ie., a normal foreign key ref. Is that right ?
    And also...Is there a bug number related to this issue and how do I get the patch ? Where can I download it from?
    Thanks,
    Krishna

  • Primary keys and foreign keys

    Hi,
    is there a script available for changing the value of a primary key which automaticly
    detect all foreigs keys refering to this primary key and change them as well?
    William Oorschot

    I don't have the script now. but you can make a procedure of ur own.
    using a join on user_constraints, and user_cons_columns you can find out all the columns in all the tables which are referencing the particular primary key. once you have the table and the referencing columns, you can change the value of those columns with the new value.
    you'll have to call this procedure from a before row level trigger.
    HTH
    Naveen

  • Null in Composite Primary Key and "Primary keys must not contain null"

    Hello all.
    I'm a newbie concerning to JPA/EJB3, but I was wondering if toplinks doesn't support composite primary keys with null in some field (something perfectly right in any RDBMS).
    I used JDeveloper (I'm using Oracle 10g database and JDeveloper 10.1.3.2.) wizards to generate JPA classes and I checked out generated files (with annotations), so they should be right (by the way, other O-R mappings for my model are working right, but this one).
    I'm getting the next error:
    Exception Description: The primary key read from the row [DatabaseRecord(
         TSUBGRUPOSLDI.CD_GRUP => 01
         TSUBGRUPOSLDI.CD_SUBGRUP => null
         TSUBGRUPOSLDI.CG_POBL => 058
         TSUBGRUPOSLDI.CG_PROV => 28
         TSUBGRUPOSLDI.DSCR => Sanidad)] during the execution of the query was detected to be null. Primary keys must not contain null.
    Compound primary key is (CD_GRUP, CD_SUBGRUP). No foreign keys, no joins (only a NamedQuery: "select o from ..."). It's the simplest case!
    I checked out that everything runs ok if there's no "null" value in CD_SUBGRUP.
    After some research (this and other forums) I'm beginning to believe that it's not supported, but not sure.
    Am I doing sth wrong? If not, what is the reason to not support this? Will it be supported in the future?
    Thanks in advance.

    Null is a special value and in many databases is not comparable to another null value (hence the isNull operator) and may pose problems when used to uniquely identify an Entity. TopLink does not support null values within a composite PK. As the nullable column is most likely not designated as a PK within your database table (many databases do not allow this) I recommend updating the Entity PKs to match that of the database.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Key in View  for two primary keys tables

    Hi
    I have some view joining LIKP and LIPS:
    LIKP -   Primary Key MANDT, VBELN
    LIPS -   Primary Key MANDT, VBELN, POSR
    The Key for the LIKP-LIPS View is:
    MANDT      LIKP
    VBELN       LIKP
    MANDT_I    LIPS
    VBELN_I    LIPS
    POSNR_I   LIPS
    So, for that Key, if i need to acces a specify LIPS detail record , must i fill all the keys in the where  (filling VBELN twice) like this:
    WHERE VBELN =  vbvalue AND VBELN_I =  vbvalue AND POSNR_I = posvalue ?
    How must i make the Select for acces this View using its Key ?
    Regards
    Frank

    Hi
    Just as I said:
    SELECT SINGLE * FROM Z<VIEW> WHERE VBELN = <VBELN>
                                                                AND POSNR_I = <POSNR>.
    Anyway it's should be better you correct the view deleting the field MANDT_I, VBELN_I, if you can't, I believe the select above works fine.
    VIEW FIELDS:
    View Field Table Field Key
    MANDT LIKP MANDT Yes
    VBELN LIKP VBELN Yes
    <b>MANDT_I LIPS MANDT Yes <----- WRONG
    VBELN_I LIPS VBELN Yes      <----- WRONG</b>
    POSNR_I LIPS POSNR Yes
    ERNAM LIKP ERNAM
    ERDAT LIKP ERDAT
    VKORG LIKP VKORG
    PSTYV_I LIPS PSTYV
    MATNR_I LIPS MATNR
    WERKS_I LIPS WERKS
    LGORT_I LIPS LGORT
    By this defintion the field MANDT and VBELN are only twice, but it doesn't mean the record is double in the VIEW.
    So it you have the delivery 100 with 3 items in the client 200, in the view you'll see:
    Record 1: MANDT   = 200
                   VBELN    = 0000000100
                   MANDT_I = 200
                   VBELN_I  = 0000000100
                   POSNR_I = 000010
    Record 2: MANDT   = 200
                   VBELN    = 0000000100
                   MANDT_I = 200
                   VBELN_I  = 0000000100
                   POSNR_I = 000020
    Record 3: MANDT   = 200
                   VBELN    = 0000000100
                   MANDT_I = 200
                   VBELN_I  = 0000000100
                   POSNR_I = 000030
    Max

  • Primary Key Materlized View and primary key in master tables

    We are using Oracle 11g2 and I created a materlized view on several master tables. The master tables all have primary key, but I did not include all primary key columns in the defining query.
    According to Oracle Manual e10592 Specify WITH PRIMARY KEY to create a primary key materialized view. This is the default ....
    The master table must contain an enabled primary key constraint, and the defining query of the materialized view
    must specify all of the primary key columns directly.My MV created OK and works. My question is what can be the impact on my MV? Could it hit the performance. It takes 40 minutes for the MV to be created and 5 minutes to refresh for single row insert in each mater table. I would like to see it refresh in seconds.

    Retrieving rows from the mview is purely a function of the number of rows and indexing on the mview itself. Refreshing the mview wall time depends on the quality of the query used to refresh the mview. Whether you include PKs from the source table in the mview is of little, or no, consequence here. What matters is the execution path of the refresh query. Is there proper indexing on the underlying tables to support the joins. Did you use mlog$_s to enable fast refresh - are mlog$_s even usable for your mview. There are a number of possible causes to your problem and we do not have enough information to make an estimate of the problem.
    BTW, if the mview could refresh in seconds w/o mlog$_s, you probably do not need an mview.

  • How to commit primary key in a multi level form

    Hi ,
    I am using Jdeveloper 10.1.2.3. ADF - Struts jsp application.
    I have an application that has multiple levels before it finally commits, say:
    Level 1 - enter name , address, etc details -- Master Table Employee
    Level 2 - Add Education details -- Detail Table Education
    Level 3 - Experience -- Detail Table Experience.
    Level 4 - adding a Approver -- Detail Table ApplicationApproval
    In all this from Level 1 I generate a document number which is the primary key that links all these tables.
    Now if User A starts Level 1 and moves to level 2,he gets document no = 100 and then User B starts Level 1 and also gets document no = 100 because no commit is executed.
    Now I have noticed that system crashes if User B calls a vo.validate().
    How can I handle this case as Doc no is the only primary key.

    Hi,
    This is what my department has been doing even before I joined and its been working for our multi user environment for these many years.
    We have a table called DOC_SRNO which will hold a row for our start docno , next number in running sequence. the final number. We have this procedure that returns next num to calling application and increments the next num by 1 in the table. and final commit on the application commits all this.
    I am not sure how this was working so far but each of those applications were for different employees. I am assuming this is how it worked.
    Now in the application that I am working on, has no distinct value. So two users could generate the same docno and proceed.
    I will try the DB sequence but here is what I tried. I call the next num from DOC_SRNO and I commit this table update and then proceed with this docno so at a time both gets different docno's.
    But my running session crashes when I go to next level to insert into the detail table of my multi level form. Here when I try to get the current row from the vo which is in context, it crashes.
    Here's the steps.
    Three tables : voMainTable1 and voDetailTable1 and voDetailTable2.
    voMainTable1 on create row1- I generate new docno - post changes
    voMainTable1 on create row2- I genrate another docno - post changes
    set voMainTable1 in context
    Now I call voDetailTable1 and to get the docno to join master detail, I try to get voMainTable1.getCurrentRow. Here it crashes.
    How can I avoid this

  • How do I let user enter a primary key value on a form

    I'm creating my first APEX application. I have a simple table called HOSTS with 2 columns HOSTNAME and IP_ADDRESS. HOSTNAME is the primary key for the table. HOSTNAME is a perfectly acceptable primary key and I don’t wish to create an additional column to be populated by a sequence.
    What are my options for creating a form on the table without using "Existing trigger", "Custom PL/SQL function" or "Existing Sequence" to populate the primary key column, i.e. HOSTNAME, so that the user can enter a value for the primary key?
    Any assistance greatly appreciated.
    Gavin

    The debate about natural keys versus surrogate keys
    will no doubt continue with advocates for both sides.
    However there is also a difference between
    'making your life easier' for APEX development and
    'making your life more difficult' by having to
    analyse, implement and deploy a surrogate key only
    approach to an existing database which employs both
    natural keys and surrogate keys.
    hould we be forced to change the database design
    because a development tool does not cater for natural
    primary keys?The application development product is TRYING to save you from shooting yourself in the foot. The idea is to separate the primary key from being accessed by the user or ANY carbon based unit.. The key is mainly used by the system to join and lookup data rows, not for people to change whenever they decide that the key is WRONG.
    Think about this, if you use Last Name as a key in your system (a bad idea to begin with since this is NOT a unique id when you have two Smiths). When a person needs to change this because Jimmy Smith is NOT the only Smith working for Acme Toys, you have to cascade that change through all the child tables related to the main person table.
    If instead you use a system generated key, no change will be required since the key has NO relation to the data other than it represents a pointer to that row of data.
    Works for me, since I do not want to write all the supporting code when APEX builds it for you...
    Thank you,
    Tony Miller
    UTMB/EHN

Maybe you are looking for

  • Z87-G45 Gaming not able to install Win7 x64 with Samsung 840 EVO

    I have a brand new: i5 4570 MSI Z87-G45 Gaming 250GB Samsung 840 EVO 1x 8GB Corsair ValueRam DDR3 1600 I got everything hooked up properly, but I am not able to install Win7 x64 through an USB pen drive (Kingston Datatravel 32GB USB3) I have a proper

  • Auto tab to next form field

    In some forms, when the user types in, for example, the area code for   their phone number, they are automatically tabbed to the cell for the 3   digit prefix and upon completing the prefix they are automatically tabbed to the final cell for the phon

  • Warning Unresponsive script on Resume from Hibernation Kubuntu 10.04

    Frequently I put my computer into hibernation so I can view webpages without an internet connection. I will put my computer into hibernation, then disconnect it and sometime later resume the computer. What I find is that every time I resume the compu

  • 9i for intel solaris

    from where to download oracle 9i for intel solaris version 5.8 please help thanks in advance.

  • How to find who has changed SQL Server Agent 'Job History' settings.

    Hi all, I was searching from couple of days to know is there a way to find out who has changed the SQl agent property settings. Like if someone unchecks the SQL Agent History settings how i can find who has done that change? I searched for trace flag