Use of 'sequence-next-val' in JDEV

All,
As part of my ESB project, I'm integration an appln. with Oracle EBS. My requirement is to populate a field with a sequence value. I found there is a db function in Jdev. As per the note, I used the 'sequence-next-val' function to generate sequence. In the function parameter 'sequence' I added the sequence as given in the note (orcl:sequence-next-val('<actualsequencename>,'jdbc:oracle:thin:<user>/<pwd>@<localhost>:1521:<SID>'). When I try to save the proejct, I got the following error
' (2):sequence-next-val: Error: Function with Too Few Parameters'. I'm clueless what could be the issue?
Any help on this is highly appreciated.
Regards,
sen

Hi sen,
The function orcl:sequence-next-val takes 2 parameters. It return the next value of an Oracle sequence. It is similar to sequence generation what we see in Oracle sql.
How to proceed:
First of all you need to drap that function to the tranformation swimlane. Create a database sequence, say,TEST. This will be the first parameter for the function.
The second parameter will be your database connection details, i.e. the database in which your source table is defined.
Suppose your database is having details as:
Username: abhi
Password: abhishek
Host: 172.128.5.13
Port: 1521
SID: Oracle
so the second parameter will look like this:
'jdbc:oracle:thin:abhi/[email protected]:
1521:Oracle'
or for the second parameter you can add a datasource entry in data-sources.xml file under soa_home\j2ee\oc4j_soa\config.
Say the datasource name is BPEL_DBS. so the function will look like,
orcl:sequence-next-val('TEST','jdbc/BPEL_DBS')
After doing this, map it to the destination field.
Cheers,
Abhi...

Similar Messages

  • Error while generating the seqence in soa 11g orcl:sequence-next-val

    Hi,
    In bpel we are using sequence-next-val, we are getting the below error. Anyone could you please let me know what might be the issue.
    Error :
    An error occurs while processing the XPath expression; the expression is orcl:sequence-next-val(&quot;XXSOA_MTR_BATCH_S&quot;,&quot;jdbc/XXSOADataSource&quot;).
    The XPath expression failed to execute; the reason was: internal xpath error.
    Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    <stack>
    <f>com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate#262</f>
    <f>com.collaxa.cube.engine.ext.bpel.common.BPELWMPHelper.evalFromValue#339</f>
    <f>com.collaxa.cube.engine.ext.bpel.v1.wmp.BPEL1AssignWMP.__executeStatements#137</f>
    <f>com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform#158</f>
    <f>com.collaxa.cube.engine.CubeEngine._performActivity#2463</f>
    <f>com.collaxa.cube.engine.CubeEngine.performActivity#2334</f>
    <f>com.collaxa.cube.engine.CubeEngine.handleWorkItem#1116</f>
    <f>com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal#73</f>
    <f>com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage#220</f>
    <f>com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory#328</f>
    <f>com.collaxa.cube.engine.CubeEngine.endRequest#4350</f>
    <f>com.collaxa.cube.engine.CubeEngine.endRequest#4282</f>
    <f>com.collaxa.cube.engine.CubeEngine.createAndInvoke#679</f>
    <f>com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke#654</f>
    <f>com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke#293</f>
    <f>sun.reflect.NativeMethodAccessorImpl.invoke0</f>
    <f>...</f>
    </stack>
    </exception>
    <root class="javax.xml.xpath.XPathExpressionException">internal xpath error<stack>
    <f>oracle.xml.xpath.JXPathExpression.evaluate#242</f>
    <f>com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate#240</f>
    <f>com.collaxa.cube.engine.ext.bpel.common.BPELWMPHelper.evalFromValue#339</f>
    <f>com.collaxa.cube.engine.ext.bpel.v1.wmp.BPEL1AssignWMP.__executeStatements#137</f>
    <f>com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform#158</f>
    <f>com.collaxa.cube.engine.CubeEngine._performActivity#2463</f>
    <f>com.collaxa.cube.engine.CubeEngine.performActivity#2334</f>
    <f>com.collaxa.cube.engine.CubeEngine.handleWorkItem#1115</f>
    <f>com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal#73</f>
    <f>com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage#220</f>
    <f>com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory#328</f>
    <f>com.collaxa.cube.engine.CubeEngine.endRequest#4350</f>
    <f>com.collaxa.cube.engine.CubeEngine.endRequest#4281</f>
    <f>com.collaxa.cube.engine.CubeEngine.createAndInvoke#679</f>
    <f>com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke#654</f>
    <f>com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke#293</f>
    -Thanks
    GVS

    Thanks for your reply. Well, I believe I know what the problem was. I used the JNDI name from the connection factory in the DB adapter eis/DB/my_ds. It did not like that. However, when I used the datasource's JNDI location jdbc/my_ds, it worked like a charm.

  • Sequence-next-val in xsl

    I need to populate a db field with a value from a sequence I have in my database. When I drag the database function "sequence-next-val" into the middle swim lane and open it the "Add" and "Remove" buttons are ghosted. The labels for "sequence" and "datasource" seem to be ghosted as well. How do I get my sequence in this? I would assume that the "add" button would do what I need if I could get to it.
    Thanks,
    Mark

    If someone else tries sequences in 10.1.2.0.2 here is how I finally got it to work.
    Part of my issues are being new and part to BPEL. What I had to do was enter the sequence name in quotes (as expected). Enter the datasource as "jdbc:oracle:thin:mydb/mydbpwd@localhost:1521:ORCL" (again as expected) and then save, deploy and shut down and restart the development PM Server.
    It looks like it must be shut down and restarted each time a new sequence is added for it to take effect. This makes it hard to know why the sequence doesn't work when it seems like it is all good. It was odd that the xsl test seemed to work but deployment didn't. But once you restart the PM server it goes. Hope this helps.
    Mark

  • Using a sequence in mysql with Jdev

    Hi
    I created a Form in jdev that access mysql, if i tried to create a new record, i need to insert next id or i guess i have to create a trigger, since mysql does not have a sequence,
    mysql have an autonumber, and if i insert a record , i need to commit the record .
    do you have a solution how to best deal with the process of creating a records on Form with mysql.
    Thank You for your help!
    David

    See the section in this doc:
    http://www.oracle.com/technology/products/jdev/11/how-tos/multidatabaseapp.html

  • Orcl:sequence-next-val

    Hi
    I saw many discussions in the functions, but couldnt get an answer. I wanted to know if passing the JNDI connection identifier as second parameter works or not. I tried passing the same but got time out exceptions (which means it didnt work)
    If this works can some one please show me the connection identifier in the xml file oc4j-ra.xml , and also the right syntax to call it , or are there any examples provided for this.
    If this doesnt work what is the way to do this , i mean get the next sequence value. I cannot use the jdbc url as it is a production instance.
    Really appreciate your help on this.
    Thanks
    -Pradip

    Hey,
    You might be having problem with the datasource. One to check this is :
    1. Go TO Enterprise Manager
    2. Go To DataSources
    3. Click Test Connection for your Datasource
    4. Type your sql: select schemaname.SequeceName.nextval from dual
    5. Click test.
    6. If you get confirmation message "Connection to "DataSource" established successfully"
    that means your datasource is working fine and you have coding issue.
    7. If it you dont get above message then check the datasource configuration.
    Let me know if it help.
    Regards,
    Yogesh

  • Generating a Primary Key WITHOUT using a Sequence Number

    Hi Everyone:
    I am trying to generate a primary key without using a sequence number or row count. What the user wants is the maximum value of the highest primary key already in the row set plus 1.
    For example, this is a Oracle Table (eg. named BatchSubmit) used to initiate batch job submission, and the primary key is an integer named "Runcard_Number". If there are 4 rows in this table and the Runcard_Numbers are 2, 6, 8 & 12, then the next generated Runcard_Number would be 13.
    I have looked throughout this forum and see how to generate numbers using a DBSequence, but the user does not want that. The numbers mean something to them, and they don't want them randomly assigned other than the max in the rowset plus 1. To do it in SQL it would be - select max(Runcard_Number) + 1 from BatchSubmit;
    I have been looking at using a hasnext loop and moving the maximum value to the new Runcard_Number, but I am very new to JHeadstart/JDev and I do not know where to put this. I am assuming the BatchSubmitImpl.java, but I'm not sure where to put it or which method to utilize
    I would appreciate any assistance.
    Mary
    U o Windsor

    Mary you're in luck, 'cause, I've been playing with the same thing, these days and found that..
    You can do that in two ways (that I know):
    - by calling a stored function that does max+1 (you can look it up in Dev's guide for Forms&4GLDevs 10g chapter 25.5 Invoking Stored Procedures and Functions)
    - by calling hardcoded or dinamicaly written statement, that does the same
    public Number callStatement(String stmt)
    Number id = new Number(0);
    Row idRow = getDBTransaction().createViewObjectFromQueryStmt(stmt).next();
    if(idRow != null)
    Object o = idRow.getAttribute(0);
    if(o != null)
    if(o instanceof Number)
    id = (Number)o;
    else
    throw new JboException("Conversion error!");
    return id;
    You should call it in
    protected void doDML(int operation, TransactionEvent transactionEvent)
    switch (operation)
    case DML_INSERT:
    // call here
    super.doDML(operation, transactionEvent);
    break;
    case DML_UPDATE:
    super.doDML(operation, transactionEvent);
    break;
    case DML_DELETE:
    super.doDML(operation, transactionEvent);
    break;
    Enjoy!
    S. Julijan

  • Problem with the browse sequence back and browse sequence next widget placed in the screen layout

    Hi,
    Some basics: We are using Robohelp 10 to  generate multiscreen  html5 output. We used the pharmaceutical  screen layout downloaded from:  http://helpx.adobe.com/robohelp/robohelp-screen-profiles-layouts.html but modified it to match our GUI.
    We are having a problem with the browse sequence back and browse sequence next buttons placed in the screen layout from the widgets tool bar. We are in no way experts at this part of Robohelp...and the css portion of all this is a bit of mystery but we have managed to get mostly what we need. Now we just need these buttons to work. In the past we used Airhelp and things worked great. Can anyone help us understand why the sequence buttons are not showing up in the output even though it does in the topic preview?
    Also
    This shows up in the  layout.css file:
    a.wBSBackButton {
                    margin: 0 8pt 0 0;
                    padding: 0;
                    background-color: transparent;
    img.wBSBackButton {
                    border: none;
    a.wBSNextButton {
                    margin: 0 8pt 0 0;
                    padding: 0;
                    background-color: transparent;
    img.wBSNextButton {
                    border: none;
    Also btw, I forgot to mention that we are linking our FrameMaker files.
    Appreciate the help.
    Thanks!

    hi pradeep
    It does not happen but if you Wait for a while that may be solved

  • ODI 10G Using ODI sequences row by row

    Hi everyone,
    I have source as FILE system(All_files.txt) it has just one column :example1.txt,example2.txt etc..
    My source table like this:
    FLAT_FILE(FILE):
    FILE_NAME String(100)
    TARGET(Oracle)----->HR.TMP_ALL_FILES
    FILE_NAME(:FILE_NAME(VARCHAR2 100))
    LOAD_ID(NUMBER)-->ODI_SEQ_NEXTVAL
    CRE_DT(SYSDATE)
    Now I am using odi seq is called ODI_SEQ that I mapped into LOAD_ID.But I want to get row by row sequences like:1,2,3,4.....
    My target must be like this:
    example1.txt 1 sysdate
    example2.txt 2 sysdate
    example3.txt 3 sydate.
    How Can ı get row by row using ODI sequence?
    Edited by: aetl on Dec 17, 2012 12:30 AM

    Hi aetl,
    I might be wrong but I think that if you use a set-based IKM (like IKM SQL Control Append), the value will only change for the next set.
    You can use an Oracle Sequence instead, this will change row-by-row.
    Regards,
    JeromeFr

  • How to use parallel sequence for split the operation qty. urgent or other o

    PP guru
    My scenario is as follows.
    I ve one material suppose…xyz.
    For that material I' ve created bom, routing.
    In routing I' ve mention only one operation. 0010.
    Now I' ve the production order of 1000 kg.
    I want to use two work centers to run this production order. ( e.g.work center a and b)
    In routing I used work center a.
    In short I want split that operation.
    So what I ve to do or use parallel sequence and how???
    or else is there any other option to split the order to two or more machines/work center?
    Pls explain me in brief.
    Regards,
    Ram

    Hi,
      If you want to carry the production with two different work centers , first you need to split the operation qty.
    For this in the order type dependent parameters OPL8
    in the controlling tab page enable the indicator Cost collector
    and set the default rule as PP2.
      Create a Product cost collector with KKF6N.
       Now in the production order , select the operation and choose functions--->>> split.
       Now enter the operation split quantity and execute.
       Now in MD04 you can see two production order.
       In the second production order change the work center in the operation overview as desired and save.
      Regards,
    nandha

  • Use a sequence template multiple times in same project

    I have created a lower-third animated title and saved it as a sequence as it has sound. What I'm confused about it how I import that sequence and use it multiple times in the same project and change the content of the title for each sequence. If I import the sequence and change the title in one instance, it changes the title of all instances. I would like to use the sequence and be able to change each title. I have even tried copying sequences and renaming them but any editing still seems to affect the parent sequence file.
    I know this must be really simple but I'm going round in circles here. Any pointers appreciated.

    Take a look at this thread:
    style sheets for titles?
    I'm not sure if an AFX Live text will bring over the audio, it is not something I have tried.

  • Is there a way to enforce the use of sequences

    is there a way to stop someone from inserting an id without using the sequence?
    CREATE SEQUENCE id_seq
       START WITH 1;
    CREATE TABLE test_table (id_seq NUMBER (4) PRIMARY KEY);
    INSERT INTO test_table
         VALUES (id_seq.NEXTVAL);
    INSERT INTO test_table
         VALUES (2);
    INSERT INTO test_table
         VALUES (id_seq.NEXTVAL);gives us
    ORA-00001: unique constraint (DSAMSTRC.SYS_C0091648) violated
    as it should
    however is there a check constraint of some ilk that ensures that the user is using the sequence when doing inserts?
    so that the second insert
    INSERT INTO test_table
         VALUES (2);gives me some sort of check constraint violation that I'm not using the id_seq.NEXTVAL ?

    Justin:
    One minor problem with your trigger. If the "bad" insert is the first thing done in the session you get:
    SQL> insert into test_table values(25);
    insert into test_table values(25)
    ERROR at line 1:
    ORA-08002: sequence ID_SEQ.CURRVAL is not yet defined in this session
    ORA-06512: at "OPS$ORACLE.TRG_TEST_TABLE", line 4
    ORA-04088: error during execution of trigger 'OPS$ORACLE.TRG_TEST_TABLE'If you want to raise an exception instead of just silently using the sequence as Frank suggests you need something more like:
    create trigger trg_test_table
       before insert on test_table
       for each row
    declare
       l_currval integer;
       no_currval exception;
       PRAGMA EXCEPTION_INIT (no_currval, -8002);
    begin
       select id_seq.currval
       into l_currval
       from dual;
       if( l_currval != :new.id_seq ) then
          raise_application_error( -20001, 'Hey!  Use the sequence' );
       end if;
    exception
       when no_currval then
          raise_application_error( -20001, 'Hey!  Use the sequence' );
    end;John

  • Using Database Sequence in Interface with Union

    Hi Gurus,
    I have Oracle 11gR2 database as my Source and Target.
    When I try to use Database Sequence along with an Interface having set operator like Union , I am getting the following error:
    ODI-1227: Task eSIS_Student_U1_Fact (Export) fails on the source ORACLE connection ESISDW.
    Caused By: java.sql.SQLSyntaxErrorException: ORA-02287: sequence number not allowed here
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
         at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
         at oracle.odi.query.JDBCTemplate.executeQuery(JDBCTemplate.java:189)
         at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:89)
         at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
         at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:70)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:662)
    Is there any work around to use Database Sequence along with the Interface?
    Regards,
    Sai.

    Hi Arv,
    Thanks for the reply. I tried that also, but still no luck.
    Regards,
    Sai.

  • Using a sequence inside BEFORE TRIGGER

    Hi all,
    I just created a testtable and a sequence to use as a primary key column value for that table.
    I tried to create a BEFORE INSERT trigger on that table and in the trigger i tried to set up the primary key column value using the sequence
    but while compiling i am getting the error "Error(9,30): PLS-00357: Table,View Or Sequence reference 'SEQ_OF_TESTTABLE.NEXTVAL' not allowed in this context"
    My Version:Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    All the objects created with the same user. I would appraciate any help, thanks all
    EDIT
    I solved the problem using the below
    create or replace
    TRIGGER Bef_Ins_On_Testtable
    BEFORE INSERT ON TestTable
    FOR EACH ROW
    declare
    ntemp_id INT;
    BEGIN
    SELECT SEQ_OF_TESTTABLE.NEXTVAL INTO ntemp_id FROM DUAL ;
    DBMS_OUTPUT.PUT_LINE('İNSERTED');
    :NEW.VSURNAME := 'HAKKİ' ;
    :NEW.NID := ntemp_id;
    END;But i wonder why i can use the sequence(just as seqeunce_name.NEXTVAL) in INSERT statement and why cant in trigger?
    Edited by: user9371286 on 31.Tem.2010 04:15
    Edited by: user9371286 on 31.Tem.2010 04:21
    Edited by: user9371286 on 31.Tem.2010 04:27

    Please post your trigger code and your database version ( the result of: select * from v$version; ).
    Put it between tags, so your example will stay formatted.
    (see: http://forums.oracle.com/forums/help.jspa for more examples regarding tags)
    "PLS-00357: Table,View Or Sequence reference "string" not allowed in this context
        Cause: A reference to database table, view, or sequence was found in an inappropriate context. Such references can appear only in SQL statements or (excluding sequences) in %TYPE and %ROWTYPE declarations. Some valid examples follow: SELECT ename, emp.deptno, dname INTO my_ename, my_deptno, my_dept .FROM emp, dept WHERE emp.deptno = dept.deptno; DECLARE last_name emp.ename%TYPE; dept_rec dept%ROWTYPE;
        Action: Remove or relocate the illegal reference."
    +http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/plsus.htm#sthref13592+
    You can find examples of triggers referring to sequences here, by doing a search on this forum or:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#ABC1032282                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Use of Sequence in Match-Merge

    Dear All,
    I have a source table containing name and address data. I want to do householding, which means I need to split the data using a match-merge operator. The address data is the merged output, and the name data is the cross-reference output. All well and good so far.
    I want eventually to load the outputs into two levels of a Customer dimension (although for testing right now, I'm just using two ordinary target tables). I know that I will need a 'business key' to link the merged and the cross-reference outputs (as the two dimensional levels). I decide that I shall create a column in both outputs called HH_SEQ, and load this Household Sequence number from a Sequence (which I prepared earlier).
    In Merge Rules, for the Attribute HH_SEQ, I use a Rule Type of Sequence, and select the appropriate Sequence from the drop-down list box. I map this attribute in the MERGE outgroup to the appropriate column in the target merged table, and MM_HH_SEQ in the XREF outgroup to the appropriate column in the target cross-reference table.
    Here is the issue: to get HH_SEQ to be available as a potential Output Attribute in either Merge Output or Cross-Reference Output, it must first be present as a Source Attribute. Which means I had to add it to Input Attributes first. But of course it is not on my input source table! And thus I get a "VLD-1000 Input parameter INGRP1.HH_SEQ does not have input" warning.
    Either I'm just not understanding how to use the Sequence rule type properly (the documentation is pretty atrocious, mind), or there is some technique required here that is just not apparent from several days of experimentation.
    All help gratefully received!
    Regards,
    Donna
    p.s. it does actually compile and run just fine!

    Hi Donna
    I think you are using it in the correct way! I've seen other examples like this from the MM creators.
    The warning can be ignored, I think it is there to highlight a potential issue if it was being used for a scenario other than what you are doing.
    Cheers
    David

  • How to use new sequence when one is reached its maxvalue in PL SQL code

    Hi,
    Currently, I am populating a unique product serial number in a table column using a sequence call to generate new number. For different products, I have different sequences and in my PL SQL code usiing IF..Else block I populate serial number for different products. For one most selling product sequence, we are reaching a Max value in production in a month and to make sure that application will continue to work fine for various end users without getting any error on their screens, I want my code to switch to new sequence automatically. I just need to add another if condition but my problem is how to find accurately when max value is reached for old sequence.
    As call to old sequence can happen in different sessions there could be inconsistency and can end up at error. My new sequence value has to start with AV1000. Please suggest.
    My old sequence look like this :
    SEQUENCE Prd
    INCREMENT BY 1
    START WITH AS1000
    MAXVALUE AS9999
    MINVALUE AS1000
    CYCLE NOCYCLE
    CACHE 2
    Order Yes;
    Edited by: user11695088 on Jul 15, 2009 12:14 AM

    Catch the exception and use your new sequence. But somehow, I'm not liking your alternative approach.
    SQL> set line 300
    SQL> set pages 50000
    SQL> set serveroutput on
    SQL> create sequence testing_seq increment by 1 start with 1 maxvalue 3
      2  /
    Sequence created.
    SQL>
    SQL> create or replace procedure test_seq_proc(p_seq out number)
      2  is
      3  begin
      4     select testing_seq.nextval
      5     into p_seq
      6     from dual;
      7  --
      8     dbms_output.put_line(p_seq);
      9  --
    10  end;
    11  /
    Procedure created.
    SQL> declare v_out number;
      2  begin
      3     test_seq_proc(v_out);
      4  end;
      5  /
    1
    PL/SQL procedure successfully completed.
    SQL> /
    2
    PL/SQL procedure successfully completed.
    SQL> /
    3
    PL/SQL procedure successfully completed.
    SQL> /
    declare v_out number;
    ERROR at line 1:
    ORA-08004: sequence TESTING_SEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated
    ORA-06512: at "ETL_ADMIN.TEST_SEQ_PROC", line 4
    ORA-06512: at line 3
    SQL>Cheers
    Sarma.

Maybe you are looking for

  • Loops appear twice in the loop browser. Huh?

    I just installed iLife '06 and have been "messing around" with the various programmes. One thing I noticed was that exactly the same loops appear twice in the loop browser. Not all loops are doubled, which is obviously what is confusing me. Is this n

  • Unable to pick up the file from Receive Location

    BizTalk is  unable to pick up the files from receive location. My admin console is working so slow. It is showing the problem of snap-in as follows: I have checked all my receive location and its masking,it is working fine. Actually it is working fin

  • CC Desktop App Download Error

    I cannot access any of my CC apps due to a download error with the Creative Cloud desktop app.  In the CC desktop app, under the 'Apps' tab, I should be seeing all my downloadable/updatable/etc CC apps, but I am instead presented with 'Download Error

  • IMessage won't switch to SMS when out of the data/wifi range

    my boyfriend has his imessage switched off sometimes, and when he is out of his home and has no wifi or data my messages still send as imessages and won't let me manually switch them to SMS so he never gets the messages. It says it delivers as an ime

  • CR 2008 SP1 Error 1500 'Another installation is in progress'

    Hi, I'm attempting to install the SP1 for Crystal Reports 2008. When I get to the actual installation phase after extracting all the files and agreeing to the T&C's i get the following message: "Error 1500. Another installation is in progress. You mu