Insert process with Loop

Hello All,
I have a procedure which will run when the information that has been entered is correct. Also, I have an insert process when the information is not correct, it will automatically insert the information to the log table after three times attempt. The processes are working fine, but my problem is, when the attempt is more than three times, the process will insert the information each time after the 3rd attempt.
For example: I attempt 6 times with wrong information , and the insert process ignores the first three and then it will insert 3, 4, 5 and 6. in four rows. I actually want this process only insert the last one (6) in one row not 3,4,5,and 6 in four rows.
Here is my process:
BEGIN
if (:P2_LOG_COUNT>=3) then
INSERT
INTO QUEST_LOG
(USER_NAME, LOG_COUNT, DATE_CREATED, IP_ADDRESS)
VALUES (:P2_USER_NAME, :P2_LOG_COUNT, SYSDATE,(select OWA_UTIL.get_cgi_env ('REMOTE_ADDR') from dual));
end if;
END;
I appreciate your assistance.
Thanks,
Atousa

You're doing it wrong, fix QUEST_LOG table to include a primary key.
Either you can:
* Just keep incrementing :P2_LOG_COUNT as you are already
* Upon successful state, then if :P2_LOG_COUNT > 3 log it
I suspect that isn't what you'll want however because the it will never log to QUEST_LOG if they never eventually succeed.
The only other option is to have a primary or otherwise unique key you can use to identify the row in order to continue updating the count. If you can't identify the row added at attempt 4, and you aren't sure the user wont just walk away from the application at this point, how can you possibly ensure that one and only one row is added from this point onwards?

Similar Messages

  • Insert statement with loop function

    Hello all,
    I'm new with the loop function
    What need to do is to use a select statement with a condition
    This output needs to be inserted in a table
    The values of the condition are stored also in a table
    It will be something like this:
    BEGIN
      FOR i IN (select nrs from table1)  LOOP
        INSERT INTO table_out_loop
        SELECT * FROM bigtable_vw
        WHERE nr = i
      END LOOP ;
    END ;
    I cant use a direct insert_into function in this case so I need the plsql to 'look' for the values 1 by 1 from the table1
    Any help would be appreciated

    Can't you just:
        insert into table_out_loop
        select *
        from   bigtable_vw
        where  nr in (select nrs from table1);
    If not, then post a better example and/or rephrase the question...

  • How : Invoke asynchronous BPM process with callback within loop?

    Hi All,
    I'm currently using the 11g suite to create 2 BPM processes (Validate and Review). Process Validate is asynchronous and has a callback facility. I intend to invoke Validate from Review as a subprocess. My question would be, is it possible to invoke an asynchronous process with a call back? Can this be done in a loop?
    JDev : 111.1.1.4
    Thanks,
    PP.

    Sai,
    Which IDE are you using to build the client? (In fact it doesn't matter)
    Just put the jar files path into the classpath as John told. In order to find which jar files you need in this process, you can use eclipse java - jar class finder (which works with NWDS as well). Give it the class name(in this case commons.bla.bla...) and your jar files' folder, it will show you which jar file you need to put into the classpath.
    Just a little googling may help you with the class finder

  • With iDVD, how can I create a DVD that auto plays on insert and then loops?

    I want to burn a presentation using idvd which will be played at an exhibition. how do I create a dvd without menu that auto plays upon insert and then loops?
    Thanks
    Message was edited by: Host <to clarify Subject>

    To create a OneStep DVD:
    Connect your DV camcorder to your computer and set the camera to VTR, VCR, or Play mode. Turn on your camcorder if it doesn't turn on automatically.
    Open iDVD and click the OneStep DVD button. (If iDVD opens to a recent project, choose File > OneStep DVD.)
    Insert a recordable DVD disc.
    iDVD rewinds the tape in the video camera and captures the video.
    ------------or-------------
    To burn a OneStep DVD from a folder:
    Choose File > "OneStep DVD from Movie."
    Locate the movie you want to add in the dialog that opens, then click Import.
    Insert a blank DVD disc into the optical drive.
    This kind of disc is sometimes called "kiosk mode" and is a good way to create demos or other presentations that play automatically and require no user interaction.

  • Update/Insert Problem with Oracle Warehouse Builder

    Hello,
    i have update/insert problem with owb.
    Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
    My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
    Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
    Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
    I look forward for your replies :)

    Hi
    thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
    My Testscenario
    1. Load the data from source table about the staging area to data warehouse table: Check - it works!
    2. Change one data record in source table
    3. Load the source table with changed data record once again to staging area: Check - it works!
    4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
    What can yet now still be wrong or forgotten? Any ideas?
    *By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
    I look forward for your answers :)

  • Inserting data with the help of nested table...!!!

    The following block is giving error
    ORA-06502: PL/SQL: numeric or value error
    the signature and signature_bkp have the same structure
    So, can anybody help me out to solve this issue :
    for copying records from one table to another table
    Thanking You advancely
    DECLARE
    CURSOR c1
    IS
    SELECT *
    FROM signature
    WHERE creation_time > TRUNC ( SYSDATE ) - 100
    AND ROWNUM < 102;
    TYPE sig_typ IS TABLE OF signature%ROWTYPE;
    sig_t sig_typ;
    BEGIN
    OPEN c1;
    FETCH c1
    BULK COLLECT INTO sig_t;
    CLOSE c1;
    FORALL i IN sig_t.FIRST .. sig_t.LAST
    INSERT INTO signature_bkp
    VALUES sig_t ( i );
    COMMIT;
    END;
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Or whether a INSERT statement with SELECT clause will do that for youby using this technique, it took 47:08:45 to copy 7252 rows
    and by using a cursor for loop took 49:03:23 to copy 13567 rows
    So there was appox. 40% increase in performance by using pl/sql. I thought it could be even faster using the bulk-bind ing features and nested tables.
    OR i just want to know ....how to correct the block of code that was given in my 1st msg without changing its logic.
    Thanks
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ABAP Objects and table processing (with logical databases)

    I have a report that is written right now using procedural abap and a logical database.  The report is structured follows (high level):
    start-of-selection.
    get pernr.
      perform get_it0001 using wtab.
      perform get_it0002 using wtab.
      perform get_it0003 using wtab.
      append wtab to itab.
    end-of-selection.
      call function 'reuse_alv_grid_display'
        exporting
          i_structure_name       = 'itabstructure'
        tables
          t_outtab               = itab.
    So basically I'm going through a bunch of personnel numbers, getting a few infotypes and outputting to ALV.  I don't see where ABAP Objects is going to help me for this particular program. 
    Can somebody show me where OO ABAP would make this easier?  Does it even make sense to use OO when you're processing with a logical database?  (Not just PNP, but any logical database in general).
    Thanks in advance.

    Hello Lee
    I assume that the routines GET_ITnnnn are written by yourself. For reading infotypes ABAP Objects provides us with same very helpful classes as shown below:
    * define data
      DATA:
        gif_employee      type ref to if_pt_employee,
        go_employee       type ref to cl_pt_employee,
        gt_infotypes      TYPE tim_tmw_itlist_tab,
        go_control        TYPE REF TO if_pt_td_control,
        go_data           TYPE REF TO if_pt_td_base,
        go_pnnnn          TYPE REF TO if_pt_td_itnnnn,
        gt_p0001          TYPE TIM_P0001_TAB,
        gt_p0002          TYPE TIM_P0002_TAB,
        gt_p0003          TYPE TIM_P0003_TAB.
    start-of-selection.
    GET pernr.
    <b>* Create employee instance</b>
      gif_employee = cl_pt_employee=>get_employee( pernr ).
      go_employee ?= gif_employee.
    <b>* Get master infotypes (0001, 0002)</b>
      CALL METHOD go_employee->get_master_data
        EXPORTING
          im_begda = id_fromdate
          im_endda = id_todate
        IMPORTING
    *      EX_I0000 =
          EX_I0001 = gt_p0001
          EX_I0002 = gt_p0002
    *      EX_I0007 =
    *      EX_I0008 =
    <b>* Append all other required infotypes to itab</b>
      APPEND '0003' TO gt_infotypes.
      CALL METHOD go_employee->get_infotypes
        EXPORTING
          i_itlist      = gt_infotypes
          i_fromdate    = id_fromdate  " start date
          i_todate      = id_todate    " end date
    *      I_FILTER      =
          i_noauthcheck = 'X'
        IMPORTING
          e_result      = gt_infty_request
          e_retcd       = gd_retcd.
    * Please see documentation of parameter e_retcd...
      LOOP AT gt_infty_request INTO go_control.
        go_data = go_control->data.  <b>" get data object</b>
    *   Casting
        TRY.
            go_pnnnn ?= go_data.
          CATCH cx_sy_move_cast_error.
            CONTINUE.
        ENDTRY.
    <b>*   Convert infotype (semi-transparent -> transparent)</b>
        CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
          EXPORTING
            prelp = lo_pnnnn->prelp
          IMPORTING
            pnnnn = gs_p0003.
        APPEND gs_p0027 TO gt_p0003.
      ENDLOOP.
    The class CL_PT_EMPLOYEE provides us already with very easy access to so-called master infotypes (000, 0001, 0002, 0007 and 0008). All other infotypes can be read using method GET_INFOTYPES.
    Using these classes we have a very convenient and standardized way of accessing all kinds of infotypes.
    Regards
      Uwe

  • How to implement the javascript and the  insert process ?

    Hi,
    In my application I have created one region with one text box and one button.
    On click of the button , first a javascript should run to validate the textbox value , if there is an error it should alert the user ,otherwise the insert process (I have written a PL/SQL block under processes in page processing) should get executed.
    when i tried to implement this only javascript is getting executed but the insert process is not executed...
    so how I should implement the above case?
    here i invoke the javascript in the URL Target as
    javascript:myfunction();

    hey hiiii,
    i have also tha same problem as mentioned by ANOO.
    and the button on which i m applying the javascript is "Create"
    i have written doSubmit('Create'); in my javascript code ,
    but after doing this the process named "Create" which is conditioned by this button is not being called...
    so what can i do now...

  • Associating a process with a 'select list with submit'

    Hi,
    In a tabular form I have 2 'select list with submit'. If a row is selected in the tabular form I need the following functionality from each of the select lists:
    Once a value is selected from the list a process will get excuted which will update a column of the checked row in the database table with the selected value from the list.
    My question is,
    1. How can I associate an 'after submit process' with the 'select list with submit'?
    2. Can I store the selected value in a variable which I can pass as an input parameter to a PL/SQL body?
    Regards,
    AM

    Hi,
    Please see my requirement below.
    I have a 'select list with submit' say P1_Select in a Tabular form Page. I want to create an after submit process (PL/SQL Process) which will take the selected value from the select list as input parameter and perform an update function for the checked row with that value.
    I'm trying give a feel the procedure:
    CREATE OR REPLACE procedure "P_REJECT"
    (p_message IN VARCHAR2 default Null)
    is
    begin
    FOR ii IN 1 .. APEX_APPLICATION.G_F01.count
    LOOP
    UPDATE NI SET NI.STATUS_NI = 'WCONF', NI.NI_Message = p_MESSAGE
    WHERE NI.NI_REF = APEX_APPLICATION.G_F01(APEX_APPLICATION.G_F01(ii));
    END LOOP;
    end;
    As suggested by Flavio I created the conditional 'after submit' process where I'm making a call to the above procedure.
    1. I am not sure how to pass the selected value as a parameter to the proc.
    2. 'request = value, where the value is the string literal P1_SELECT'.... Could not really figure out the meaning of string literal P1_SELECT
    Regards,
    AM

  • INSERT in PLSQL loop  in Oracle 9i  scheduled job has poor performance

    Hi,
    I have a scheduled job running in Oracle 9i. But everytime it executes the following piece of code, the INSERT process slows down drastically.
    -------------------------------typical piece of code having problem-----------------------------------
    LOOP
    FOR increbkgs IN bookings_cur (in_chr_fiscal_period_id,
    allrec.cust_name_string
    LOOP
    l_num_rec_count := l_num_rec_count + 1;
    INSERT INTO SA_PORTAL_CDW_BOOKINGS_INCTEMP
    (product_id, territory_code,
    global_target_id, service_type,
    equipment_deployment, created_date, updated_date,
    fiscal_period_id, customer_id,
    ship_to_country,
    bookings_amount, sams_alliance_id
    VALUES (increbkgs.product_id, increbkgs.territory_code,
    increbkgs.global_target_id, increbkgs.service_type,
    increbkgs.equipment_deployment, SYSDATE, SYSDATE,
    increbkgs.fiscal_period_id, increbkgs.customer_id,
    increbkgs.ship_to_country,
    increbkgs.bookings_amount, allrec.sams_alliance_id
    IF (l_num_rec_count = 500)
    THEN
    l_num_rec_count := 0;
    COMMIT;
    END IF;
    END LOOP;
    END LOOP;
    All the tablespaces are auto-extend. But we have still tried to increase the tablespace manually from 2% to 30% by adding datafiles. Still the INSERT is slowing down for some reason.
    (The same process in Oracle 8i is much faster)
    Any hint or guidance is greatly appreciated.
    Thanks and regards,
    Ambili

    commits in loops are great for slowing down things. Actually commits in loops are just about the best way of stalling any 'process' in Oracle.
    A much better way is to resize your undo tablespace to permit one single commit at the end of the whole thing. Yes it could be big, but that's the way Oracle works.
    If you want more info about this, buy Thomas Kyte's book found at http://apress.com/book/bookDisplay.html?bID=10008

  • Implement a normal insert process in an interactive report

    Hello,
    I want to implement a normal insert process for an interactive report. For which I have created an pl/sql anonymous block with the process. This process will be fired when I click the create button of the New record insert region.
    insert into table_name(YR_MO,STATUS,UPDATED_DT,ID) values
    (to_char(sysdate,'YYYYMM'),:P1_STATUS,sysdate,:P1_ID);
    YR_MO is my primary key column in tha table.
    For inserting purposes I have created a separate (New record insert) region, with the items P1_STATUS and P1_ID amd a create button.
    Within the interactive report, i have a button Create_New when I click this button the New record insert region should open up and in that region, i have the items P1_STATUS,P1_ID.
    My problem is when I click the Create_New button within the interactive report, the records are getting inserted. I dnon't understand what might be the problem, because the insert process should be fired when i click the create button within the New record insert region but it is firing when I click the create_new button.
    Can anyone help me out with this issue.
    Thanks,
    Orton.

    Does the insert process fire on a specific request only? And do the two buttons have different request values (names)?

  • Re-write provide statement with loop

    Hello,
    I am a bit confused how to rewrite a provide statement but with loop instead.
    For example, how would the following code be written with 'loop at':
    PROVIDE * FROM P0001
              FROM P0016 BETWEEN '20020401' AND '20061001'
    ENDPROVIDE
    Thanks for your help.

    Data Retrieval from LDB
    1. Create data structures for infotypes.
    INFOTYPES: 0001, "ORG ASSIGNMENT
    0002, "PERSONAL DATA
    0008. "BASIC PAY
    2. Fill data structures with the infotype records.
    Start-of-selection.
    GET PERNR.
    End-0f-selection.
    Read Master Data
    Infotype structures (after GET PERNR) are internal tables loaded with data.
    The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
    GET PERNR.
    PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
    If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.
    ENDPROVIDE.
    Period-Related Data
    All infotype records are time stamped.
    IT0006 (Address infotype)
    01/01/1990 12/31/9999 present
    Which record to be read depends on the date selection period specified on the
    selection screen. PN/BEGDA PN/ENDDA.
    Current Data
    IT0006 Address - 01/01/1990 12/31/9999 present
    RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.
    For example, pn/begda = '19990931' pn/endda = '99991231'
    IT0006 subtype 1 is resident address
    RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
    hope it will be of help to u.

  • Cannot do MIGO in Third Party Sales Process with shipping notification

    In the Third party sales process with Shipping notification,the item category for the material is TAS (Billing relevance=R),item category group is BANS.
    Intially sales order is created,then using me21n with reference to purchase requisation purchase order is created,then in MIGO stage i used the PO No there but i get the message no item found in PO.
    what adjustment have to be done in order to do MIGO

    Refer following SDN thread, by that you will be able to get overview on best practices about Third Party Sales & necessary configuration you need to follow for statistical GR:
    - Third party direct shipment (II)
    Further maintain Billing Relevance for Item Category as G - Order-related billing of the delivery quantity.
    Regards
    JP

  • Third party process with Valuated sales order stock

    Hi All,
    We have third party sales order process with valuated sales order stock. The problem is that in the theird party PR which is triggered directly from the sales order it determines a stock account which is assigned to the BSX key in OBYC.
    But since this is third party processing as per my understanding a consumption account assigned to key GBB-VAX (since account assignmnt category is X) should get determined, so that when the GR is done against the PO a consumption posting is done in the background.
    I am not able to understand if the system is determining the stock account due to the fact that it is valuated sales order stock and if so, what should happen after GR. Should we have a stock created for the material which is physically directly delivered to the customer?
    Regards,
    V S

    Hi,
    Check GBB-VKA which is defined in OME9 for your ''E'' Account Assignment Category that SAP will debit upon GR posting
    Also check "X" GBB-VAX and the G/L account assignment in OBYC
    The posting on GR should be debit KBS -Credit GR-IR
    Thanks
    Diwakar

  • Cannot deploy BPEL process with SSO to BPELConsole activated

    I cannot deploy BPEL process with SSO to BPELConsole activated. Here is the error I get from JDeveloper (sorry for the french error message):
    Problème détecté lors de la connexion au serveur "ssdvoiagu.dev.local.csst.qc.ca" sur le port "7781" : java.security.AccessControlException: access denied (com.collaxa.security.DomainPermission generique read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    at java.security.AccessController.checkPermission(AccessController.java:427)
    at com.collaxa.security.OC4JSecurityService.checkAccess(OC4JSecurityService.java:16)
    at com.collaxa.security.SecurityService.checkDomainAccess(SecurityService.java:26)
    at com.collaxa.cube.fe.util.ServletUtils.getLocatorWithoutUrlRewrite(ServletUtils.java:162)
    at deployHttpClientProcess.jspService(_deployHttpClientProcess.java:332)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    Target BPEL process manager runs under SOA 10.1.3.3. When the SSO to BPELConsole is disabled, the deployment works just fine. Is there any way to make it work with SSO?

    Please check:
    http://blog.jpoot.com/category/oracle-appserver/oid-ldap/
    We had some issues with SSO and SSL but everything is running now.
    Marc

Maybe you are looking for

  • How can I check to see if a plug-in or something else is preventing me from accessing a certain app?

    Hello, Thanks in advance for any help. I'm an elementary teacher who is having trouble accessing my online grade book from my mac. The publisher if the gradebook app is Pearson. My school district technology dept. has not been helpful at all, but a f

  • My Review for MSI Big Bang Xpower & Overclocked

    This will be the very 1st X58 big bang series of MSI and the 1st X58 MSI motherboard to have USB 3.0 and SATA 3 connections. Targets the enthusiast, hardcore gamers as well as overclockers. This board is already equipped with OC Genie buttons which w

  • Oracle Beehive 2.0.1 and 11.2.0.2 db

    Happy New Year.... Has anyone succesfully installed Beehive 2.0.1.0 against a 64-bit 11.2.0.2 db running on OEL5U5? Beehive installation is on 32-bit OEL5U5 and runs very well until the Framework Configuration phase.. ./beectl add_user_subscription_t

  • New IPOD shuffle

    Hi friends I bought a IPOD shuffle(1 GB) yesterday. I have plugged it to my laptop and transfer few songs. I kept connect to laptop for around 2hrs. I thought we need to charge when we get new one. I dont know whether it is charged or not. because wh

  • XML Schema based XMLType column leaves file open on error

    Hello, I have the following situation on both oracle 10.1.0.2.0 and 10.1.0.4.0: insert into xml_products (xmlfile) values(bfilename(file_loc, char_id)); "xmlfile" is a xmltype column based on a registered xml schema. When the file fails xml schema va