Partition key on non primary key column

I have scenario where the table has defined non primary key column as "partition key".
I was wondering how it will affect the purge/archive process if the index and table are using different column (they are not aligned)?
What should be the solution to this scenario?
Can I use the non primary key column as partition key? Is this affect purging/archiving or switching -IN or OUT partitions?
Here is the article which Im following but didn't get the precise answer:
"When the indexes and the table use the same partitioning function and columns in the same order, the table and index
are aligned." 
https://msdn.microsoft.com/en-US/library/ms345146%28v=SQL.90%29.aspx?f=255&MSPPError=-2147217396#sql2k5parti_topic9
Look at "Index
Partitioning" and "Defining
the Partitioning Key" section.
ZK

If it non aligned, you cannot do switching in or out.  to switch, you should have aligned partitons.
Hope it Helps!!

Similar Messages

  • Selection criteria based on non-primary key columns in Custom-SQL

    Hi all,
    Could anybody please tell me how to perform a search using non-primary key columns, The query is written in Workbench under Custom Sql --> Read Object. The Query goes something like this
    select * from Employee where firstName like #name
    where firstName is a Non-primary key column.
    The Java Code goes like this
    Employee empm = new Employee();
    empm.setFirstName("John");
    Employee employees = (Employee) session.readObject(empm);
    This does not fetch me any values . I dont want the queries to be written in any java class. Is there Any other way to do it ??

    Hi all,
    Could anybody please tell me how to perform a
    search using non-primary key columns, The query is
    written in Workbench under Custom Sql --> Read
    Object. The Query goes something like this
    select * from Employee where firstName like #name
    where firstName is a Non-primary key column.
    The Java Code goes like this
    Employee empm = new Employee();
    empm.setFirstName("John");
    Employee employees = (Employee)
    session.readObject(empm);
    This does not fetch me any values . I dont want the
    queries to be written in any java class. Is there Any
    other way to do it ??I dont think you have set it up the right way to do what you want to do. You need to click on "Queries" on the Employee Descriptor and then Named Queries and then give a name for a named query and then choose ReadObjectQuery under type and then choose SQL under Format. Enter the custom SQL and then export the project xml file.
    Then in your application logic you have to call this named query the usual way.
    Employee employee = (Employee)session.executeQuery("findEmployeeByName,Employee.class,args);
    where args is a vector containing the name of the Employee.

  • Fast Refresh using two non-primary key tables

    Hi,
    I have a materialized view based on two tables with an outer join clause. Both the tables do not have a primary key so I had created materialized view log with row-id on each of them but still I am not able to bring out the fast refresh option for the materialized view. My question is can I have a fast refresh option for materialized view built from two tables without primary keys and having an outer join clause????. If possible please send me some sample scripts for quicker understanding.
    Thanks and Regards,
    Sudhakar

    I was able to create a fast-refreshable MV, on tables without any PK. Unfortunately, I can't complete all the steps since my setup is a multi-master advanced replication (which ABSOLUTELY requires the tables to have PK's). Here are anyway the steps I took. Note that ORA102 is my (definition) master site, and MVDB is my MV site. The tables were created under user HR, and my master group is called "hr_repg". Here are my steps:
    HR on ora102 >create table countries_no_pk as select * from countries;
    Table created.
    HR on ora102 >create table regions_no_pk as select * from regions;
    Table created.
    HR on ora102 >create materialized view log on countries_no_pk with rowid;
    Materialized view log created.
    HR on ora102 >create materialized view log on regions_no_pk with rowid;
    Materialized view log created.
    REPADMIN on ora102 >exec dbms_repcat.suspend_master_activity('hr_repg')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:02.68
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.CREATE_MASTER_REPOBJECT (
    3 gname => 'hr_repg',
    4 type => 'TABLE',
    5 oname => 'countries_no_pk',
    6 sname => 'hr',
    7 use_existing_object => TRUE,
    8 copy_rows => FALSE);
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:05.19
    REPADMIN on ora102 >set timing off
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.CREATE_MASTER_REPOBJECT (
    3 gname => 'hr_repg',
    4 type => 'TABLE',
    5 oname => 'regions_no_pk',
    6 sname => 'hr',
    7 use_existing_object => TRUE,
    8 copy_rows => FALSE);
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    (note that you ABSOLUTELY need the rowid's in your select statement for an MV with joins):
    MVIEWADMIN on mvdb >CREATE MATERIALIZED VIEW hr.complex_mv refresh fast as
    2 select c.rowid "C_ROW_ID", r.rowid "R_ROW_ID", c.COUNTRY_ID, c.COUNTRY_NAME,
    3 c.REGION_ID, r.REGION_NAME from hr.regions_no_pk@ora102 r, hr.countries_no_pk@ora102 c
    4 where c.region_id = r.region_id (+);
    Materialized view created.
    MVIEWADMIN on mvdb >BEGIN
    2 DBMS_REPCAT.CREATE_MVIEW_REPOBJECT (
    3 gname => 'hr_repg',
    4 sname => 'hr',
    5 oname => 'complex_mv',
    6 type => 'SNAPSHOT',
    7 min_communication => TRUE);
    8 END;
    9 /
    PL/SQL procedure successfully completed.
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT (
    3 sname => 'hr',
    4 oname => 'countries_no_pk',
    5 type => 'TABLE',
    6 min_communication => TRUE);
    7 END;
    8 /
    PL/SQL procedure successfully completed.
    (wait when the entries in DBA_REPCATLOG is empty)
    REPADMIN on ora102 >exec dbms_repcat.resume_master_activity('hr_repg')
    Hope that can help you. If that doesn't work, tell us where it bombs.
    Daniel

  • How shall we do validation for Unique Key and Multiple Primary Key?

    Hi,
    I have table created From EO in which one column is checked as Unique.
    How to do validation for column checked as Unique.
    I know how to do validation for column checked as primary key.
    Below is sample code for primary key validation
    if (getRvSize() != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_NO_UPDATE"); // Message name
    if (value != null)
    OADBTransaction transaction = getOADBTransaction();
    Object[] rvKey = {value};
    EntityDefImpl rvDefinition = xxczVAGCSRVSizingEOImpl.getDefinitionObject();
    xxczVAGCSRVSizingEOImpl rv =
    (xxczVAGCSRVSizingEOImpl)rvDefinition.findByPrimaryKey(transaction, new Key(rvKey));
    if (rv != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_UNIQUE"); // Message name
    What changes need to be done for above code in order to do the validation for Unique Key.
    I have one more Question
    How shall we do the Validation for Multiple Primary Key in a table?
    - Mithun

    1. If you just validate on one attribute like your unique key, then put your logic in the set<Your AttributeName) method
    2. If you want to do the cross validation ( like validating multiple attributes) then put your logic in the validateEntrity Method
    How to do that?
    1. Create a Validation View object.
    2. Associate your VVO to the VAM
    3. Create entity expert.
    4. Have method in entity expert for your validation (you would be calling AM and then VO execute the query and do the validation.
    5. You would be calling the Entity experty method from your EO either setMethods or validateEntity.
    I have given just the high level points.
    Hope this helps.
    Thanks,
    RK

  • Can the Primary Key also be Primary key in another table

    Hi all,
    I am working on a project. The project specification says:
    Project table contains details of projects and the project number *(proj_no)* is the key.
    project ( proj_no , proj_date, proj_desc, proj_type, proj_status, s_no, cust_no)
    purchase_order table contains details of the purchase orders for each project and the combination of project
    number and a purchase order number *(proj_no, po_no) form the key.*
    purchase_order ( proj_no , po_no, po_date)
    How can I have proj_no in the project table and in the purchase_order as primary keys?
    If I create a composite key in the purchase_order table making the ( proj_no, po_no) as primary key. How can I make the project_no in the project table a primary key too?
    Is there a solution for it?
    CREATE TABLE purchase_order(
    po_no NUMBER(5) NOT NULL,
    proj_no NUMBER(5) NOT NULL,
    po_date date,
    CONSTRAINT p_o_po_no_proj_no_pk PRIMARY KEY (po_no,proj_no));
    Thanks!!!

    Hi,
    I think I'd set the project no in the projects table a primary key, and project no in the purchase orders table a foreign key constraint to the projects table, combined with a unique, not null constraint in the table.
    That, in addition to a unique, not null constraint on the purchase orders column, and a composite primary key should fulfill the requirements.
    Best of luck!
    Johan

  • Two foreign keys reference on primary key

    There are two tables:
    1) table CALENDAR with primary key: cal_id
    2) table FACTS with some columns, two of them are dates: cal_id_start_process, cal_id_stop_process
    we want on physical layer create two foreign keys for cal_id_start_process and cal_id_stop_process columns reference on CALENDAR.cal_id
    When we create foreign key for cal_id_start_process: we choose this column and choose CALENDAR table and its primary key. But when we want to create foreign key for cal_id_stop_process - we cannot coose table CALENDAR again.
    Is this rigth, that only one column from table can reference on specified primary key in CALENDAR table?
    How to create two foreign key on one table primary key?

    More complex. In your example there'll be such SQL:
    select c.cal_id, f.cal_id_start, f.cal_id_stop
    from CALENDAR c, FACTS f
    where c.cal_id = f.cal_id_start and c.cal_id = f.cal_id_stop
    (It meens FACTS.cal_id_start = FACTS.cal_id_stop )
    In my case, I want for such join:
    select c1.cal_id, c2.cal_id, f.cal_id_start, f.cal_id_stop
    from CALENDAR c1, CALENDAR c2, FACTS f
    where c1.cal_id = f.cal_id_start and c2.cal_id = f.cal_id_stop
    Edited by: annylut on Dec 22, 2011 3:33 PM

  • TIPS(9):PARENT-CHILD(FOREIGN KEY) 관계를 갖는 MASTER TABLE의 PRIMARY KEY 확인.

    제품 : SQL*PLUS
    작성날짜 : 1996-10-21
    TIPS(9) : PARENT-CHILD관계를 갖는 TABLE의
    PRIMARY key, FOREIGN key의 COLUMN 명과 POSITION 확인
    ==============================================================
    ** Name : Show_Position.Sql
    ** Usage : @Show_Positions Parent_Table Child_Table
    ** Description : Shows Primary And Foreign Key Positions
    ** WARNING : 이 문장은 해당 Table의 Constraint생성시 Naming
    ** Convention을 따른 경우에 적용되도록 되어 있다.
    SET VERIFY OFF
    CLEAR BREAK
    BREAK ON CONSTRAINT_NAME ON TABLES
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,15) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&1')
    AND CONSTRAINT_NAME LIKE 'PK%'
    UNION
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,25) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&2')
    AND CONSTRAINT_NAME LIKE 'FK%'
    ORDER BY 1 DESC , 4 ASC;
    < 실행 예 >
    SQL> @SHOW_POSITIONS EMP_SERVICE EMP_SERVICE_LOG
    CONSTRAINT_NAME TABLES COL_NAME POS
    PK_EMP_SERVICE EMP_SERVICE EMP_ID 1
    CUST_ID 2
    FK_EMP_SERVICE_LOG_EC EMP_SERVICE_LOG EMP_ID 1
    CUST_ID 2

    제품 : SQL*PLUS
    작성날짜 : 1996-10-21
    TIPS(9) : PARENT-CHILD관계를 갖는 TABLE의
    PRIMARY key, FOREIGN key의 COLUMN 명과 POSITION 확인
    ==============================================================
    ** Name : Show_Position.Sql
    ** Usage : @Show_Positions Parent_Table Child_Table
    ** Description : Shows Primary And Foreign Key Positions
    ** WARNING : 이 문장은 해당 Table의 Constraint생성시 Naming
    ** Convention을 따른 경우에 적용되도록 되어 있다.
    SET VERIFY OFF
    CLEAR BREAK
    BREAK ON CONSTRAINT_NAME ON TABLES
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,15) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&1')
    AND CONSTRAINT_NAME LIKE 'PK%'
    UNION
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,25) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&2')
    AND CONSTRAINT_NAME LIKE 'FK%'
    ORDER BY 1 DESC , 4 ASC;
    < 실행 예 >
    SQL> @SHOW_POSITIONS EMP_SERVICE EMP_SERVICE_LOG
    CONSTRAINT_NAME TABLES COL_NAME POS
    PK_EMP_SERVICE EMP_SERVICE EMP_ID 1
    CUST_ID 2
    FK_EMP_SERVICE_LOG_EC EMP_SERVICE_LOG EMP_ID 1
    CUST_ID 2

  • NullPointerException when deleting from table with no non-primary keys

    We have an object mapped to a table in our database.
    This table has two fields that together form a composite key. When we attempt to perform a delete from this table using the mapped object we receive the following exception and stack trace:
    java.lang.NullPointerException
    at oracle.toplink.descriptors.FieldsLockingPolicy.getAllNonPrimaryKeyFields(Unknown Source)
    at oracle.toplink.descriptors.AllFieldsLockingPolicy.getFieldsToCompare(Unknown Source)
    at oracle.toplink.descriptors.FieldsLockingPolicy.buildExpression(Unknown Source)
    at oracle.toplink.descriptors.FieldsLockingPolicy.buildDeleteExpression(Unknown Source)
    at oracle.toplink.internal.descriptors.ObjectBuilder.buildDeleteExpression(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.buildDeleteStatement(Unknown Source)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.prepareDeleteObject(Unknown Source)
    at oracle.toplink.internal.queryframework.StatementQueryMechanism.deleteObject(Unknown Source)
    at oracle.toplink.queryframework.DeleteObjectQuery.execute(Unknown Source)
    at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
    at oracle.toplink.tools.profiler.PerformanceProfiler.profileExecutionOfQuery(Unknown Source)
    at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
    at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
    at oracle.toplink.internal.sessions.CommitManager.deleteAllObjects(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.commit(Unknown Source)
    <snip remainder of stack trace>
    The table definition for our table is as follows:
    PK,FK TASK_ID NUMBER NOT NULL
    PK,FK USER_ID NUMBER NOT NULL
    Each field is a foreign key to another table, however this is not a join table for a many to many relationship.
    The mapping definition for the mapped object is as follows:
    public Descriptor buildProConSubscriptionDescriptor( )
    Descriptor descriptor = new Descriptor( );
    descriptor.setJavaClass( mil.usmc.mol.procon.domain.ProConSubscription.class );
    descriptor.addTableName( "PRO_CON_SUBSCRIPTION" );
    descriptor.addPrimaryKeyFieldName( "PRO_CON_SUBSCRIPTION.TASK_ID" );
    descriptor.addPrimaryKeyFieldName( "PRO_CON_SUBSCRIPTION.USER_ID" );
    // Descriptor properties.
    descriptor.useNoIdentityMap( );
    descriptor.setIdentityMapSize( 1000 );
    descriptor.useRemoteNoIdentityMap( );
    descriptor.setRemoteIdentityMapSize( 1000 );
    descriptor.setAlias( "ProConSubscription" );
    descriptor.useAllFieldsLocking( );
    // Query manager.
    descriptor.getQueryManager( ).checkDatabaseForDoesExist( );
    //Named Queries
    // Event manager.
    // Mappings.
    DirectToFieldMapping taskIdMapping = new DirectToFieldMapping( );
    taskIdMapping.setAttributeName( "taskId" );
    taskIdMapping.setGetMethodName( "getTaskId" );
    taskIdMapping.setSetMethodName( "setTaskId" );
    taskIdMapping.setFieldName( "PRO_CON_SUBSCRIPTION.TASK_ID" );
    descriptor.addMapping( taskIdMapping );
    DirectToFieldMapping userIdMapping = new DirectToFieldMapping( );
    userIdMapping.setAttributeName( "userId" );
    userIdMapping.setGetMethodName( "getUserId" );
    userIdMapping.setSetMethodName( "setUserId" );
    userIdMapping.setFieldName( "PRO_CON_SUBSCRIPTION.USER_ID" );
    descriptor.addMapping( userIdMapping );
    return descriptor;
    Any thoughts as to why this is happening?
    Thanks,
    Andrew Lee

    Hi Andrew,
    AllFieldsLocking isn't designed for this since you have an object that's composed entirely of primary data. You should make use of any other of TopLink's locking policies to make this work. For instance, try useChangedFieldsLocking(), pessimistic or any of the optimistic locking strategies available from within TopLink for this to work based on the design you have outlined.
    Darren

  • Getting total on the basis of non-primary key.

    Hi Experts,
    Iam having an internal table it_ekpo which is having material group(matkl),plant(werks) and net order value(netwr).
    My requrement is to get the total sum of NETWR against a particular plant which may have duplicates.
    I need to get the plant and total of net order value(netwr) into a internal table to display.
    please help me out.

    Hi,
    Yes it wont give you any output as in AT NEW, AT END etc. the fields values to the right of the key field(means the first field in the intrenal table ,which is also used for sorting) are not accisisble, so to access the values of all the fields to the right of the WERKS should be outside the AT----endat loop.
    Moreover SUM functionality wont work on 'netwr' because of the above reason only,so i guess i have given you the code snnipet try to use it , I hope this might help you out.
    One correction: rather thna taking the 4rth variable for sum you can print the local variable containing the sum in AT-end -endat loop,rather than appending in the internal table.
    PS: WERKS should be the first field in the intrenla table, to sort the table on the basis of werks and to be used in AT-endat. loop.
    AT END OF WERKS.
    SUM.
    ULINE.
    WRITE: / 'Sum',
    WA_EKPO1-NETWR UNDER WA_EKPO1-NETWR. "value of netwr is not accesible in this
    SKIP.
    ENDAT.
    Pooja

  • Two foreign keys to one primary key

    I'm having trouble displaying information for two foreign keys in my table. My goal is to display the first and last name of both a Project Manager and Account Manager. I have a "Jobs" table linked to an "Employees" table.
    Jobs
    ProjectMgrID
    AcctMgrID
    Employees
    EmployeeID
    LastName
    FirstName
    Both ProjectMgrID(fk) and AcctMgrID(fk) are linked to EmployeeID(pk). When I build a query, I am not sure how to display both the FirstName and LastName fields for both. It only allows me to add them once, and when I add them twice it just displays the same information twice.
    Please help!

    Welcome to the forum!
    It looks like you'll need to join to EMPLOYEES twice.
    Something like the following:
    SELECT  e1.firstname
    ,       e1.lastname
    ,       e2.firstname
    ,       e2.lastname
    FROM    jobs
    JOIN    employees e1    ON e1.employeeid = jobs.projectmgrid
    JOIN    employees e2    ON e2.employeeid = jobs.acctmgrid
    ;

  • Updation of table records having 5-6 primary key columns.

    I have a table structure having 12 primary composite keys.I have created report + form on this table.My requirement is to update the table by using form items fields.I am taking help of url option on report attribute page of application to fetch data on form page when we click on edit link of report page.Now i am having two problems which are as follows:-
    (i)I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys.I tried to create Pl/SQL process which will run update query but this process is not updating values.Is there any way that i could fetch data direct from database table in query rather then taking item values.Is there any other workaround?
    (ii)One of the primary key column contains records which have ' , ' in them .For ex:- cluth,bearing.So when i get navigated to edit page i am only getting text displayed as clutch i.e. text before ',' is getting displayed in text field while comma and the text after this is not getting displayed in text field of form page.
    Any solutions will be very helpful.
    Thanks
    Abhi

    Hello Abhi,
    >> I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys
    APEX wizards support a composite PK with up to 2 segments only. For every other scenario, you’ll have to manually create your DML code.
    If you have control over your data model, I would listen very carefully to Andre advices. Using a single segment PK is the best practice way. If you can’t add PK to your table, it seems that you’ll have to write your own DML code. The Object Browser option of creating a Package with methods on database table(s) can be a great help.
    >> … I am taking help of url option … One of the primary key column contains records which have ' , ' in them …
    Using the f?p notation, to pass a comma in an item value, you should enclose the characters with backslashes. For example,
    \cluth,bearing\In your case, it should be the item/column notation.
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BCEDJBEH
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • APEX don't allow modify rows in columns which are Primary Key ?

    I have tables:
    http://img508.imageshack.us/my.php?image=21269582oe8.jpg
    book(id_book - "Primary Key", title, year); book_author(id_book - "Primary Key", id_author - "Primary Key"); author(id_author - "Primary Key", name)
    I have created a new page -> Form -> Tabular Form for table 'author' because I would like to add new authors, modify and delete. During creating this page I have choosen column 'id_author' as 'primary key column 1' and everything is OK (I can't modify column 'id_author' - this column is autoincrement and I can modify column 'name').
    BUT I have also created a new page -> Form -> Tabular for table 'book_author' because I would like to write numbers as id_book and id_author, modify and delete them (so add relations between tables: book, book_author and author). During creating this page I have choosen column 'id_book' as 'primary key column 1' and 'id_author' as 'primary key column 2'. And on website I can't modify (edit) these fields. And I can't also add new row because I see in each column in new row: (null).
    http://img444.imageshack.us/my.php?image=11324615yk9.jpg
    APEX don't allow modify rows in columns which are Primary Key ? This is stupid....... What can I do ?
    Edited by: user10731158 on 2008-12-20 11:40

    Single-column and non-meaningful so you never want to update them. In the case of your example, you would need to add an ID column to the book_author intersection table. Honestly, I was so blown away (and pleasantly surprised) by the lack of rebuttal and the "thx" that I went ahead and put together an example of how I would define the book_author table:
    create table  book_author
       (id varchar2(32),
        book_id varchar2(32),
         author_id varchar2(32),
         modified_on     date,
         modified_by varchar2(255),
         constraint book_author_pk primary key (id),
         constraint book_auth_book_fk foreign key (book_id) references books(id),
         constraint book_auth_author_fk foreign key (author_id) references authors(id)
    create unique index book_author_uq on book_author (book_id,author_id)
    create or replace trigger  biu_book_author before insert or update on book_author
    for each row
    begin     
         if inserting then
              :new.id := sys_guid();
         end if;
         modified_on := sysdate;
         modified_by := nvl(v('APP_USER'),user);
    end;
    /Good luck,
    Tyler

  • Primary key column as the key of the cache

    Hi All,
    I am implementing a cache backed by HibernateCacheStore for a table. Cache contains key as the primary key of the table and value as the entire row in object format. the primary key is generated by hibernate.
    when i am inserting new rows through coherence (i.e cahce.put) what persistence strategy should is use to set the cache entries.
    I cannot use cache.put (key, value) because key is the primary key of the table which is not generated yet.
    and if i use the session.save(value) the persisted value is not in the cache.
    is there any mechanism to map the cache key as the primary key column of the table.
    Regards
    S

    Hi -
    Using Hibernate as a CacheStore for Coherence, the key of the cache entry is also the key of the entity
    being stored via Hibernate. For this reason keys for new cache entries must be generated ahead of time.
    A UUID can be used. The commons component of the Incubator project has a key generation utility that
    might be worth looking at.
    /Mark

  • Ability to auto create a primary key column while creating an entity ?

    Product : oracle data modeler ( 3.0.0.665 32 bit version ) on windows XP Professional , : Target DB Oracle 11GR2
    I am new to Mozilla Rhino. Is it feasible to have a mechanism where in the primary key column name would be auto generated when the entity ( name ) is just created for the first time, and it has no columns defined yet . For e.g. one could create an entity named vendor , and after the table name is typed in, a column vendor identifier,of type numeric , is to be auto created. This mechanism should work even if the entity name changes, and the primary key is in format {tablename}_id , but it should not , if the primary key was manually set in later and is not in the expected format.

    I created this script (1) for adding an ID column (using a specific domain) to all supertype entities that do not already have an ID attribute, and a script (2) for adding primary key constraints to all ID attributes.
    - Marc de Oliveira
    Script 1:
    entities = model.getEntitySet().toArray();
    domain = model.getDesign().getDomainSet().getByName('Integer DIS Domain');
    for (var e = 0; e<entities.length;e++)
    entity = entities[e];
    if (entity.getHierarchicalParent()==null)
    attributes = entity.getAttributes().toArray(); // find existing attributes
    IDattribute = null;
    for (var a = 0; a<attributes.length; a++) // look for an ID attribute
    if (attributes[a].getName()=="ID") { IDattribute = attributes[a]; }
    if (IDattribute==null) // if an ID attribute was not found...
    IDattribute = entity.createAttribute(); // create a new ID attribute
    IDattribute.setName("ID");
    IDattribute.setDomain(domain);
    entity.moveToIndex(IDattribute,0); // move ID attribute to top
    Script 2:
    entities = model.getEntitySet().toArray();
    for (var e = 0; e<entities.length;e++)
    entity = entities[e];
    attributes = entity.getAttributes().toArray(); // find existing attributes
    IDattribute = null;
    for (var a = 0; a<attributes.length; a++) // look for an ID attribute
    if (attributes[a].getName()=="ID") { IDattribute = attributes[a];}
    if (IDattribute!=null) // if an ID attribute was found...
    key = entity.createCandidateKey(); // Create a key
    key.add(IDattribute); // Add the ID attribute to the key
    key.setPK(true); // Define the key as a primary key
    PKName = entity.getName().replace(" ","_")+"_PK";
    key.setName(PKName); // Define the key as a primary key
    entity.setPK(key); // workaround for bug...
    }

  • Unsing findByKey on non-primary, complex keys

    Hello!
    Can anyone show an example of how to use
    the ViewObject.findByKey to find a row
    using a (perhaps complex) non-primary key ?
    Thanks.

    Victoria:
    Please run your test case with diagnostic turned on. It will show the SQL statement used for your findByKey() request. See if the SQL makes sense. If still doesn't work and if you cannot figure out what's going on, please post the diagnostic output.
    To turn on diagnostic, you need to specify
    -Djbo.debugoutput=console
    as one of the JVM switches.
    If you're invoking your app (middle-tier app) from command line,
    include -Djbo.debugoutput=console as in
    java.exe -Djbo.debugoutput=console ...
    If you're running your app from within JDev:
    1. Select the project.
    2. Do right mouse click and select "Project Settings..."
    3. On the Settings dialog, select Configurations/Runner.
    4. In the righthand side pane, you should see a textbox for "Java
    Options". Please add the following JVM switch:
    -Djbo.debugoutput=console
    Then, rerun. The run command should include
    -Djbo.debugoutput=console as in
    "D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...
    You should now see a lot more output on the IDE's message window.
    Thanks.
    Sung

Maybe you are looking for

  • An unexpected exception while resolving a new connection to an Adobe Service.

    Hi    i am new to LC and trying to generate pdf from doc using java API . while doing this i am geting error an unexpected exception while resolving a new connection to an Adobe Service.what is exact reason of this error.from. thanks in advance N1223

  • Washed out color - McGamma Shift?

    In a major bind... Since switching to a new machine and Snow Leopard, my video looks washed out when out putted.... http://www.flickr.com/photos/realestateconvergence/4341439404/sizes/l/ The link above takes you to the photo samples of the video... P

  • Terms and conditions for plugin for B2B?

    Hello Community, we are developing a commercial plugin for Adobe InDesign for B2B. For this purpose we need some information about how to write terms and conditions for Adobe InDesign plugins. Which requirements should we write in the terms and condi

  • Fetching Non Qualifier value frm main table

    Hi All,        I have a requirement where I need to get 3  Non-Qualifier value present in the Main table .        These 3 Non-Qualifier values are present in 1 Qualified Table.         Kindly send me some sample code for this scenario awaiting for yo

  • Telephone number for Authorized HP Service Center at Sagami in Japan

    Please find out phone number for authorized HP service center at area of Sagami in Japan.