sequence value recycle

Hello

Just a question about the operation of sequences. If its used for the primary key and I remove a line (say ID: 1058), a sequence would generate 1058 again? Or would it just continue upward to MAXVALUE?

Thank you

11 G R2 using Linux

>
Just a question about the operation of sequences. If its used for the primary key and I remove a line (say ID: 1058), a sequence would generate 1058 again? Or would it just continue upward to MAXVALUE?
>
Whenever you call NEXTVAL continues upward to the MAX VALUE.

A sequence is an object of independent schema. He is not aware of any other object, a table, or if its value is always used.

See CREATE SEQUENCE in the doc of SQL language
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_6015.htm
>
Use the CREATE SEQUENCE statement to create a sequence, which is an object database where several users can generate unique integers. You can use sequences to automatically generate primary key values.

When a sequence number is generated, the sequence is incremented, independent of the transaction validation or restoration. If two users concurrently increment the same sequence, sequence numbers acquired by each user may have gaps because sequence numbers are generated by the other user. A user can never acquire the sequence number generated by another user. When a sequence value is generated by a user, that user can continue to access this value, regardless of whether if the sequence is incremented by another user.

Sequence numbers are generated independently of tables, so the same sequence can be used for one or more tables. It is possible that individual numbers will be seem to be ignored, as they were generated and used as part of an operation which finally cancelled.
In addition, a single user may not realize that other users are in the same sequence.

Once a sequence is created, you can access its values in SQL statements with the virtual CURRVAL, which returns the current value of the sequence, or the virtual NEXTVAL, which increments the sequence and returns the new value.

Tags: Database

Similar Questions

  • Replication sequence values of Golden Gate?

    Hi all

    I searched on the web and read the Golden Gate, but I found mixed answers.

    I try just to check, for some, it is possible to automatically reproduce the sequence values in a two-way configuration. The two databases will be identical and both will be GR 11, 2 with the latest version of GG.

    If it is not possible to increment automatically sequences in a bi-directional configuration, what are best practices for rest with them?

    One option is sequences of alternatives on each database, with the same values (for example) and an uneven values, but this requires the deployment of new sequences on two databases, something that we hoped would be supported by replication. (Yes the creation of the sequence can be supported, but the value is not incremented on the target database).

    Another way we thought on top of our heads is to have an insert trigger on (we only use sequences to generate surrogate keys) who will choose the database nextval target via a link db, but this seems a bit heavy.

    What is the best practice?

    GoldenGate forum is here:
    GoldenGate

  • Current and next identical sequences value?

    Hello

    In my current database and according sequences value are the same.
    According to my basic understanding following value & course shud be different.
    SQL > select AUG1_DMD_1SQ.nextval from double;

    NEXTVAL
    ----------
    102

    SQL > select AUG1_DMD_1SQ.currval from double;

    CURRVAL
    ----------
    102


    Is my understanding wrong or there is a prblem with sequences in my database?

    My gR 1 Oracle versoin:11
    OS: SunOS

    See you soon,.
    Malika
    SQL> select locations_seq.nextval from dual;
    
       NEXTVAL
    ----------
          3400
    
    SQL> select locations_seq.nextval from dual;
    
       NEXTVAL
    ----------
          3500
    
    SQL>
    SQL>
    SQL> select locations_seq.nextval from dual;
    
       NEXTVAL
    ----------
          3600
    
    SQL> select locations_seq.currval from dual;
    
       CURRVAL
    ----------
          3600
    
    SQL> 
    

    work as planned & design.
    just reverse the order of the two instructions select

  • out of sync sequence value

    Hi all

    I just did a refresh of a schema of prod dev. Which seems to work very well. I did a schema import/export level (we are on 9.2.0.5). My question is. It seems that the sequences are out of sync.

    In Drop lets say seqA a nextval 120 in dev seqA even has a nextval of 80. I know I can run the nextval of double 40 times to get the sync. But how can we synchronize these values for all other sequences. There are about 800 + of these sequences. Any ideas on how to synchronize these prod dev?

    Any ideas on how to synchronize these prod dev?

    Option 1:
    stop the application code that increments the sequence in prod and then export - import

    Option 2:
    write a plsql procedure to loop through all the footage and increment the

    Option 3:
    For each sequence with a mismatch: DROP SEQUENCE and CREATE SEQUENCE STARTING WITH the current / desired / Prod target values

    Hemant K Collette

  • By program the Sequence value call step

    I have code (LV 2015) that weights a step in a sequence of TS (TS 2014), changing the sous-séquence judicially.

    The code works, but an error is thrown (which indicates the resources have not been released), and ultimately, LabVIEW crashes.  Strangely, the resources that it ' complain is that I have not consulted.

    Here, we the offending code:

    It is the conversion of the reference Module to a SequenceCallModule which seems to be the cause of the trouble.

    Here is the dialog box that appears:

    Here we the full text of the error:

    References to PropertyObjects not released correctly.
    Total number of objects: 1024
    Number of objects at a higher level: 17

    Note: Some higher level objects can be included if they are referenced by
    an incorrectly released top-level object. For example, a new
    SequenceContext object is a reference to a SequenceFile object.

    The following top-level objects are not set:

    Definitions of types [5 or objects not published]
    Definition of type #1:
    Name: SeqCallStepAdditions

    Definition of type #2:
    Name: SequenceArgument

    Definition of type #3:
    Name: NI_SequenceParameterResult

    Definition of type #4:
    Name: Expression

    Definition of type #5:
    Name: path

    And the following unclassified objects:
    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    SequenceCallModule (SeqCallStepAdditions)
    Name: surlabasedesdonneesdufabricantduballast

    Can someone tell me what I have to do the release of resources after changing a call sous-suite?

    I don't see a close reference to the Module or the step objects.

  • How to get a sequence value OFA page

    Hi all

    I created a page of insertion, to generate the AutoNumber to supplierid created a sequence in databse.but dnt know how to call a sequence in the OPS? Please help me.

    Robet

    Published by: robet Larson December 3, 2010 17:06

    Hello

    Ramya Latha says:

    I created a page of insertion, to generate the AutoNumber to supplierid created a sequence in databse.but dnt know how to call a sequence in the OPS?

    For a sequential:

    Import oracle.apps.fnd.framework.server.OADBTransaction;

    OADBTransaction tr = getOADBTransaction ();
    ID = TR.getSequenceValue ("id_seq");

    Concerning
    Meher Irk

  • How to maintain the sequence DB value if we don't save the record?

    Hi friends,

    I created a Page creating and defining the primary key (Empno) with the sequence of the DB column. This method, I'll call you in PR

    Here is the code and it works fine.

    public void createRecord() {}
    OAViewObject vo = getXXEMPNEWEOVO1();
    If (! vo.isPreparedForExecution ())
    {
    vo.executeQuery ();
    }
    Number seqNo = getOADBTransaction () .getSequenceValue ("XX_EMP_S");
    Line = vo.createRow ();
    row.setAttribute ("Empno", seqNo);

    vo.insertRow (row);
    row.setNewRowState (Row.STATUS_INITIALIZED);
    }

    If I record the record, it is saving without any problem.

    But here is my requirement, if I do not save the file I'd be losing sequence. I don't want to lose this sequence.

    Ex: Current Seq: 10

    When I go to create the page: the seq is 11. If I save it, it will get stored in DB without any problem.

    Instead of save, I'll close the page and to reopen the page, this time, a new sequence will get generated, that is to say 12. But 11 has disappeared. I don't want to miss this 11.

    I wrote the same code in the method Create() of EO. He works also as same (above).

    I tried to write the code in the button Save, I am getting error below:

    Error -

    Empno in PraciceAM.XXEMPNEWEOVO1 attribute is required.

    CO code:

    OAViewObject empupdatevo = (OAViewObject) am.findViewObject ("XXEMPNEWEOVO1");

    TXN OADBTransaction = am.getOADBTransaction ();

    Number of seqNo = txn.getSequenceValue ("xx_emp_s");

    Line = empupdatevo.getCurrentRow ();

    row.setAttribute ("Empno", seqNo);

    Can you help me please on this.

    A quick response would be much appreciated.

    Note: This issue, I was also asked to interviews, I was empty.

    Thank you

    Palacin

    Srinivas,

    Once recovered DB sequence value cannot be restored.

    Few options for you:

    1. set a dummy value say-1 initially, then drift and set the value of the sequence on the click on save.

    2. set the validation server = false on the "Save" button. But it stops to throw another error in the page on the click of the button.

    3. you can substitute doDML() and try to set the sequence value in this, but it will take once again the dummy value-1 as the first option.

    Hope this helps and answers your question.

    See you soon

    AJ

  • Can I recycle / reboot my sequence on a specific date?

    Dear all

    Can I recycle / reboot my sequence on a specific date? can for example a sequence be recycled on July 1st of each year.

    Normally I regenerate my primary key on the beginning of the year for example on July 1, 2013, she became 2014000001, July 1, 2014, it became 2015000001.

    So, in this way, is it possible?

    Thank you.

    Hello

    MUmarAli wrote:

    A big thank you to you all for your response cooperative.

    But I do not understand why is this not good practice?

    Isn't better to have a primary key that is more descriptive than just 1,2,3... ? ...

    No, it's actually better to have a primary key that doesn't mean anything.  Maybe it's not intuitive, but it's true.

    Ever want to change primary keys.  No matter how carefully you fill, errors are always possible.  If a line is created with the wrong year, you will need to change it after you find the error, but you never want to change primary keys.

  • Duplicate values generated by an Oracle sequence

    Hello

    Since a few days we are facing a weird problem in our application where the sequences seem to be generating duplicate values. Previously I thought is this is not possible, but now it seems to be a problem. Here are the details:

    Select * from v$ version;

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    We use to insert it into a table column of the last sequence value that is of course the primary key of the table column. Today, we received a violation of unique constraint on the column of the primary key (which is driven by the sequence). Below is the last value of the PK column

    SELECT MAX(PCCURVEDETAILID) OF T_PC_CURVE_DETAILS;

    162636

    and below, was the last value in the sequence that has been less than the PK column

    SELECT S_PCCURVEDETAILS. NEXTVAL FROM DUAL;

    162631

    Then we checked the data of the user_sequences and found the next sequence value (LAST_NUMBER) to be 162645 which was greater than the current value of the sequence:

    Select * de user_sequences one a.sequence_name as "S_PCCURVEDETAILS" ;

    SEQUENCE_NAME

    MIN_VALUE

    MAX_VALUE

    INCREMENT_BY

    CYCLE_FLAG

    ORDER_FLAG

    CACHE_SIZE

    LAST_NUMBER

    S_PCCURVEDETAILS

    1

    1E + 27

    1

    N

    N

    20

    162645

    I then modified the nocache sequence:

    change sequence S_PCCURVEDETAILS NoCache ;

    Select * de user_sequences one a.sequence_name as "S_PCCURVEDETAILS" ;

    SEQUENCE_NAME

    MIN_VALUE

    MAX_VALUE

    INCREMENT_BY

    CYCLE_FLAG

    ORDER_FLAG

    CACHE_SIZE

    LAST_NUMBER

    S_PCCURVEDETAILS

    1

    1E + 27

    1

    N

    N

    0

    162633

    SELECT S_PCCURVEDETAILS. NEXTVAL FROM DUAL;

    162632

    We also face the same type of problem of violation of primary key to another sequence-driven table, a few days before.

    In our code, I also checked that the primary key in the table value is inserted using only the value of the sequence.

    Can anyone please suggest any reason this issue for

    Concerning

    Deepak

    I faced a similar problem about 3 years ago. Here's the story, suddenly in my UAT environment a job that inserts data in some tables began to throw exceptions of primary key violation. After investigation, I found that the sequence is x, but the primary key for the table is x + y. investigation more - DBA moved all production data without even notifying the application support team.

    Morale - pretty obvious

  • Need to fill the value of the sequence in a field after insertion in the ofa page

    Hi all

    I have a custom OAF insert the page in do I have to fill out a sequence to a field value, once the data inserted with success at the table.

    so for this I followed the approach below.

    1 > created a database sequence.

    2 > java in the EOImpl of the file in the accessor method Set for their respective fields wrote code below.

    {} public void setContainid (numeric value)

    If (value == null) {}

    OADBTransaction t = getOADBTransaction();

    value = t.getSequenceValue ("XXXXX_CONTAIN_SEQ");

    }

    setAttributeInternal (CONTAINID, value);

    }

    But still, I'm not able to complete the sequence value for the field in my oaf page, please help me with that.

    Thank you

    Hello

    Write this logic to create the EOImpl method:

    public void create (AttributeList attributeList)

    {

    Super.Create (AttributeList);

    Transaction OADBTransaction = getOADBTransaction();

    ContID number = transaction.getSequenceValue ("XXXXX_CONTAIN_SEQ");

    setContainId (contID);

    }

    Sushant-

  • Database exception Houston - 28010:Error while getting the value of the following sequence for database PS_TXN_seq

    Hello

    I use jdev 11.1.1.6.0 version.

    We build webcenter portal application for which Portal Server is on one computer/server and database server is located on a different machine/server.

    It worked well, but the error pulled is

    Database exception Houston - 28010:Error while getting the value of the following sequence for database PS_TXN_seq

    What is the cause of this issue.

    [2013-08 - 03T 19: 55:09.566 + 08:00] [WC_Portal1] [WARNING] [] [oracle.jbo.server.ApplicationModuleImpl] [tid: [ASSETS].] [' ExecuteThread: ' 249 ' for queue: "(self-adjusting) weblogic.kernel.Default"] [username: anonymous] [ecid: 004skazFMpJAdLEuN4aeLQ0002OP0000pS, 0:1] [APP: App_application1 #V2.0] [URI: / App/faces/AfLiteratureMenu/AfDocRefProductInstructions] []

    oracle.jbo.PCollException: Houston-28010: error getting next sequence value for the database PS_TXN_seq

    at oracle.jbo.PCollException.throwException(PCollException.java:36)

    at oracle.jbo.pcoll.OraclePersistManager.queryNextCollectionId(OraclePersistManager.java:1503)

    at oracle.jbo.pcoll.PCollManager.register(PCollManager.java:562)

    to oracle.jbo.pcoll.PCollection. < init > (PCollection.java:99)

    at oracle.jbo.pcoll.PCollManager.createCollection(PCollManager.java:461)

    at oracle.jbo.server.DBSerializer.setup(DBSerializer.java:153)

    at oracle.jbo.server.DBSerializer.passivateRootAM(DBSerializer.java:286)

    at oracle.jbo.server.DBSerializer.passivateRootAM(DBSerializer.java:267)

    at oracle.jbo.server.ApplicationModuleImpl.passivateStateInternal(ApplicationModuleImpl.java:6026)

    at oracle.jbo.server.ApplicationModuleImpl.passivateState(ApplicationModuleImpl.java:5877)

    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:386)

    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:9084)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4607)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.manageReferencingState(ApplicationPoolImpl.java:1493)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.finalizeResource(ApplicationPoolImpl.java:1393)

    at oracle.jbo.pool.ResourcePool.removeResourceInternal(ResourcePool.java:848)

    at oracle.jbo.pool.ResourcePool.setState(ResourcePool.java:1103)

    at oracle.jbo.pool.ResourcePool.removeResource(ResourcePool.java:860)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.removeDeadInstance(ApplicationPoolImpl.java:2736)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4638)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.manageReferencingState(ApplicationPoolImpl.java:1493)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.recycleReferencedInstance(ApplicationPoolImpl.java:2623)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2444)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2347)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3246)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:572)

    at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:505)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:500)

    at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:523)

    at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:869)

    at oracle.adf.model.binding.DCDataControl.setErrorHandler(DCDataControl.java:484)

    at oracle.jbo.uicli.binding.JUApplication.setErrorHandler(JUApplication.java:261)

    at oracle.adf.model.BindingContext.put(BindingContext.java:1340)

    at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:174)

    at oracle.adf.model.BindingContext.instantiateDataControl(BindingContext.java:1056)

    at oracle.adf.model.dcframe.DataControlFrameImpl.doFindDataControl(DataControlFrameImpl.java:1566)

    at oracle.adf.model.dcframe.DataControlFrameImpl.internalFindDataControl(DataControlFrameImpl.java:1438)

    at oracle.adf.model.dcframe.DataControlFrameImpl.findDataControl(DataControlFrameImpl.java:1398)

    at oracle.adf.model.BindingContext.internalFindDataControl(BindingContext.java:1189)

    at oracle.adf.model.BindingContext.get(BindingContext.java:1139)

    at oracle.adf.model.binding.DCParameter.evaluateValue(DCParameter.java:82)

    at oracle.adf.model.binding.DCParameter.getValue(DCParameter.java:111)

    at oracle.adf.model.binding.DCBindingContainer.getChildByName(DCBindingContainer.java:2713)

    at oracle.adf.model.binding.DCBindingContainer.internalGet(DCBindingContainer.java:2761)

    at oracle.adf.model.binding.DCExecutableBinding.get(DCExecutableBinding.java:115)

    at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:304)

    at oracle.adf.model.binding.DCBindingContainer.evaluateParameterWithElCheck(DCBindingContainer.java:1458)

    at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1588)

    at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2472)

    at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2416)

    at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3069)

    at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2876)

    at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3195)

    at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2876)

    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:115)

    at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareModel(FacesPageLifecycle.java:359)

    to oracle.adf.controller.v2.lifecycle.Lifecycle$ 2.execute(Lifecycle.java:137)

    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:197)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$ 400 (ADFPhaseListener.java:23)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$ PhaseInvokerImpl.startPageLifecycle (ADFPhaseListener.java:238)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$ 1.after(ADFPhaseListener.java:274)

    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:75)

    at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:472)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    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:301)

    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at alfaaesar.portal.pages.filter.AnonymousSessionFilter.doFilter(AnonymousSessionFilter.java:47)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.portlet.client.adapter.adf.ADFPortletFilter.doFilter(ADFPortletFilter.java:32)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.framework.events.dispatcher.EventDispatcherFilter.doFilter(EventDispatcherFilter.java:44)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)

    to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)

    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)

    to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)

    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:75)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.lifecycle.filter.LifecycleLockFilter.doFilter(LifecycleLockFilter.java:151)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)

    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:3730)

    to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3696)

    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:2273)

    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)

    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)

    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

    Caused by: java.sql.SQLRecoverableException: Connection closed

    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:4070)

    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:4008)

    at oracle.jdbc.OracleConnectionWrapper.createStatement(OracleConnectionWrapper.java:112)

    at weblogic.jdbc.wrapper.XAConnection.createStatement(XAConnection.java:623)

    at weblogic.jdbc.wrapper.Connection.createStatement(Connection.java:500)

    at oracle.jbo.pcoll.OraclePersistManager.queryNextCollectionId(OraclePersistManager.java:1459)

    ... more than 114

    # # 0 in detail

    java.sql.SQLRecoverableException: closing connection

    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:4070)

    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:4008)

    at oracle.jdbc.OracleConnectionWrapper.createStatement(OracleConnectionWrapper.java:112)

    at weblogic.jdbc.wrapper.XAConnection.createStatement(XAConnection.java:623)

    at weblogic.jdbc.wrapper.Connection.createStatement(Connection.java:500)

    at oracle.jbo.pcoll.OraclePersistManager.queryNextCollectionId(OraclePersistManager.java:1459)

    at oracle.jbo.pcoll.PCollManager.register(PCollManager.java:562)

    to oracle.jbo.pcoll.PCollection. < init > (PCollection.java:99)

    at oracle.jbo.pcoll.PCollManager.createCollection(PCollManager.java:461)

    at oracle.jbo.server.DBSerializer.setup(DBSerializer.java:153)

    at oracle.jbo.server.DBSerializer.passivateRootAM(DBSerializer.java:286)

    at oracle.jbo.server.DBSerializer.passivateRootAM(DBSerializer.java:267)

    at oracle.jbo.server.ApplicationModuleImpl.passivateStateInternal(ApplicationModuleImpl.java:6026)

    at oracle.jbo.server.ApplicationModuleImpl.passivateState(ApplicationModuleImpl.java:5877)

    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:386)

    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:9084)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4607)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.manageReferencingState(ApplicationPoolImpl.java:1493)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.finalizeResource(ApplicationPoolImpl.java:1393)

    at oracle.jbo.pool.ResourcePool.removeResourceInternal(ResourcePool.java:848)

    at oracle.jbo.pool.ResourcePool.setState(ResourcePool.java:1103)

    at oracle.jbo.pool.ResourcePool.removeResource(ResourcePool.java:860)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.removeDeadInstance(ApplicationPoolImpl.java:2736)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4638)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.manageReferencingState(ApplicationPoolImpl.java:1493)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.recycleReferencedInstance(ApplicationPoolImpl.java:2623)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2444)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2347)

    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3246)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:572)

    at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:505)

    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:500)

    at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:523)

    at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:869)

    at oracle.adf.model.binding.DCDataControl.setErrorHandler(DCDataControl.java:484)

    at oracle.jbo.uicli.binding.JUApplication.setErrorHandler(JUApplication.java:261)

    at oracle.adf.model.BindingContext.put(BindingContext.java:1340)

    at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:174)

    at oracle.adf.model.BindingContext.instantiateDataControl(BindingContext.java:1056)

    at oracle.adf.model.dcframe.DataControlFrameImpl.doFindDataControl(DataControlFrameImpl.java:1566)

    at oracle.adf.model.dcframe.DataControlFrameImpl.internalFindDataControl(DataControlFrameImpl.java:1438)

    at oracle.adf.model.dcframe.DataControlFrameImpl.findDataControl(DataControlFrameImpl.java:1398)

    at oracle.adf.model.BindingContext.internalFindDataControl(BindingContext.java:1189)

    at oracle.adf.model.BindingContext.get(BindingContext.java:1139)

    at oracle.adf.model.binding.DCParameter.evaluateValue(DCParameter.java:82)

    at oracle.adf.model.binding.DCParameter.getValue(DCParameter.java:111)

    at oracle.adf.model.binding.DCBindingContainer.getChildByName(DCBindingContainer.java:2713)

    at oracle.adf.model.binding.DCBindingContainer.internalGet(DCBindingContainer.java:2761)

    at oracle.adf.model.binding.DCExecutableBinding.get(DCExecutableBinding.java:115)

    at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:304)

    at oracle.adf.model.binding.DCBindingContainer.evaluateParameterWithElCheck(DCBindingContainer.java:1458)

    at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1588)

    at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2472)

    at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2416)

    at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3069)

    at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2876)

    at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3195)

    at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2876)

    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:115)

    at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareModel(FacesPageLifecycle.java:359)

    to oracle.adf.controller.v2.lifecycle.Lifecycle$ 2.execute(Lifecycle.java:137)

    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:197)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$ 400 (ADFPhaseListener.java:23)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$ PhaseInvokerImpl.startPageLifecycle (ADFPhaseListener.java:238)

    to oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$ 1.after(ADFPhaseListener.java:274)

    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:75)

    at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:472)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    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:301)

    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at alfaaesar.portal.pages.filter.AnonymousSessionFilter.doFilter(AnonymousSessionFilter.java:47)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.portlet.client.adapter.adf.ADFPortletFilter.doFilter(ADFPortletFilter.java:32)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.framework.events.dispatcher.EventDispatcherFilter.doFilter(EventDispatcherFilter.java:44)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)

    to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)

    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)

    to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)

    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:75)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.webcenter.lifecycle.filter.LifecycleLockFilter.doFilter(LifecycleLockFilter.java:151)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

    to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)

    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:3730)

    to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3696)

    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:2273)

    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)

    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)

    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

    ]]

    Table PXN_TXN, where the ADFBC tent passivate the StateFull AppModules State.

    (1) where you can hit this error is because you din't create / Create index of the privileges of the user who is using to connect to the DB.

    (2) ideally, the status of users is removed after the end of the session of the user, but when the app is closed unexpectedly due to the loss of Server/DB,

    State ID remains in the table and it is not recommended to clean the tables using the database standard PROCEDURE calls provided by Oracle oracle

    The following links will be useful to understand the function of the

    The application state management

    http://www.Veriton.co.UK/download/Practical_ADF_Application_Deployment.PDF

    Perform the following procedure, clean the tables PS_TXN to put in place the BC4J_CLEANUP PL/SQL package

    oracle_common/modules/Oracle.ADF.model_11.1.1/bin/bc4jcleanup. SQL

    Annex BC4J_CLEANUP. SESSION_STATE(24*60) using DBMS Scheduler to clean up the States for more than 24 hours.

  • Get the previous value of the sequence

    Oracle version
    10.2.0

    sequence
    CREATE SEQUENCE ADM_SQ_TABLE_GROUP
      START WITH 21
      MAXVALUE 999999999999999999999999999
      MINVALUE 1
      NOCYCLE
      CACHE 20
      NOORDER;
    Main table
    CREATE TABLE ADM_TL_TABLE_GROUPMST
    (
    TBGM_KEYID   VARCHAR2(6)    NOT NULL,
    TBGM_NAME    VARCHAR2(50)   NOT NULL,
    TBGM_CODE    VARCHAR2(15)   NOT NULL,
    CONSTRAINT PK_ADM_TL_TABLE_GROUPMST PRIMARY KEY (TBGM_KEYID),
    CONSTRAINT UK_TBGM_CODE UNIQUE(TBGM_CODE)
    );
    Insert values
    INSERT INTO ADM_TL_TABLE_GROUPMST VALUES (adm_sq_table_group.NEXTVAL, 'PCS TABLE GROUP', 'PCS');
    Table Details
    CREATE TABLE ADM_TL_TABLE_GROUPDTL
    (
    TBGD_KEYID  VARCHAR2(8) NOT NULL,
    TBGD_MASTERID VARCHAR2(6)    NOT NULL,
    TBGD_TABLENAME  VARCHAR2(30)    NOT NULL,
    TBGD_ORDER      NUMBER(2)   NOT NULL,
    CONSTRAINT PK_ADM_TL_TABLE_GROUPDTL PRIMARY KEY (TBGD_KEYID),
    CONSTRAINT FK_TBGD_MASTERID FOREIGN KEY (TBGD_MASTERID) REFERENCES  ADM_TL_TABLE_GROUPMST(TBGM_KEYID)
    );
    Insert the script
    INSERT INTO ADM_TL_TABLE_GROUPDTL VALUES (adm_sq_table_group.NEXTVAL, adm_sq_table_group.CURVAL, 'PCS_TL_MST', 1);
    How to get previously generated sequence values

    Use the VOTING class if you use PL/SQL

  • How to value all the sequence all the table schema/user

    Hello

    I use the Oracle 11 g server. I have a table close to 100. I want to know all the current sequence value ("Currval")
    of all the paintings in particular schema/user

    Please help me how can I get with this query

    Thanks in advance
    karmaya

    nordine B wrote:
    Try this...

    SELECT sequence_name, last_number FROM all_sequences
    where lower(sequence_owner) = '';
    

    HTH
    Vanessa B.

    Published by: Vanessa B December 3, 2012 13:25

    It is not always correct (again that depends on the condition)

    create sequence seq1 cache 100;
    
    SELECT sequence_name, last_number
    FROM all_sequences
    where sequence_name = 'SEQ1';
    
    SEQUENCE_NAME                  LAST_NUMBER
    ------------------------------ -----------
    SEQ1                                     1 
    
    select seq1.nextval from dual;
    
    NEXTVAL
    -------
          1
    
    SELECT sequence_name, last_number
    FROM all_sequences
    where sequence_name = 'SEQ1';
    
    SEQUENCE_NAME                  LAST_NUMBER
    ------------------------------ -----------
    SEQ1                                   101 --"Showing 101"
    
    select seq1.currval from dual;
    
    CURRVAL
    -------
          1 --"CURRVAL is different"
    
  • The value of the sequence to a field assignment

    Hi all

    Apex v3.2.1
    I created a form and a report on a single table. Column1 of the table is the primary key that is generated by a sequence of "seq_col1".
    In the form page the Column1 is not displayed because it is a generated sequence value that is not necessary for the user. The Column1 is hidden and protected.
    Now, when you insert a new record via the form, how do I put the Column1 as the seq_col1.nextval is inserted into the table?

    I make the assumption that you fill the column on a data, then click on create, then branch to a 2nd page to display the ID and the other data in the column.

    If all this is true, then:
    create a type of process after her submit PL/SQL that assigns the value to your page element which represents the "column 1" and displays the value of the ID. I'll call him P1_COLUMN1.
    You may need to make this hidden point rather than hidden and protected.

    Process is

        SELECT ATTACHMENT_ID_SEQ.NEXTVAL
           INTO :P1_COLUMN1
           FROM dual;
    

    Specify that the process is running when you press the button create.

    You then have a process that inserts the line?, or if you already have a DML process that inserts the line?

    Create a branch that goes to the 2nd page to display the value of Column1. I'll call this P2_COLUMN1.
    In the branch Enter defined these elements like P2_COLUMN1 and enter these values as & P1_COLUMN1. (Include the & and the point at the end)

    The flow rate is:
    The user enters the data on Page 1
    Click on create
    Sequence is assigned to the element of your page
    Line inserted
    Branch to page 2, page 2 section with 1 assigned page element layout
    View pag2 point 2 on page 2

    If it is not good so I need more specific information about your process flow.

  • How to insert a value of triggers in the table?

    Mr President.

    I have the following trigger

    CREATE OR REPLACE TRIGGER lineitem_trg 
    BEFORE UPDATE OF lineitem ON voucherdet
    FOR EACH ROW
    BEGIN 
        :NEW.LINEITEM := TO_CHAR ( TO_NUMBER (:OLD.LINEITEM) + 1 , 'FM00' ); 
    END  lineitem_trg; 
    /
    

    Now to how to add this triggers a value in the table

    The value of this trigger is part of the primary key with voucher_id which is obtained by the voucher_id_seq

    This is my database as below

    CREATE TABLE "NOM"  (
      "ACCT_ID" VARCHAR2(7) NOT NULL ENABLE, 
      "ACCT_NAME" VARCHAR2(50) NOT NULL ENABLE, 
      "O_BAL" NUMBER(13,2), 
      "ITAX_ID" VARCHAR2(7), 
      "SALES_TAX_NO" VARCHAR2(20), 
      "PL_SUPPLIER" VARCHAR2(1) DEFAULT 'N', 
      "STOCK_REPORT" VARCHAR2(1) DEFAULT 'N', 
      "ACCT_TYPE" VARCHAR2(4), 
      CONSTRAINT NOM_PK PRIMARY KEY ("ACCT_ID")ENABLE, 
      CONSTRAINT NOM_ACCT_TYPE_FK FOREIGN KEY ("ACCT_TYPE")
       REFERENCES "ACCT_TYPE" ("ACCT_TYPE") ENABLE
       );
    CREATE TABLE "VOUCHER" (
      "VOUCHER_ID" VARCHAR2(8) NOT NULL ENABLE, 
      "VOUCHER_DATE" DATE DEFAULT sysdate, 
      "POST_DATE" DATE DEFAULT sysdate, 
      "DEBIT" VARCHAR2(7), 
      "CREDIT" VARCHAR2(7), 
      "VOUCHER_SOURCE" VARCHAR2(2), 
      CONSTRAINT VOUCHER_PK PRIMARY KEY ("VOUCHER_ID")ENABLE, 
      CONSTRAINT VOUCHER_NOM_DEBIT_FK FOREIGN KEY ("DEBIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE, 
      CONSTRAINT VOUCHER_NOM_CREDIT_FK FOREIGN KEY ("CREDIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE
       );
    
    
    CREATE TABLE "VOUCHERDET" (
      "VOUCHER_ID" VARCHAR2(8) NOT NULL ENABLE, 
      "DEBIT" VARCHAR2(7) NOT NULL ENABLE, 
      "CREDIT" VARCHAR2(7) NOT NULL ENABLE, 
      "PARTICULARS" VARCHAR2(100), 
      "AMOUNT" NUMBER(21,2),
      "LINEITEM" VARCHAR2(4) DEFAULT '01', 
      "V_ID_ITAX" VARCHAR2(11), 
      "V_ID_PAY" VARCHAR2(11), 
      "CHALLAN_NO" VARCHAR2(10), 
      CONSTRAINT VOUCHERDET_PK PRIMARY KEY ("VOUCHER_ID", "LINEITEM")ENABLE, 
      CONSTRAINT VOUCHERDET_DEBIT_FK FOREIGN KEY ("DEBIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE, 
      CONSTRAINT VOUCHERDET_CREDIT_FK FOREIGN KEY ("CREDIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE, 
      CONSTRAINT VOUCHERDET_VOUCHER_FK FOREIGN KEY ("VOUCHER_ID")
       REFERENCES "VOUCHER" ("VOUCHER_ID") ON DELETE CASCADE ENABLE
       );
    
    
    
    

    CREATE SEQUENCE VOUCHER_ID_SEQ INCREMENT BY 1 START WITH 1;
    
    
    begin
     execute immediate 'create or replace trigger VOUCHER_ID_TRG  '||chr(10)||
      '   before insert on "ALIZA"."VOUCHER" '||chr(10)||
      '   for each row '||chr(10)||
      'begin  '||chr(10)||
      '   if inserting then '||chr(10)||
      '      if :NEW."VOUCHER_ID" is null then '||chr(10)||
      '         select VOUCHER_ID_SEQ.nextval into :NEW."VOUCHER_ID" from dual; '||chr(10)||
      '      end if; '||chr(10)||
      '   end if; '||chr(10)||
      'end;'||chr(10);
      end;
      /
    
    
    
    
    

    Concerning

    And I explained to you why it is false.

    Go one read what I put above, and I gave an example of (with command and control elements) in the other thread.

    If you want the user a composite key as the primary key by using the primary key of the voucher and something else, do this thing, just a sequence that is obtained from a sequence value (not gapless, but always unique).  And then you always build your LINEITEM values for display based on this sequence for example

    LPAD (to_char (ROW_NUMBER () over (partition by order VOUCHER_ID by LINEITEM)), 2, '0') as a CONTROL element

    It's when you query the data to display it, is not to store it in the database.  In the database, you simply store an internal sequence number in LINEITEM.

    Do not try and store a sequence for your lineitem gapless.  It is false.

Maybe you are looking for

  • Car

    I want to connect my phone to my car and use GPS on screen in my digital display.

  • Using the numerical key

    I tried to use Touch Digital with my daughter who is also a Apple Watch. For some reason, all the efforts I made to send a picture, or touch or heart rate results in an error, or at least him coming back and saying: "Touch Digital", then "Failed to s

  • Satellite A200 - 1 GB & Memory Stick Pro Duo

    Can I use the maps "Memory Stick Pro Duo" in my Satellite A200 - 1 GB? Thank you Ulises.

  • HOW to make NI6537 work 2.5 v voltage level

    Hi all I just check on the datasheet of NI6537, it shows this work card to 2.5V 3.3V kinds of digital output voltage levels. But the default setting is 3, 3V. So, how do we define to 2.5 v (to the digital output) (using C++). I had once a function: I

  • Windows Photo Gallery is not print in color

    Windows Photo Gallery will not print in color, all other programs print in color. The cartridge made obvious, new color, printing preference etc. If I move the picture to a different file, i.e. MS Word, it will BE PRINTED in color. Am running Vista 3