Resetting the Sequence operator in OWB

I have a Sequence operator for one column in the mapping. It correctly increments by 1 for each row (nextval) . I have done some testing and now I want to reset the next increments. Like I want to start from 1 instead of some 588 like that which is result of my testing.
How to reset the sequence operator so that it starts from 1 again.
Thanks

Hi Tom,
First you should create a store procedure that resets the last_number of a specified sequence w/ parameters sequence_name and start value. Then just call the stored proc from OWB to reset your sequence.
--stored proc ex:
create or replace PROCEDURE reset_sequence (
seq_name IN VARCHAR2, startvalue IN PLS_INTEGER) AS
cval INTEGER;
inc_by VARCHAR2(25);
BEGIN
EXECUTE IMMEDIATE 'ALTER SEQUENCE ' ||seq_name||' MINVALUE 0';
EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual'
INTO cval;
cval := cval - startvalue + 1;
IF cval < 0 THEN
inc_by := ' INCREMENT BY ';
cval:= ABS(cval);
ELSE
inc_by := ' INCREMENT BY -';
END IF;
EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name || inc_by ||
cval;
EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual'
INTO cval;
EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name ||
' INCREMENT BY 1';
END reset_sequence;
--calling stored proc ex:
--sequence name is employees_seq; reset value to 1
DECLARE
SEQ_NAME VARCHAR2(200);
STARTVALUE PLS_INTEGER;
BEGIN
SEQ_NAME := 'EMPLOYEES_SEQ';
STARTVALUE := 1;
RESET_SEQUENCE(
SEQ_NAME => SEQ_NAME,
STARTVALUE => STARTVALUE
END;
Hope it works! Cheers!=)
Regards,
Carlo

Similar Messages

  • Connecting the Sequence Operator to the Mapping Output Parameter?

    my OWB Client: 10.2.0.2.8
    my OWB Repository: 10.2.0.2.0
    I need to obtain a sequence number (from the Sequence Operator), then output it
    using the Mapping Output Parameter, if possible.
    I have tried two things:
    1. Connect Sequence Operator nextval variable to the Mapping Output Parameter.
    This generates error:
    "Table,View Or Sequence reference 'xx_SEQ.NEXTVAL' not allowed in this
    context"
    2. Join the Sequence Operator nextval variable with a source table, then
    connect a port from the dataflow to Mapping Output Parameter.
    This generates error:
    "Mapping Input Parameter and Mapping Output Parameter are intended to be
    executed before and after the data flow of the mapping and cannot accept
    inputs from any part of the data flow."
    From what I have seen so far, it appears it may not be possible to use the
    Sequence Operator along with the Mapping Output Parameter. If Im wrong, please
    let me know of an example of how the Sequence Operator and Mapping Output
    Parameter can be connected.
    Thanks

    User -
    Look at adding a Post-Mapping Process to your mapping, there you have a choice of built in functions or custom ones that could return a sequence value for you. You may have to create the sequence outside of OWB ...
    TXB

  • Problems with Sequence Operator in OWB

    Hi everybody,
    i want to use a sequence in my mapping. Now i have two problems.
    The first problem is the following. When i want to import my sequence (exists on my DB) i can select the sequence in the Selection Window, but when i click on Import i didn't see it in the Design Center, also there is no window which tells me that i have successfully imported the sequence.
    The second problem is, when i drag the Sequence Operator into my Mapping i shows the Selection Window where i have to select the poject and object to bind the operator. But i can't select any object.
    Can anyone help me with my problems and tell me how i can use a Sequence and the Sequence Operator in my Mapping
    Many thanks in advance.
    Greetings

    Hi everyone!
    I'm having a repeated problem with sequences in OWB: I'm filling a TIME table with 1096 rows. Now matter how and when I create the sequence it always starts with 2 instead of 1. Moreover, the last value of the sequence is 1101, when it was supposed to be 1097 or 1098....
    I did achieve the right ouput sometimes, but I must be doing something wrong. Here are the several ways I've tried in OWB:
    1) I've created all the sequences by sql code, in SQL DEVELOPER or PLUS*, and then imported to OWB. Because of being imported, I didn't have to deploy each sequence. Then, I've connected (by drag and drop to the canvas mapping) the sequence I wanted with NEXTVAL (as I always do) attached do TIME_ID of table TIME;
    2) I've dropped and created, several times(as before), the sequences and never had problems..until now. I've also experimented creating, by scratch, the sequences just in OWB and then deploy them in Control Center. After this, deployed the mapping and executed, just like in 1).
    So, the difference lies on how I create the sequences and what are the correct steps to create, deploy (if needed), deploy the map and execute the map.
    This is insain and I really need this to work. I've tried so many ways....
    Could someone PLEASE help me with this? Any thoughts?

  • Reset the sequence

    Hi,
    I have a set of statements in the procedure as below :
    This is a daily job. we are planning to reset the Sequence on daily basis.
    Is there any other way instead of resetting the sequence?  We are resetting because todays number may come tomorw also.
    select SEQ_NAME.nextval into No_Col from dual;
    insert into table
        (No,NoDAYWISE,Method)
        values ( No_Col, to_char(sysdate, 'DD') || to_char(sysdate, 'MM') ||
               to_char(sysdate, 'YY') || No_Col, 10)
    This is the table structure
    No
    NoDAYWISE
    Method
    181
    300813181
    421
    161
    160813161
    421
    201
    160913201
    421
    Thanks in advance.

    I agree with Paul's comment. Sequences are meant to generate unique numbers.
    If you are bend to implement this, below script might help you:
    drop sequence test_seq;
    create sequence test_seq start with 1 nocycle nocache;
    select test_seq.nextval from dual;
    select test_seq.nextval from dual;
    select test_seq.nextval from dual;
    select test_seq.nextval from dual;
    select test_seq.nextval from dual;
    set serveroutput on;
    declare
      v_num number;
    begin
      select 1 - test_seq.nextval into v_num from dual;
      dbms_output.put_line('Before reset Seq val :: ' || v_num);
      execute immediate 'alter sequence test_seq increment by ' || v_num;
      select test_seq.nextval into v_num from dual;
      dbms_output.put_line('After reset Seq val ::' || v_num);
      execute immediate 'alter sequence test_seq increment by 1';
    end;
    An easier way to achieve is, drop the sequence and create it again; this and even the above, I do not recommend.

  • How to insert a record & reset the sequence for all record

    Hi All,
    I am using Oracle Form 6i. In one of my forms,
    I need to delete all records id and reset the ids in a sequence when i do a new insert
    id value
    1 x
    2 y
    3 z
    when i insert a record 4 between 2 & 3 records with value 'A'
    id value
    1 x
    2 y
    3 z
    4 A
    what i need to modify
    id value
    4 x
    5 y
    6 A
    7 z
    i tried pre-insert trigger by going to first record & looping . no luck.
    Could anyone suggest me.
    thanks
    Red
    Edited by: Red on Sep 15, 2008 7:11 AM

    Would it not be fine if you ensure that all your commit actions are coded as,
    Do_Key ('COMMIT_FORM') correction: In regards to u3's response
    You would also have to override relevant key trigger behavior to check for form changes.
    KEY-ENTQUERY, KEY-EXECQUERY, ....
    If your form is a master detail form, On-Clear-Details (This is a tricky one to maintain :-))
    Edited by: easot on Sep 16, 2008 6:32 PM
    correction

  • Illegal use of sequence operator

    Hi All,
    In my map I am using a sequence in the expression operator and then I am putting the output to a joiner and after that data is moved to target table but while validating this map I am getting error:sequence operator r used in complex mapping which requires generation using nested subquery.sequences r not allowed to be used in nested subqueries. Can anyone tell me how can this issue be resolved.
    Thanks n Regards,
    Amrit

    Hi,
    You can try moving the Sequence operator after join, ie as a final step close to target.
    Mahesh

  • Reset a sequence

    Hi,
    This is the requirement. WE have a code which creates an outbound file containing the posted journal entries. These are named in a way that there is a sequence at the end of the name.
    We need to reset the sequence used in that code every month so that it starts from one at the beg. of the month.
    Any help is appreciated.
    Thanks,
    Ash

    possible solutions:
    1. create a procedure that drop and create the sequence dynamically
           create or replace procedure prc_recreate_sequence(pSeqName varchar2, pStartNum Number, pIncrementNum Number) as
           begin
              execute immediate 'Drop Sequence '||pSeqName;
              execute immediate 'Create Sequence '||pSeqName||' Start With '||pStartNum||' Increment By '||pIncrementNum;
           end;
           /2. create a table that logs the current value as a sequence bypassing the use of the actual sequence
           create table sequence_log
             (sequence_name  varchar2(40),
              start_with     number,
              increment_by   number,
              current_val    number);
           insert into sequence_log
           values ('trans_dtl_seq',1,1,1);in your code call this table to utilize it
           declare
             vSeqNum     number := 0;
           begin
             select (current_val)+1
               into vSeqNum
               from sequence_log
              where sequence_name = 'trans_dtl_seq';
             update sequence_log
                set current_val = vSeqNum
              where sequence_name = 'trans_dtl_seq';
            end;

  • HT201407 during a update of apple my iphone 3GS crashed an now the operating system wont load up..ive tried to reset the phone to the factory settings it took 4 hours an completed but my iphone still wont come on..what can i do to fix the problem? please

    during a update of apple my iphone 3GS crashed an now the operating system wont load up..ive tried to reset the phone to the factory settings using itunes it took 4 hours and completed but my phone still wont come on..what can i do to fix the problem? please help #

    In trying to include what information all that I could I should have specified I DON'T KNOW THAT IT WAS DEFINATELY JAILBROKEN when I took it to the apple store they told me there's no way for them to tell if it was jail broken or not. I'm only going by what ppl have told me COULD HAVE BEEN DONE TO THE PHONE. With that said the only thing I know for sure is that the apple tech at the Genius Bar told me that someone took control of my root menu in February &amp; I've had no control of my phone since. I asked him how to regain control &amp; how he knew his exact words were "oh that is out of our scope of capabilities here at this level &amp; you would need an apple engineer to fix it". I said ok then how do I get an apple eng then? He laughed &amp; said you can't!!!! To which I was furious I came home &amp; called apple requesting to speak w/the fraud dept to file a report they said we don't have a fraud dept!! So after a 45 mn phone call again I left w/no answers.
    @TJBUSMC1973-
    I DON'T HAVE THOUSANDS OF DOLLARS TO SPEND HIRING AN ATTORNEY &amp; Although I appreciate your suggestion I fail to how an attorney would be able to facilitate in any way since there's no suspect. I cannot prove that it's him doing it so I certainly can't pursue legal action w/no proof &amp; no money. :'((
    Again I thank you for your advice but I don't think that will help.
    I was looking more for a TECHNICAL way to avoid this happening w/a new phone should I buy one or trying to get them out of my phone now! Such as installing some kind of software protection?? Someway to clear out the entire phone (other than factory reset which was done 10 x's w/no success, etc. if this person got in then there HAS TO BE A WAY OF GETTING HIM OUT, right????

  • How to disable the run-time popup menu in the sequence display on TestStand Operator Interface, that allow the use to skip the test?

    How to disable the run-time popup menu in the sequence display on TestStand Operator Interface, that allow the use to skip the test?

    Hello,
                  Regarding the skip/force pass/force fail options, when I set the ControlExecFlow to True in Teststand 3.1 and 3.5, in the Sequence Editor the menu options for skip/force pass/force fail are not active for Technician but, when I launch the Operator Interface logged with Technician the options are active. The problem is that if the technician sets one step to one of these options, and change the user to Operator, the test step remains skip/force pass.
                  Is there any possibility without modifying the Operator Interface (at programming level), to reload default values of the steps when changing the user to Operator?
    Thank you,
    Best regards,
    paio

  • How we run the sequence of mapping in owb?

    I have warehouse building mapping which is developed by some one. Now i wanted to run from beginging to end. I am able to run individual mapping manually.
    But i want to run all mapping(not like running one by one). Since i am not sure the sequences of the mapping.
    I want to start the first mapping and it should run all the dependent mapping automatically until end. Any help is highly appreciated.
    I tried to create process flow and process flow package.. But i am not sure, how i can connect all the developed mapping...

    Thanks for the input. based on your input, i found that, OWB workflow manager is not configured.
    I went to this folder and execute wfinstall.csh file.
    /ora/app/oracle/product/11.1.0/db_1/owb/wf/install
    Installation did not go successful. Here is the error message. Any help is highly appreciated.
    WorkflowCA: Deploy WF Applications: Linux
    WorkflowCA: Workflow component container deployed in OC4J: /ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -Doracle.security.jazn.config=/ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/OC4J_Workflow_Component_Container/config/jazn.xml -Djava.security.properties=/ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/config/jazn.security.props -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/oc4j.jar -userThreads -config /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/OC4J_Workflow_Component_Container/config/server.xml
    WorkflowCA: Executing :/ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/admin.jar ormi://oracleserver:6041 oc4jadmin welcome -application WFALSNRSVCApp -testDataSource -location jdbc/WorkflowDS -username OWF_MGR
    WorkflowCA: :null for app:WFALSNRSVCApp
    WorkflowCA: Executing: /ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/admin.jar ormi://oracleserver:6041 oc4jadmin welcome -application WFALSNRSVCApp -installDataSource -url jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oracleserver)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl))) -username OWF_MGR -password ->pwForOwfMgr -className com.evermind.sql.DriverManagerDataSource -location jdbc/WorkflowDS -xaLocation jdbc/xa/WorkflowDS -ejbLocation jdbc/WorkflowDS -connectionDriver oracle.jdbc.driver.OracleDriver
    WFCA OUT: Error: Could not connect to the remote server. Please check if the server is down or the client is using invalid host, ORMI port or password to connect: Connection refused
    WorkflowCA: Exit Val: 2
    WorkflowCA: Created a redirected data source with application WFALSNRSVCApp :
    WorkflowCA: Executing :/ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/admin.jar ormi://oracleserver:6041 oc4jadmin welcome -application WFMLRSVCApp -testDataSource -location jdbc/WorkflowDS -username OWF_MGR
    WorkflowCA: :null for app:WFMLRSVCApp
    WorkflowCA: Executing: /ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/admin.jar ormi://oracleserver:6041 oc4jadmin welcome -application WFMLRSVCApp -installDataSource -url jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oracleserver)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl))) -username OWF_MGR -password ->pwForOwfMgr -className com.evermind.sql.DriverManagerDataSource -location jdbc/WorkflowDS -xaLocation jdbc/xa/WorkflowDS -ejbLocation jdbc/WorkflowDS -connectionDriver oracle.jdbc.driver.OracleDriver
    WFCA OUT: Error: Could not connect to the remote server. Please check if the server is down or the client is using invalid host, ORMI port or password to connect: Connection refused
    WorkflowCA: Exit Val: 2
    WorkflowCA: Created a redirected data source with application WFMLRSVCApp :
    WorkflowCA: Executing: /ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -Djava.security.properties=/ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/config/jazn.security.props -Doracle.security.jazn.config=/ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/OC4J_Workflow_Component_Container/config/jazn.xml -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/jazn.jar -user oc4jadmin -password welcome -adduser jazn.com pwForOwfMgr <WFCA WF PASSWORD>
    The specified user already exists in the system.
    WorkflowCA: Created obfusticated password for redirect datasource:
    WorkflowCA: Executing: /ora/app/oracle/product/11.1.0/db_1/jdk/bin/java -jar /ora/app/oracle/product/11.1.0/db_1/oc4j/j2ee/home/admin.jar ormi://oracleserver:6041 oc4jadmin welcome -shutdown
    WFCA OUT: Error: Could not connect to the remote server. Please check if the server is down or the client is using invalid host, ORMI port or password to connect: Connection refused
    WorkflowCA: Exit Val: 2
    WorkflowCA: Executed OC4J Admin script to shut down the OC4J instance :
    WorkflowCA: Tue Jun 01 15:27:02 CDT 2010
    WorkflowCA: Workflow Configuration has completed with error.
    WorkflowCA: Terminating...

  • Why I get an error when running a sequence using the LabVIEW operator interface ?

    I have a simple TestStand sequence calling LabVIEW vis that is giving me an error when I run it with the .exe version of the LabVIEW operator interface and I set TestStand to run the vis using the 8.2.1 runtime engine instead of the development adapter. I made a change in the operator interface to open a vi programatically and get the value of a control, this vi is also used in the TestStand sequence I am trying to run. Could this be causing my problem ?
    Thanks

    Hello Verdulken,
    I have a few additional questions:
    Does your application function correctly when running the LabVIEW operator interface you have created as a VI in the LabVIEW development environment (i.e. does this problem only occur when the LabVIEW operator interface is run as an executable)?
    What is the error that you are receiving?
    Regarding the VI that you open programmatically, do you open it in a visible manner (i.e. use the Show front panel when called option from VI Properties)?If so, do you also close this VI after it finishes (i.e. use the Close if originally closed option from VI Properties)?
    Does the error occur on the step that calls this very same VI again later in the sequence?
    Does your application function correctly if you use the development adapter for all of your calls?
    Thank you in advance for this information,
    Matt G.
    National Instruments
    Applications Engineering

  • The deleted operation affects the confirmed yield of the parallel sequence

    there is a production order.
    the control key of the last operation is PP03,and it's confirmation is : Milestone confirmation.
    and the production order has a parallel sequence,a external processing operation.
    but i marked the external processing operation deleted.
    then i confirm the last operation,and it's sysstatus is CNF
    but the parallel sequence operation is not CNF.
    WHY?

    Dear,
    did you delete the operatrion after release or before the release?

  • I cannot get the wifi feature on my iphone to switch on. I have just uploaded the latest Operating system but nothing has changed.  I have reset, again no change.  Any ideas?

    I cannot get the wifi feature on my iphone to switch on. I have just uploaded the latest Operating system but nothing has changed.  I have reset, again no change.  Any ideas?

    If you have an iTunes backup that includes the photos you may be able to extract them from the backup using a 3rd party utility such as http://www.wideanglesoftware.com/ibackupextractor/

  • My Macbook will not boot the operating system.  It just goes to a blue screen after the apple logo and the spinning wheel goes off.  I took the battery out and held the on/off button for five seconds and reset the PRAM.  I have the old mac os disk.

    My macbook will not boot.  It goes to a blue screen after the logo and wheel goes off.  I have taken the battery out and held the on/off button for five seconds and reset the PRAM.  I have the the original os disk but have not put it in for fear of losing un backed op data.
    Thanks
    Rich

    You won't lose any data unless you erase your hard drive.
    Put your install DVD into the optical drive and reboot. As soon as you hear the boot chime, hold down the "c"key on your keyboard (or the Option key until the Install Disk shows up). That will force your MacBook to boot from the install DVD in the optical drive.
    When it does start up, you'll see a panel asking you to choose your language. Choose your language and press the Return key on your keyboard once. It will then present you with an Installation window. Completely ignore this window and click on Utilities in the top menu and scroll down to Disk Utility and click it.When it comes up is your Hard Drive in the list on the left?
    If it is then click on the Mac OS partition of your hard drive in the left hand list. Then select the First Aid Tab and run Repair Disk. The Repair Disk button won't be available until you've selected the Mac OS partition on your hard drive. If that repairs any problems run it again until the green OK appears and then run Repair Permissions.

  • I have tried the following, "netsh winsock, reset", but I get a message that says the required operation requires elevation run as administrator . this is my laptop and I am an administrator, please help , itunes store is the only program i have issues

    I get a message that says, the required operation requires elevation <run as administrator>. I am the owner of this laptop and I have administrative authority, why does this show and how can I fix this. Itunes store is the ONLY program I am having trouble with.Very , very frustrating.!!!!!!!!!!!!

    I will assume you're using Windows Vista-7:
    Try these steps instead:
    1 Click start, and in the start menu search, type "cmd" (without the quotes) DO NOT PRESS ENTER!
    2. Right click the "cmd" search result
    3. Click "Run as Administrator"
    4. If you get a pop up message, click yes or continue
    5. Type the command in the window as you did above.
    In an effort to try to prevent programs from messing with your computer, programs don't run under your administrator account unless you tell them to or they ask. This gives the Administrator (elevated) privelleges that you need.

Maybe you are looking for

  • Can't view To-Do's in iCal

    I know this issue has been raised before but I've gone through the support docs and earlier threads and still can't get it resolved. I do know that the time is right on my PowerBook, which is running 10.5.8. The correct calendar is checked in the lef

  • Text placement problem in photoshop 4

    I can't control text placement in photoshop 4. When I enter 2 letters, the line then zooms off to the right - right off the image. I tried uninstalling and reinstalling and it didn't help

  • How-To Microsoft Keyboard Elite for Bluetooth in Solaris 10 x86 10/08

    Dear all, I have a MS keyboard elite for bluetooth install in XP and it's working fine. But how can i configure and use this keyboard in my Solaris environment? My Setup: - Dell Optiplex GX270 PC. - Solaris 10 x86 10/08 - MS keyboard elite for blueto

  • Iterate Ove r Array In Soap RPC response

    Hello, I'm new to JCAPS so forgive me if I'm missing something obvious. I need to interact with a remote web service that has a SOAP binding style of RPC. It returns an array whose items are a complex type. I am trying to call this from a business pr

  • D = Did not read the rules.

    HI ALL, IAM FACING PRBLEM  IN IDOCS IS NOT GETTING 53 STATUS PROPERLY. STRUCKED IN 64 STATUS . EVEN DEFING  WE20 IN PP SETTINGS AND DEFINE TRIGGER -IMMEDIATELY. PLS GIVE ME SOLUTION THERE IS ANY OTHER WAY? Edited by: Julius Bussche on Jul 15, 2008 9: