Results 1 to 3 of 3

Thread: starter

  1. #1
    Join Date
    Jul 2007
    Posts
    5

    Unanswered: starter

    Hi, this is probably really basic but in my loop it steps through a cursor that checks for errors and then adds it to a table but the bit that gets me is that the first error is put into the TABLE as below but the next overwrights it, i want to concat all messages together before i do the INSERT but how can store each error as it loops.
    <LOOP>
    while cursor FIRST to LAST
    select error_message1 || error_message2 || error_message3;|

    INSERT INTO TABLE values (error_message);

    <END LOOP>

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You should at least post a VALID program (clean compile with NO errors); even it it does not do exactly what you want.

    Are you now taking your 1st ever programming class>
    Last edited by anacedent; 07-09-07 at 17:44.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    May 2007
    Posts
    8

    a bit more

    Well I cant give the full program but I have this version working, just looking for a tip to make it more efficent, no biggie!. At the moment it a bit limited to 2 cycles through the loop, in each loop it picks up the values and assigns them, then at the end I concat them together to update in a single row in a table that is used as a display in an app. anyway a tip on how to change code so that its robust for multiple loops and concats for each run through the code would be better.


    FOR i IN request_rec.FIRST .. request_rec.LAST
    LOOP

    IF errors (request_rec (i), error_ret) = FALSE
    THEN
    IF (i) = 1 then
    h_request_id := request_rec (i);

    error_ret1 := error_ret;
    v_request_pgm1 := v_request_pgm;
    h_request_id1 := h_request_id;
    v_policy_no1 := v_policy_no;
    v_claim_item_no1 := v_claim_item_no;
    e_error_message1 := 'The process had the following errors: ' || chr(10) || 'Letter : ' || v_request_pgm || ', Request id:' || h_request_id || ', Policy no:' || v_policy_no || ', Claim no:' || v_claim_item_no || chr(10) ||error_ret ;

    ELSE
    error_ret2 := error_ret;
    v_request_pgm2 := v_request_pgm;
    h_request_id2 := h_request_id;
    v_policy_no2 := v_policy_no;
    v_claim_item_no2 := v_claim_item_no;
    e_error_message2 := 'The process had the following errors: ' || chr(10) || 'Letter : ' || v_request_pgm2 || ', Request id:' || h_request_id2 || ', Policy no:' || v_policy_no2 || ', Claim no:' || v_claim_item_no2 || chr(10) ||error_ret ;
    END IF;
    END IF;
    END LOOP;
    e_error_message := e_error_message1 || chr(10) || e_error_message2;

    insert_case_item_p (e_error_message, v_request_pgm, h_request_id, v_claim_item_no, v_policy_no, v_request_user);

    COMMIT;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •