How to define a Composite primary key for a Table
HelloI'm basically more in Java programming, with little knowledge of Oracle bit as DataBase .so please sorry for my silly doubts.
Can someone tell me please how to define a Composite primary key on a Table.
Thanks in advance.
Published by: user672373773 on 25 Sep, 2009 08:54
Please go through these links:
http://plsqlworld.blogspot.com/2009/01/oracleplsql-composite-primary-key.html
http://sqlzoo.NET/HOWTO/source/z.dir/tip241027/Oracle
Concerning
Asif Kabir
-Mark the response as correct/good
Tags: Database
Similar Questions
-
I have a Gr_order table that was settled long ago, and now he needs to be filled
with some more search data.
"Orderid" is a primary key for the table, but the question is how can I insert "orderid" in the insert statement in the procedure. I couldn't find any name sequence. There are 1230
documents that must be inserted.
Desc Gr_order Orderid Number Primary key Desc Varchar2
Thank youINSERT INTO gr_order (orderid,desc) VALUES (???, upper(each_pom.desc);
SandyYou can find the code that inserts into the table and see if it uses the sequence ;-). A sequence is not 'attached' to a particular table - this is the insert statement to determine whether a sequence should be used.
You can check if the table has a trigger - some developers like to emulate the behavior of MS - sql server by having a trigger on the table that selects in a sequence. If it has such a release, then you just do your insertions without specifying order_id. But if the table does not have such a release, then you cannot know if the table was originally filled using a sequence or not (unless you can find the instructions for inserting somewhere).
-
primary key for a table with only 1 column
I create a temporary table in my procedure and there is only a single column in it. I'll eventually use this temporary table in a join. Does make sense to create a primary key for this temporary table? It will make my join run faster? In other words, oracle automatically sorts and keeps the table column is the fact that if a primary key or index is created? I use 10g - 10.2.0.3.0The data table is not indexed.
Oracle will probably make a hash join.
Have you tried just current execution Plan for your query to explain?
Hemant K Collette
http://hemantoracledba.blogspot.com -
Hello guys,.
I have a question about the primary key in my fact table. In my fact table, the primary key is a combination of 3 different columns, 2 columns are primary keys in dimension tables 2 diff. Is it normal to have a primary key in a table of facts, which is a combination of 3 different columns. If yes then when us will be important to the OBI tool only 3 columns Phy layer appears as the PK. should I do the other 2 columns as the PK in the physical layer of the OBI tool or can I leave it as it is. Please let me know
Thank you.I did as you asked me to. Can you let me also know what will happen if I do only a single key as PK and let them other 2 touch as it is. This will affect performance in > is it possible or will I get incorrect values?
No, this will not affect anything, in any case explicitly will give you joined him again in the physical layer.
But it is advisable to show the key columns in the physical layer of the RPD.Thank you
Vino -
How to add the primary key for the table with the existing data?
The table is already busy data. There was no primary key before, so for each column, there are some duplicate values.
I want to add a new column, which should be of the integer data type and can automatically incremented, from 001. I tried with Oracle SQL Developer, but it says "ORA-01758: table must be empty to add mandatory (NOT NULL) column. How can I do? Thank you!Hello
Look for the [ALTER TABLE | http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm#sthref4803] command to find out how to add a column (step (1)) and a (step (3)) constraint to an existing table.
For the step (2):
CREATE SEQUENCE employee_id_seq START WITH 1 ; UPDATE employee SET id = employee_id_seq.NEXTVAL;
When you create a sequence, START WITH 1 is the default value, so that the line is not really necessary above... I've included just to show how you could start with any number you have chosen.
-
Composite primary key (reverse)
Hello
I created a table with composite primary key
for example: -.
create table demo (NUMBER one, NUMBER two, the key pk_composite primary (one, two);)
Insert into demo values (1,2);
1 row inserted
Insert into demo values (1,2);
ORA-00001: unique constraint (username. PK_composite) violated
its ok...........................
I know composite primary will not work reverse (i.e.)
Select * from demo;
one | two
1. 2
Insert into demo values (2,1);
1 row inserted
Select * from demo;
one | two
1. 2
2. 1
I need to do reverse, is it possible to make? (i.e.)
Insert into demo values (2,1); -This should not
Please help me... Thanks in advance...A quick way to do this is to create a unique index based on a function like this:
create unique index demo_i1 on demo (least(one,two) ,greatest(one,two));
-
Why we cannot create more than one primary key on a table. Why we create several unique key on a table. Please explain if anyone have details of this.
«a primary key has semantic meaning, it is to be immutable (never change of value), unique and not null.»
a unique constraint is simply "at any time, these values are unique - they can change and they can be null.
You use a unique when constraint
(a) you do not already have a primary key for a table can have only one
(b) you allow NULL values in attributes
"(c) to allow you to update the values in the attributes.https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:5541352100346689891
-
How to create validation of business for a composite primary key
Hi all
I am newbie in oracle ADF and my knowledge is lacking in the validation of the company,
My requirement is to display an error message when the user enter the same data into the table.
Let me exaggerate I have a table which the composite primary key is defined on 2 columns, if the user does not have the composite primary key constraints, so I have to display the warning message.
FYI, I use the version of Jdeveloper 11.1.2.3.0
Please let me know the steps to create business for this rule.
Thank you very much!!
User, if you use adfbc, you have nothing to do because this behavior out of the box. When you create a model of your tables infrastructure creates the business rule for you.
Timo
-
Hello
I have a page with adf faces table, I need to pass values to the table to another the inputfields page (both fields are composite primary keys), I'm passing values but I get the error while I'm passing values twice on the next page with a button command (using setPropertyListener) this error... Please help me?
Houston-29114 ADFContext is not configured to process this exception messages. Use the code of exception stack trace and error to investigate the root cause of this exception. Root cause error code is Houston-25013. Error messages settings are {0 = oracle.jbo.Key [22 9]}
ADF_FACES-60097: for more information, see the error log of the server for an entry beginning with: ADF_FACES - Exception during the PPR, #1 60096:Server
The error log is...
URL - target http://127.0.0.1:7101/Recruting-ViewController-context-root/faces/login.JSPX
< ViewHandlerImpl > < _checkTimestamp > Apache Trinidad runs with control of activated timestamp. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
< UIXEditableValue > < _isBeanValidationAvailable > Validation Bean A provider is not present, so bean validation is disabled
passing the user name: 201157
< _LogUnhandledException > ADF_FACES - 60098:Faces life cycle receives exceptions that are unhandled in phase 5 of INVOKE_APPLICATION
oracle.jbo.TooManyObjectsException: Houston-25013: too many objects correspond to the oracle.jbo.Key [22 primary key 9].
at oracle.jbo.server.EntityCache.throwTooManyObjectsException(EntityCache.java:608)
at oracle.jbo.server.EntityCache.handleDuplicateKey(EntityCache.java:617)
at oracle.jbo.server.EntityCache.addForAltKey(EntityCache.java:1030)
at oracle.jbo.server.EntityCache.add(EntityCache.java:541)
at oracle.jbo.server.EntityImpl.callCreate(EntityImpl.java:1141)
at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1140)
at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:461)
at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:478)
at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:5800)
at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1941)
at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2504)
at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2545)
at oracle.jbo.server.ViewRowSetImpl.createAndInitRow(ViewRowSetImpl.java:2510)
at oracle.jbo.server.ViewObjectImpl.createAndInitRow(ViewObjectImpl.java:11133)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1342)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1091)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:982)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:880)
at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:553)
at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
< RegistrationConfigurator > < handleError > ADF_FACES - 60096:Server Exception during the PPR, #1
oracle.jbo.TooManyObjectsException: Houston-29114 ADFContext is not configured to process this exception messages. Use the code of exception stack trace and error to investigate the root cause of this exception. Root cause error code is Houston-25013. Error messages settings are {0 = oracle.jbo.Key [22 9]}
at oracle.jbo.server.EntityCache.throwTooManyObjectsException(EntityCache.java:608)
at oracle.jbo.server.EntityCache.handleDuplicateKey(EntityCache.java:617)
at oracle.jbo.server.EntityCache.addForAltKey(EntityCache.java:1030)
at oracle.jbo.server.EntityCache.add(EntityCache.java:541)
at oracle.jbo.server.EntityImpl.callCreate(EntityImpl.java:1141)
at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1140)
at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:461)
at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:478)
at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:5800)
at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1941)
at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2504)
at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2545)
at oracle.jbo.server.ViewRowSetImpl.createAndInitRow(ViewRowSetImpl.java:2510)
at oracle.jbo.server.ViewObjectImpl.createAndInitRow(ViewObjectImpl.java:11133)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1342)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1091)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:982)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:880)
at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:553)
at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Hi all, finally I found the solution to this exception.
I did the following steps to solve the problem.
1. create a bean and use this method
public void tooManyObjectsMatchExceptioHandeler() {}
Add the code in the event here...
System.out.println ("inside the Handeler");
FacesMessage message =
new FacesMessage ("Type your friendly message");
message.setSeverity (FacesMessage.SEVERITY_ERROR);
FacesContext fc = FacesContext.getCurrentInstance ();
fc.addMessage (null, message);
}
Now, drag and drop the file above java projects in data controls in the browser of the application.
2. drag a workflow method call (where u get exception as Houston-25013) and call this method as an activity of the exception handler,
Now, do a right click on this--> definition of the page method call create or go to definition of the page--> create a link Action method and select the above method in the select and file def page this method call in the workflow then go to properties inspector set out fixed property (here name of activities of method call) u give.
-
request for deletion with a composite primary key
I have the following problem, which seems very simple, but I'm a bit at a loss :)
I have a table T1 with composite primary key F1 and F2.
There is a second table I want to use to delete records of T1 T2. It contains als F1 and F2.
I want to do something like this
Of course, this does not work.delete from T1 where T1.F1, T1.F2 in (select T2.F1, T2.F2 from T2);
There are solutions, but I find them unsatisfactory:
-A loop of PL/SQL and passes the key one
-Concatenate F1 and F2: where T1. F1 | T1. F2 to (select T2. F1 | W2M T2 F2); - but it's very ugly.
Surely it must be possible in a simple SQL statement...
Thank you!
Robdelete from T1 where (F1,F2) in (select T2.F1, T2.F2 from T2);
Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/] -
change a composite primary key
HelloI have a table that has a composite primary key with 3 columns (col1, col2, col3)
Now I need to change the primary key (col1, col2, col4) remove composite col3 replace with col4
col1 col2 COL3 COL4 col5 1 one x p DFD 1 one There p DFD 1 one z p SD 1 one m p amplifier 1 one n p Try There are thousands of records in the table in the format above. How to make this change?
Thank you.
In this case, you will need to establish that if the change to the primary key makes sense - if so, you'll have to remove some lines to remove duplicates. I think that if this requirement has been raised at a request of the company, they will (should) have indicated what lines need to be maintained.
If it is not sensible, you will need to go to the one who asked for the change and get them to change their mind or tell you what to do with duplicate lines.
Out of curiosity, why did you change the primary key?
-
By specifying the Composite primary key (columns 4 and 5)
Hi all
I am new to Oracle Apex,
I have a few paintings with a composite primary key (4 or 5 columns)... When I try to create a primary key constraint, it gives me only 3 columns!
Any help please in how can I solve this problem?
Thanks in advance
You are probably using the workshop for this sql Object Explorer
which seems to be limited to 4 columns on APEX 4.2.3
best thing to do is to create manually using the sql commands in sql workshop, here's an example:
{code}
CREATE UNIQUE INDEX myui ON JC_ACCOUNT
(TITLE_ID, FAMILY_NAME GIVEN_NAME, GENDER_ID, TELEPHONE_NUMBER)
/
{code}
I hope this helps you
KR
Martin
-
assign a Composite primary key
Hi all
I have the table with composite primary key (ID, year)
I want to assign the value using triggers and sequence
the number will start from 1 and current year to the end of the year and start again next year
How can I do this
Best regardsHello
mkm802 wrote:
Dear FrankHow can please I use the ROW_NUMBER for this
You have not posted the CREATE TABLE and INSERT statements for examples of data, so I'll use scott.emp:
SELECT ename , deptno , EXTRACT (YEAR FROM hiredate) AS year , hiredate , ROW_NUMBER () OVER ( PARTITION BY deptno , EXTRACT (YEAR FROM hiredate) ORDER BY hiredate ) AS r_num FROM scott.emp ORDER BY deptno , hiredate ;
Output:
ENAME DEPTNO YEAR HIREDATE R_NUM ---------- ---------- ---------- ----------- ---------- CLARK 10 1981 09-Jun-1981 1 KING 10 1981 17-Nov-1981 2 MILLER 10 1982 23-Jan-1982 1 SMITH 20 1980 17-Dec-1980 1 JONES 20 1981 02-Apr-1981 1 FORD 20 1981 03-Dec-1981 2 SCOTT 20 1987 19-Apr-1987 1 ADAMS 20 1987 23-May-1987 2 ALLEN 30 1981 20-Feb-1981 1 WARD 30 1981 22-Feb-1981 2 BLAKE 30 1981 01-May-1981 3 TURNER 30 1981 08-Sep-1981 4 MARTIN 30 1981 28-Sep-1981 5 JAMES 30 1981 03-Dec-1981 6
-
Aggregation based on composite primary keys
Hello
I have a coherence cache which stores complex Java objects in the form of values in which I have to perform aggregation (County based on a composite primary key in the object). The key for the cache's UUID.
For example:
Class XYZ has properties a, b, c and d (all the java.lang.String type). I need to calculate the number of times a unique combination of values of a, b and c in the cache.
I tried to use a ReflectionExtractor as:
Then, create a chained as Exractor:ReflectionExtractor[] xBiz = {new ReflectionExtractor( "getA"),new ReflectionExtractor( "getB"),new ReflectionExtractor( "getC")};
Finally, I perform the aggregation such as:ChainedExtractor chExtractor = new ChainedExtractor(xBusinessService);
Obviously something is wrong, but I get the exception:InvocableMap.EntryAggregator aggregator = GroupAggregator.Parallel .createInstance( chExtractor, CompositeAggregator.Parallel .createInstance(new InvocableMap.EntryAggregator[] { new Count() }));
When I do this for the aggregation based on a single property say a or b or c, the aggregation works very well:java.lang.RuntimeException: Missing or inaccessible method: java.lang.String.getB()
with the resultInvocableMap.EntryAggregator aggregator = GroupAggregator.Parallel .createInstance( "getB", CompositeAggregator.Parallel .createInstance(new InvocableMap.EntryAggregator[] { new Count() }));
for the sample data below.y1 -> 4
The expected result for Aggregetion based on several properties:
Can anyone comment on how to get the aggregate first? And also if the way I am using the extractor chained is correct.Data in Cache: Expected Result: A | B | C | D | x1,y1,z1 -> 2 x1|y1|z1|Desc1| x2,y1,z1 -> 1 x2|y1|z1|Desc2| x3,y1,z2 -> 1 x1|y1|z1|Desc3| x3|y1|z2|Desc4|
Thanks in advance
Vikas
Edited by: vikascv January 6, 2010 17:59I think you want to use a MultiExtractor who will then produce a table of the elements of the composite key on which you can then aggregate. This means that the array of items produced key can be properly evaluated for equality.
If not, write a custom ValueExtractor which returns a single object (can be a concatenated string or a key object with equals/hashcode).
Regards, Paul
-
primary key for a column made up of duplicates
Hello
-> I have created a table and
-> I have a column consisting of 1,000 records (but where I have duplicates)
and now, I want to create a primary key for the column
How can I do it...Hello
Run the utlexcpt.sql script located in the ORACLE_HOME/rdbms/admin directory level to create the exception table.
Thank you
Maybe you are looking for
-
I am limited on my data monthly allowance and do not want to use up my data on mail I don't want to see. Thanks in advance, baud rate
-
El capitan will not open - full boot disk
Hello My Macbook Pro 2015 will not open. I have El Capitan on it. The last time it was open, I was copying large files on it. Did not notice that the free space was not so. Thus, change some time to copy files, the screen freezes and I had to stop it
-
is there a way to tell if the person calling me is really using an iPhone.
A person calls me a phone which, said, is an iPhone, yet when I text, my outgoing text does not appear in blue, what he does with everyone who has an iPhone. In addition, I get the text of the message undeliverable. So my questions are: 1) is ther
-
OfficeJet 6700 Premium: cartridges of OEM 933
I was told that this printer is perfect for printing low volumn. I'm on my third set of ink cartridges, including the black cartridges scence XL that I print almost exclusively in black. I get about twenty pages until the cartridges need to be replac
-
Hello! After the accident yesterday, I could not access your account, password recovery did and it turned out that my login somehow changed (remove 2 characters) and therefore lost all contact. How did this happen and how can I restore it?