Looping insert...To be continued

Sorry, but the post was getting too long to follow so I
thought I would
start it over and ask for help piece by piece so I can learn
this:
I viewed the created html from Coldfusion and my list has
unique input names
from the looping list (List1, List2, etc) and the values are
unique due to
the recordset values of the listsid.
Ok, using cfdump var="#form#" I am getting nothing in the
output.
If I dump var = "#email#", I get the correct email addresse
twice.
I don't know how to dump the values of the lists because of
the fact that
they are incrementing dynamically based on the loop. I should
figure out
that to see if the numbers are correctly apprearing.
Here is my form:
<form action="" method="get" name="showMeMy">
<cfoutput>
cfset i = 0>
<cfloop query="optionList">
<cfset i = i+1>
<input name="list#i#" type="checkbox" id="list#i#"
value="#optionList.listid#">
#optionList.listName#
</cfloop>
input name="email" type="hidden" id="email"
value="#URL.email#" />
input name="Update" type="submit" id="Update" value="Update
Subscription
List">
</cfoutput>
</form>

Ok, i am beginning to see. I am looking at the cfloop list in
the docs.
So I need to replace the 'form.fieldname' with the actual
field 'list'?
How can I replace that with the name of 'list' since it is
incrementing
from the form?
Do I need to rename my fieldname in the form from list#i# to
something
static?
NO, you just need to put all the pieces together.
Look at the <cfdump var="#form#"> you posted earlier.
struct
EMAIL [email protected]
FIELDNAMES LIST1,LIST2,EMAIL,UPDATE
LIST1 9999
LIST2 1
UPDATE Update Subscription List
See the third line, there is a "field" named "FIELDNAMES" and
it
contains a list of all the fields that where submitted by the
form page.
<cfloop list="#form.fieldnames#" index="field">
This is going to loop over the list in the form.fieldnames
key
[LIST1,LIST2,EMAIL,UPDATE] and put each list value into the
variable
"field".
<cfif left(field,4) EQ "LIST">
This checks the value of the variable "field" in each loop to
see if it
starts with the string "LIST" thus this is one of the list
check box fields.
VALUES ('#form.email#', #form[field]#)
This inserts the values of form.email and the list field into
the
database. In each loop itteration #form[field] is going to
resolve to
form[LIST1] and form[LIST2] which in turn will resolve to the
following SQL
VALUES ('#form.email#', #form[field]#
VALUES ('[email protected]', 1)
VALUES ('[email protected]', 9999)

Similar Messages

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Aggregate function in for loop insert

    Hi Everyone,
    Please see the below code and help me insert these string values. How can I trap that string value and insert it?
    DECLARE
    BEGIN
      for i in (SELECT STRAGG(Q.QUESTION_CODE)
                  FROM QUESTION Q , TEST_CODE_CONVERSION TC
                 WHERE Q.ACTIVE_YN = 'Y'
                   AND Q.TEST_ID = TC.EAST_TEST_ID
              GROUP BY Q.TEST_ID)
      LOOP
              INSERT INTO TEST_CODE_CONVERSION (QCODE_FOR_WEST_TEST_ID)
              VALUES (___________) ;
              dbms_output.put_line('1 row inserted');              
      END LOOP;
    End;Regards,
    BS2012.

    Add column alias
    BS2012 wrote:
    Hi Everyone,
    Please see the below code and help me insert these string values. How can I trap that string value and insert it?
    DECLARE
    BEGIN
    for i in (SELECT STRAGG(Q.QUESTION_CODE) as q_code --"Alias added"
    FROM QUESTION Q , TEST_CODE_CONVERSION TC
    WHERE Q.ACTIVE_YN = 'Y'
    AND Q.TEST_ID = TC.EAST_TEST_ID
    GROUP BY Q.TEST_ID)
    LOOP
    INSERT INTO TEST_CODE_CONVERSION (QCODE_FOR_WEST_TEST_ID)
    VALUES (___________) ;
    dbms_output.put_line('1 row inserted');              
    END LOOP;
    End;Regards,
    BS2012.Actually you dont need PL/SQL for this, just a Single SQL
    INSERT INTO TEST_CODE_CONVERSION (QCODE_FOR_WEST_TEST_ID)
    select  STRAGG(Q.QUESTION_CODE)
                  FROM QUESTION Q , TEST_CODE_CONVERSION TC
                 WHERE Q.ACTIVE_YN = 'Y'
                   AND Q.TEST_ID = TC.EAST_TEST_ID
    --          GROUP BY Q.TEST_ID--"GROUP BY is not required, right?
    {code}
    Edited by: jeneesh on May 15, 2013 4:05 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • PL SQL with multiple inserts, how to continue after exception is raised

    Hi,
    I have a simple PL SQL function with various inserts. ex:
    Insert Into "DI01"."DUA_DIM_UNITE_ADMIN" (Ide_Unite_Admin_Sk, Num_Unite_Admin, Des_Unite_Admin) Values ('-1', '00000000', 'Défaut');
    INSERT INTO "DI01"."DUA_DIM_UNITE_ADMIN" (IDE_UNITE_ADMIN_SK, NUM_UNITE_ADMIN, DES_UNITE_ADMIN) VALUES ('-2', 'S. O.', 'Sans Objet');
    Insert Into "DI01"."DCU_DIM_CATGR_UNSPS" (Ide_Catgr_Sk, Num_Code, Des_Code, Num_Catgr, Des_C.........
    I want to be able to run the function multiple times, and have all the inserts executed everytime, even if I get a ORA-00001 unique constraint (string.string) violated error in on of the inserts. That means that if I get an error in the first insert, I want the function to continue running and executing the consecutive inserts.
    I though of including each insert in a different block, like:
    BEGIN
    Insert......
    When Exception then null;
    END;
    BEGIN
    Insert......
    When Exception then null;
    END;
    But I have at least 50 inserts, so the final code becomes huge.
    Another solution is to use merge inseat of insert, but the code seems too complex for such a simple task.
    Is there any other solution for this that I am not seeing?
    Thank you for your time,
    Joao Moreira

    You can use DML error logging approach or FORALL SAVE EXCEPTIONS.
    Since you didn't mention the version I assume you are using 11g.
    Below is the sample code for DML error logging mechanism
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production   
    PL/SQL Release 11.2.0.3.0 - Production                                         
    CORE 11.2.0.3.0 Production                                                     
    TNS for Linux: Version 11.2.0.3.0 - Production                                 
    NLSRTL Version 11.2.0.3.0 - Production                                        
    SQL> DROP TABLE tableA;
    Table dropped.
    SQL> DROP TABLE Err$_tableA;
    Table dropped.
    SQL>
    SQL> CREATE TABLE tableA
      2  (
      3     col1   NUMBER PRIMARY KEY,
      4     col2   NUMBER,
      5     col3   VARCHAR2 (10)
      6  );
    Table created.
    SQL>
    SQL> -- Create error log table
    SQL>
    SQL> BEGIN
      2     DBMS_ERRLOG.create_error_log (dml_table_name => 'TABLEA');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> BEGIN
      2     FOR i IN (SELECT 1 AS col1 FROM DUAL
      3               UNION ALL
      4               SELECT 1 FROM DUAL)
      5     LOOP
      6        INSERT INTO tableA (col1)
      7             VALUES (i.col1)
      8                LOG ERRORS INTO Err$_tableA REJECT LIMIT UNLIMITED;
      9     END LOOP;
    10 
    11     COMMIT;
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    SQL> column column_name format a30
    SQL> set linesize 300
    SQL> select * from tableA;
    SQL> select * from err$_tablea;
    Thanks,
    GPU

  • Need to increase performance-bulk collect in cursor with limit and in the for loop inserting into the trigger table

    Hi all,
    I have a performance issue in the below code,where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    can someone please guide me here.Its bit urgent .Awaiting for your response.
    declare
    vmax_Value NUMBER(5);
      vcnt number(10);
      id_val number(20);
      pc_id number(15);
      vtable_nm VARCHAR2(100);
      vstep_no  VARCHAR2(10);
      vsql_code VARCHAR2(10);
      vsql_errm varchar2(200);
      vtarget_starttime timestamp;
      limit_in number :=10000;
      idx           number(10);
              cursor stg_cursor is
             select
                   DESCRIPTION,
                   SORT_CODE,
                   ACCOUNT_NUMBER,
                     to_number(to_char(CORRESPONDENCE_DATE,'DD')) crr_day,
                     to_char(CORRESPONDENCE_DATE,'MONTH') crr_month,
                     to_number(substr(to_char(CORRESPONDENCE_DATE,'DD-MON-YYYY'),8,4)) crr_year,
                   PARTY_ID,
                   GUID,
                   PAPERLESS_REF_IND,
                   PRODUCT_TYPE,
                   PRODUCT_BRAND,
                   PRODUCT_HELD_ID,
                   NOTIFICATION_PREF,
                   UNREAD_CORRES_PERIOD,
                   EMAIL_ID,
                   MOBILE_NUMBER,
                   TITLE,
                   SURNAME,
                   POSTCODE,
                   EVENT_TYPE,
                   PRIORITY_IND,
                   SUBJECT,
                   EXT_PRD_ID_TX,
                   EXT_PRD_HLD_ID_TX,
                   EXT_SYS_ID,
                   EXT_PTY_ID_TX,
                   ACCOUNT_TYPE_CD,
                   COM_PFR_TYP_TX,
                   COM_PFR_OPT_TX,
                   COM_PFR_RSN_CD
             from  table_stg;
    type rec_type is table of stg_rec_type index by pls_integer;
    v_rt_all_cols rec_type;
    BEGIN
      vstep_no   := '0';
      vmax_value := 0;
      vtarget_starttime := systimestamp;
      id_val    := 0;
      pc_id     := 0;
      success_flag := 0;
              vstep_no  := '1';
              vtable_nm := 'before cursor';
        OPEN stg_cursor;
              vstep_no  := '2';
              vtable_nm := 'After cursor';
       LOOP
              vstep_no  := '3';
              vtable_nm := 'before fetch';
    --loop
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    FOR i IN 1 .. v_rt_all_cols.COUNT
      LOOP
       dbms_output.put_line(upper(v_rt_all_cols(i).event_type));
        if (upper(v_rt_all_cols(i).event_type) = upper('System_enforced')) then
                  vstep_no  := '4.1';
                  vtable_nm := 'before seq sel';
              select PC_SEQ.nextval into pc_id from dual;
                  vstep_no  := '4.2';
                  vtable_nm := 'before insert corres';
              INSERT INTO target1_tab
                           (ID,
                            PARTY_ID,
                            PRODUCT_BRAND,
                            SORT_CODE,
                            ACCOUNT_NUMBER,
                            EXT_PRD_ID_TX,         
                            EXT_PRD_HLD_ID_TX,
                            EXT_SYS_ID,
                            EXT_PTY_ID_TX,
                            ACCOUNT_TYPE_CD,
                            COM_PFR_TYP_TX,
                            COM_PFR_OPT_TX,
                            COM_PFR_RSN_CD,
                            status)
             VALUES
                            (pc_id,
                             v_rt_all_cols(i).party_id,
                             decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                             v_rt_all_cols(i).sort_code,
                             'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4),
                             v_rt_all_cols(i).EXT_PRD_ID_TX,
                             v_rt_all_cols(i).EXT_PRD_HLD_ID_TX,
                             v_rt_all_cols(i).EXT_SYS_ID,
                             v_rt_all_cols(i).EXT_PTY_ID_TX,
                             v_rt_all_cols(i).ACCOUNT_TYPE_CD,
                             v_rt_all_cols(i).COM_PFR_TYP_TX,
                             v_rt_all_cols(i).COM_PFR_OPT_TX,
                             v_rt_all_cols(i).COM_PFR_RSN_CD,
                             NULL);
                  vstep_no  := '4.3';
                  vtable_nm := 'after insert corres';
        else
              select COM_SEQ.nextval into id_val from dual;
                  vstep_no  := '6';
                  vtable_nm := 'before insertcomm';
          if (upper(v_rt_all_cols(i).event_type) = upper('REMINDER')) then
                vstep_no  := '6.01';
                  vtable_nm := 'after if insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'IADAREMINDER',
                  systimestamp,
                  systimestamp,
                  0);  
         else
                vstep_no  := '6.02';
                  vtable_nm := 'after else insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'CORRESPONDENCE',
                  systimestamp,
                  systimestamp,
                  0); 
            END if; 
                  vstep_no  := '6.11';
                  vtable_nm := 'before chop';
             if (v_rt_all_cols(i).ACCOUNT_NUMBER is not null) then 
                      v_rt_all_cols(i).ACCOUNT_NUMBER := 'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4);
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 'IB.Correspondence.AccountNumberMasked',
                 v_rt_all_cols(i).ACCOUNT_NUMBER);
             end if;
                  vstep_no  := '6.1';
                  vtable_nm := 'before stateday';
             if (v_rt_all_cols(i).crr_day is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Day',
                 'IB.Crsp.Date.Day',
                 v_rt_all_cols(i).crr_day);
             end if;
                  vstep_no  := '6.2';
                  vtable_nm := 'before statemth';
             if (v_rt_all_cols(i).crr_month is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Month',
                 'IB.Crsp.Date.Month',
                 v_rt_all_cols(i).crr_month);
             end if;
                  vstep_no  := '6.3';
                  vtable_nm := 'before stateyear';
             if (v_rt_all_cols(i).crr_year is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Year',
                 'IB.Crsp.Date.Year',
                 v_rt_all_cols(i).crr_year);
             end if;
                  vstep_no  := '7';
                  vtable_nm := 'before type';
               if (v_rt_all_cols(i).product_type is not null) then
                  insert into child_tab
                     (COM_ID,                                            
                     KEY,                                                                                                                                        
                     VALUE)
                  values
                    (id_val,
                     'IB.Product.ProductName',
                   v_rt_all_cols(i).product_type);
                end if;
                  vstep_no  := '9';
                  vtable_nm := 'before title';         
              if (trim(v_rt_all_cols(i).title) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE )
              values
                (id_val,
                 'IB.Customer.Title',
                 trim(v_rt_all_cols(i).title));
              end if;
                  vstep_no  := '10';
                  vtable_nm := 'before surname';
              if (v_rt_all_cols(i).surname is not null) then
                insert into child_tab
                   (COM_ID,                                            
                   KEY,                                                                                                                                          
                   VALUE)
                values
                  (id_val,
                  'IB.Customer.LastName',
                  v_rt_all_cols(i).surname);
              end if;
                            vstep_no  := '12';
                            vtable_nm := 'before postcd';
              if (trim(v_rt_all_cols(i).POSTCODE) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Customer.Addr.PostCodeMasked',
                  substr(replace(v_rt_all_cols(i).POSTCODE,' ',''),length(replace(v_rt_all_cols(i).POSTCODE,' ',''))-2,3));
              end if;
                            vstep_no  := '13';
                            vtable_nm := 'before subject';
              if (trim(v_rt_all_cols(i).SUBJECT) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Subject',
                  v_rt_all_cols(i).subject);
              end if;
                            vstep_no  := '14';
                            vtable_nm := 'before inactivity';
              if (trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) is null or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '3' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '6' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '9') then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Inactivity',
                  v_rt_all_cols(i).UNREAD_CORRES_PERIOD);
              end if;
                          vstep_no  := '14.1';
                          vtable_nm := 'after notfound';
        end if;
                          vstep_no  := '15';
                          vtable_nm := 'after notfound';
        END LOOP;
        end loop;
                          vstep_no  := '16';
                          vtable_nm := 'before closecur';
        CLOSE stg_cursor;
                          vstep_no  := '17';
                          vtable_nm := 'before commit';
        DELETE FROM table_stg;
      COMMIT;
                          vstep_no  := '18';
                          vtable_nm := 'after commit';
    EXCEPTION
    WHEN OTHERS THEN
      ROLLBACK;
      success_flag := 1;
      vsql_code := SQLCODE;
      vsql_errm := SUBSTR(sqlerrm,1,200);
      error_logging_pkg.inserterrorlog('samp',vsql_code,vsql_errm, vtable_nm,vstep_no);
      RAISE_APPLICATION_ERROR (-20011, 'samp '||vstep_no||' SQLERRM:'||SQLERRM);
    end;
    Thanks

    Its bit urgent
    NO - it is NOT urgent. Not to us.
    If you have an urgent problem you need to hire a consultant.
    I have a performance issue in the below code,
    Maybe you do and maybe you don't. How are we to really know? You haven't posted ANYTHING indicating that a performance issue exists. Please read the FAQ for how to post a tuning request and the info you need to provide. First and foremost you have to post SOMETHING that actually shows that a performance issue exists. Troubleshooting requires FACTS not just a subjective opinion.
    where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    Personally I think 5000 seconds (about 1 hr 20 minutes) is very fast for processing 800 trillion rows of data into parent and child tables. Why do you think that is slow?
    Your code has several major flaws that need to be corrected before you can even determine what, if anything, needs to be tuned.
    This code has the EXIT statement at the beginning of the loop instead of at the end
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    The correct place for the %NOTFOUND test when using BULK COLLECT is at the END of the loop; that is, the last statement in the loop.
    You can use a COUNT test at the start of the loop but ironically you have commented it out and have now done it wrong. Either move the NOTFOUND test to the end of the loop or remove it and uncomment the COUNT test.
    WHEN OTHERS THEN
      ROLLBACK;
    That basically says you don't even care what problem occurs or whether the problem is for a single record of your 10,000 in the collection. You pretty much just throw away any stack trace and substitute your own message.
    Your code also has NO exception handling for any of the individual steps or blocks of code.
    The code you posted also begs the question of why you are using NAME=VALUE pairs for child data rows? Why aren't you using a standard relational table for this data?
    As others have noted you are using slow-by-slow (row by row processing). Let's assume that PL/SQL, the bulk collect and row-by-row is actually necessary.
    Then you should be constructing the parent and child records into collections and then inserting them in BULK using FORALL.
    1. Create a collection for the new parent rows
    2. Create a collection for the new child rows
    3. For each set of LIMIT source row data
      a. empty the parent and child collections
      b. populate those collections with new parent/child data
      c. bulk insert the parent collection into the parent table
      d. bulk insert the child collection into the child table
    And unless you really want to either load EVERYTHING or abandon everything you should use bulk exception handling so that the clean data gets processed and only the dirty data gets rejected.

  • Connect by loop how to prevent continuous loop

    We have a forms environment and in one area of the system its possible to create a continuos loop i.e
    part 1
    ----> Part 2
    ------>part1
    We get round this currently using the nocycle option in our connect by and checking the values of the connect_by_iscycle option. But we only do the check this after a commit.. meaning user has to manually amend. I was wondering how people validated there was not a continuous loop before the commit?
    Thanks

    use CONNECT_BY_ISCYCLE to check the problem
    check this out
    http://www.rampant-books.com/10g_79.htm

  • Problem looping insert query

    I'm working on inserting a recordset up Google Calendar entries into my site database. I have a form set up that allows me to insert new entries into the data table, but when I try to loop the insert query over the Google recordset, I get nothing (no errors, but no entries added to database).
    Here's my form, which both displays the values from the Google query and populates fields (mostly hidden) with those values to submit to the Insert query. There's also a line that checks to make sure the event hasn't been canceled (canceled events are still listed, the start and end times are just set to null values):
    <form method="post" action="<cfoutput>#CurrentPage#</cfoutput>">
    <table cellpadding="2" border="1">
    <cfset thisRow = 0>
    <cfloop query="band_events">
    <cfif IsDefined("starttime") AND IsDefined("endtime") AND starttime NEQ "" AND endtime NEQ "">
    <cfset thisRow = thisRow + 1>
    <cfoutput>
    <tr>
      <td>#thisRow#</td>
      <td><input name="update#thisRow#" type="checkbox" checked="checked" /></td>
      <td><input name="calendar#thisRow#" type="hidden" value="Band" />Band</td>
      <td><input name="creator#thisRow#" type="hidden" value="#authoremail#" />#authoremail#</td>
      <td><input name="starttime#thisRow#" type="hidden" value="#starttime#" />#starttime#</td>
      <td><input name="endtime#thisRow#" type="hidden" value="#endtime#" />#endtime#</td>
      <td><input name="title#thisRow#" type="hidden" value="#title#" />#title#</td>
      <td><input name="content#thisRow#" type="hidden" value="#content#" />#content#</td>
      <td><input name="location#thisRow#" type="hidden" value="#where#" />#where#</td>
      <td><input name="ID#thisRow#" type="hidden" value="#ID#" />#ID#</td>
      <td><input name="published#thisRow#" type="hidden" value="#ISOToDateTime(published)#" />#ISOToDateTime(published)#</td>
      <td><input name="updated#thisRow#" type="hidden" value="#ISOToDateTime(updated)#" />#ISOToDateTime(updated)#</td>
    </tr>
    </cfoutput>
    </cfif>
    </cfloop>
    </table>
    <input type="hidden" name="totalRows" value="#row#" />
    <input type="submit" name="submit" value="Submit" />
    <input type="hidden" name="update_events" value="update_events" />
    </form>
    Here's the action script. There's some extra code in there to convert some of the date formats Google uses, and to account for the differences in time zones between the Google values and local time:
    <cfif StructKeyExists(form,"update_events")>
      <cfset loopCount = form["totalRows"]>
      <cfloop index="row" from="1" to="#loopCount#">
        <cfset thisCalendar = form["calendar" & row]>
        <cfset thisCreator = form["creator" & row]>
        <cfset thisStarttime = form["starttime" & row]>
        <cfset thisEndtime = form["endtime" & row]>
        <cfif TimeFormat(thisStarttime,"hh:mm tt") EQ "12:00 AM" AND TimeFormat(thisEndtime,"hh:mm tt") EQ "12:00 AM">
          <cfset thisAllDay = -1>
        <cfelse>
          <cfset thisAllDay = 0>
          <cfset thisStarttime = DateAdd("h",5,thisStarttime)>
          <cfset thisEndtime = DateAdd("h",5,thisEndtime)>
        </cfif>
        <cfset thisTitle = form["title" & row]>
        <cfset thisContent = form["content" & row]>
        <cfset thisLocation = form["location" & row]>
        <cfset thisID = form["ID" & row]>
        <cfset thisPublished = form["published" & row]>
        <cfset thisUpdated = form["updated" & row]>
        <cfquery datasource="ctband">
          INSERT INTO Events (Calendar, Created_By, All_Day, Event_Start, Event_End, Title, Content, Location, ID, Published, Updated) Values (
          <cfqueryparam value="#thisCalendar#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisCreator#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisAllDay#" cfsqltype="cf_sql_integer">,
          <cfqueryparam value="#thisStarttime#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisEndtime#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisTitle#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisContent#" cfsqltype="cf_sql_clob">,
          <cfqueryparam value="#thisLocation#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisID#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisPublished#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisUpdated#" cfsqltype="cf_sql_timestamp">)
        </cfquery>
      </cfloop>
    </cfif>
    I'm thinking there must be something pretty obvious I've screwed up, but I can't for the life of me find it. Any help would be appreciated!
    JAW

    First, I see this:
    <cfset thisRow = thisRow + 1>
    Which is you counting the number of rows, I assume.  Then I see this:
    <input type="hidden" name="totalRows" value="#row#" />
    But I don't see where #row# has been set.
    You are correct. That was a combination of a couple different attempts at this and I used the wrong variable name on that line. Alas, correcting that didn't solve the problem.
    Then I see this:form["totalRows"]
    When I'm used to seeing this:
    FORM.totalRows
    I've never seen the form["name"] before.  Does that actually work?
    I read somewhere that that's a more effective way of factoring the variable in the name of the form field as an alternative to Evaluate("form.field#row#"). I think it was somewhere on Ray Camden's blog, but it was a while ago. The only reason I used it there was for consistency. That  spot could easily have been FORM.totalRows, but the others would have to be either Evaluate("FORM.calendar#row#") or form["calendar" & row]. Again, I'm learning as I go, though, so I may have used it incorrectly. It's not throwing errors though, it's just reloading a blank page, as if it's submitting the form, but not actually processing the query. That's the confusing part to me.

  • Insert column head continued by script

    Hi,
    I have to insert the continued text on every column top if any heading level text continued on next column. For instance my 'H1','H2','H3','H4' these are the index column head levels, if my 'H3' head level text continued on next column, 'H1','H2' text have to add before the 'H3' text. Is this possible by script? FYI see snapshot
    by
    hasvi

    On 15/11/08 11:50 AM, "chris harges" <[email protected]> wrote:<br /><br />> Will the same thing happen if I try to combine a unicode character with a<br />> string as in: <br />> <br />> set contents of insertion point -1 to "foo" & <2260><br /><br />Yes. If you're using OS X 10.5.x, you can do this:<br /><br />-- outside tell InDesign<br />set theChar to character id 8800 -- decimal equivalent of 2260 hex<br />...<br />set contents of insertion point -1 to "foo" & theChar<br /><br />If you're using an earlier version of the OS, you'll need to do something<br />like:<br /><br />-- outside tell InDesign<br />set theChar to «data utxt2260» as Unicode text<br />...<br />set contents of insertion point -1 to "foo" & theChar<br /><br />-- <br />Shane Stanley <[email protected]>

  • Loop clip till event continues with vid

    Hi There
    I'm new to Flash. I'm trying to make interactive presentation clip.
    What I want is to make the first part of the clip to loop, while discussing the work to be presented, there after by pressing a key on the keyboard, the clip must continue with the rest of the clip. And this must be repeated a few times.
    I can get the loop going, but once I add an eventlistener it doesn't want to work. The examples I would on the internet doesn't seem to help solve the problem. Can someone pls show me how to write minimal working script to run loop till keyboard event will continue to play the rest of the clip

    those arrays aren't doing anything and orgX and orgY change
    values with each for-loop iteration. by the time you rollout of
    your movieclip orgX and orgY will be the last value in the
    for-loop.
    to remedy try:

  • Not Breaking the loop but how to continue with the next iteration in a For

    Hi all
    i have the following piece of code
    Please let me know, what is the /*some construct*/ which will not break the loop but goes to the next iteration skipping Login b
    Loop
    Login A
    /*some construct*/
    Login B
    End loop;
    P.S
    I should do this without Label or Exception ... I am using oracle 8i
    Thanks
    Hariharan
    T

    An [url http://www.oracle.com/pls/tahiti/tahiti.tabbed?section=48911]IF statement?
    loop
      login_a;
      if false
      then
        login_b;
      end if;
    end loop;Regards,
    Rob.

  • 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...

  • Procedure to insert same record for 30 times in a table using for loop

    Hi,
    I need to insert a record in a table which has to be iterated using for loop

    I think you are in the wrong forum. You can do that like this:
    CREATE TABLE my_table (my_column NUMBER);
    BEGIN
       FOR i IN 1 .. 30
       LOOP
          INSERT INTO my_table
                      (my_column
               VALUES (i
       END LOOP;
    END;
    /Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Insert into entering into infinite loop

    Hi All,
    I am using below query to insert into one of my table because of the tty_eff_dt date conversion its entring into infinte loop,
    INSERT INTO tablename
    (col1, col2 tty_eff_dt, col3,
    col4)
    SELECT val1, val2,TO_CHAR (TO_DATE(tty_eff_dt,'MM-DD-YYYY'),'YYYYMMDDHH12MISS') as tty_eff_dt ,
    val3,val4
    FROM tablename
    WHERE col1 = cursorval
    AND TO_CHAR (TO_DATE(tty_eff_dt,'MM-DD-YYYY'),'YYYYMMDDHH12MISS') = summ_statis_rec.tty_eff_dt
    AND col2 = cursorval
    AND col3= cursorval
    and when I remove the date conversion it works fine.
    I am using Toad.
    Please help me out.
    Best regards,
    Pavan

    Hi pavan,
    Please provide your table structure and sample insert scripts.
    There should be Comma between col2 and tty_eff_dt columns in your insert script.
    "INSERT INTO tablename
    (col1, col2, tty_eff_dt, col3, col3)..."
    Regarding
    AND TO_CHAR (TO_DATE(tty_eff_dt,'MM-DD-YYYY'),'YYYYMMDDHH12MISS') = summ_statis_rec.tty_eff_dtYou are converting CHAR to DATE and then again to CHAR, no need as the Time part is not present in tty_eff_dt.
    Directly writing
    AND tty_eff_dt = summ_statis_rec.tty_eff_dtshould work.
    Regards
    Imran

  • OWB mappings to skip rows that are in error and continue processing

    OWB mappings to skip rows that are in error and continue processing.
    1) Enter a record into an error log
    2) Skip rows that are in error
    3) and continue processing
    Type of information could be needed in the error log:
    SY_LOG_ERROR_KEY
    ERROR_TIMESTAMP
    MAP_NAME
    SOURCE_RECORD
    ERROR_CODE
    ERROR_MESSAGE
    ERROR_NOTES
    Example:
    If the source table has five records, in that 3 records has some error.
    When I run the OWB mapping to load the source data to target table, OWB should skip the 3 record and load all the remaining record. This is our requirement.
    Another think I want to store the error record details in a error log table.
    Can u plz tell me whether it is possible in OWB. If not means please give some suggestion to do this.

    Hi,
    thanks for ur help, As is OWB version is 10.2.0 so for set based it is not working. with your idea i create a POST PROCESSING MAPPING. it is now working fine.
    Step 1:
    Create a table MAP_ERROR_LOG.
    Script:
    CREATE TABLE MAP_ERROR_LOG
    ERROR_SEQ NUMBER,
    MAPPING_NAME VARCHAR2(32 BYTE),
    TARGET_TABLE VARCHAR2(35 BYTE),
    TARGET_COLUMN VARCHAR2(35 BYTE),
    TARGET_VALUE VARCHAR2(100 BYTE),
    PRIMARY_TABLE VARCHAR2(100 BYTE),
    ERROR_ROWKEY NUMBER,
    ERROR_CODE VARCHAR2(12 BYTE),
    ERROR_MESSAGE VARCHAR2(2000 BYTE),
    ERROR_TIMESTAMP DATE
    TABLESPACE ODS_D1_AA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 80K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    Step 2:
    Create a sequence MAP_ERROR_LOG_SEQ
    CREATE SEQUENCE MAP_ERROR_LOG_SEQ START WITH 1 INCREMENT BY 1
    Step 3:
    Create a procedure PROC_MAP_ERROR_LOG through OWB.
    In this i have used 3 cursor, first cursor is used to check the count of error messages for the corresponding table(WB_RT_ERROR_SOURCES).
    The second cursor is used to get the oracle error and the primary key values.
    The third cursor is used for get the ORACLE DBA errors such as "UNABLE TO EXTEND THE TABLESPACE" for this type errors.
    CREATE OR REPLACE PROCEDURE PROC_MAP_ERROR_LOG(MAP_ID VARCHAR2) IS
    --initialize variables here
    CURSOR C1 IS
    SELECT COUNT(RTA_IID) FROM OWBREPO.WB_RT_ERROR_SOURCES
    WHERE RTA_IID =( SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    V_COUNT NUMBER;
    CURSOR C2 IS
    SELECT A.RTE_ROWKEY ERR_ROWKEY,SUBSTR(A.RTE_SQLERRM,1,INSTR(A.RTE_SQLERRM,':')-1) ERROR_CODE,
    SUBSTR(A.RTE_SQLERRM,INSTR(A.RTE_SQLERRM,':')+1) ERROR_MESSAGE,
    C.RTA_LOB_NAME MAPPING_NAME,SUBSTR(B.RTS_SOURCE_COLUMN,(INSTR(B.RTS_SOURCE_COLUMN,'.')+1)) TARGET_COLUMN,
    B.RTS_VALUE TARGET_VALUE,C.RTA_PRIMARY_SOURCE PRIMARY_SOURCE,C.RTA_PRIMARY_TARGET TARGET_TABLE,
    C.RTA_DATE ERROR_TIMESTAMP
    FROM OWBREPO.WB_RT_ERRORS A,OWBREPO.WB_RT_ERROR_SOURCES B, OWBREPO.WB_RT_AUDIT C
    WHERE C.RTA_IID = A.RTA_IID
    AND C.RTA_IID = B.RTA_IID
    AND A.RTA_IID = B.RTA_IID
    AND A.RTE_ROWKEY =B.RTE_ROWKEY
    --AND RTS_SEQ =1  
    AND B.RTS_SEQ IN (SELECT POSITION FROM ALL_CONS_COLUMNS A,ALL_CONSTRAINTS B
    WHERE A.TABLE_NAME = B.TABLE_NAME
    AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
    AND A.TABLE_NAME =MAP_ID
    AND CONSTRAINT_TYPE ='P')
    AND A.RTA_IID =(
    SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    CURSOR C3 IS
    SELECT A.RTE_ROWKEY ERR_ROWKEY,SUBSTR(A.RTE_SQLERRM,1,INSTR(A.RTE_SQLERRM,':')-1) ERROR_CODE,
    SUBSTR(A.RTE_SQLERRM,INSTR(A.RTE_SQLERRM,':')+1) ERROR_MESSAGE,
    C.RTA_LOB_NAME MAPPING_NAME,SUBSTR(B.RTS_SOURCE_COLUMN,(INSTR(B.RTS_SOURCE_COLUMN,'.')+1)) TARGET_COLUMN,
    B.RTS_VALUE TARGET_VALUE,C.RTA_PRIMARY_SOURCE PRIMARY_SOURCE,C.RTA_PRIMARY_TARGET TARGET_TABLE,
    C.RTA_DATE ERROR_TIMESTAMP
    FROM OWBREPO.WB_RT_ERRORS A,OWBREPO.WB_RT_ERROR_SOURCES B, OWBREPO.WB_RT_AUDIT C
    WHERE C.RTA_IID = A.RTA_IID
    AND A.RTA_IID = B.RTA_IID (+)
    AND A.RTE_ROWKEY =B.RTE_ROWKEY (+)
    AND A.RTA_IID =(
    SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    -- main body
    BEGIN
    DELETE ED_ODS.MAP_ERROR_LOG WHERE TARGET_TABLE ='"'||MAP_ID||'"';
    COMMIT;
    OPEN C1;
    FETCH C1 INTO V_COUNT;
    IF V_COUNT >0 THEN
    FOR REC IN C2
    LOOP
    INSERT INTO ED_ODS.MAP_ERROR_LOG
    (Error_seq ,
    Mapping_name,
    Target_table,
    Target_column ,
    Target_value ,
    Primary_table ,
    Error_rowkey ,
    Error_code ,
    Error_message ,
    Error_timestamp)
    VALUES(
    ED_ODS.MAP_ERROR_LOG_SEQ.NEXTVAL,
    REC.MAPPING_NAME,
    REC.TARGET_TABLE,
    REC.TARGET_COLUMN,
    REC.TARGET_VALUE,
    REC.PRIMARY_SOURCE,
    REC.ERR_ROWKEY,
    REC.ERROR_CODE,
    REC.ERROR_MESSAGE,
    REC.ERROR_TIMESTAMP);
    END LOOP;
    ELSE
    FOR REC IN C3
    LOOP
    INSERT INTO ED_ODS.MAP_ERROR_LOG
    (Error_seq ,
    Mapping_name,
    Target_table,
    Target_column ,
    Target_value ,
    Primary_table ,
    Error_rowkey ,
    Error_code ,
    Error_message ,
    Error_timestamp)
    VALUES(
    ED_ODS.MAP_ERROR_LOG_SEQ.NEXTVAL,
    REC.MAPPING_NAME,
    REC.TARGET_TABLE,
    REC.TARGET_COLUMN,
    REC.TARGET_VALUE,
    REC.PRIMARY_SOURCE,
    REC.ERR_ROWKEY,
    REC.ERROR_CODE,
    REC.ERROR_MESSAGE,
    REC.ERROR_TIMESTAMP);
    END LOOP;
    END IF;
    CLOSE C1;
    COMMIT;
    -- NULL; -- allow compilation
    EXCEPTION
    WHEN OTHERS THEN
    NULL; -- enter any exception code here
    END;

  • Default dates to loop

    Hi All,
    Thanks for any help. I need to get this fixed asap.
    Below is a function I wrote to insert data into a table but I would also like to add a default time onto the start date and end date and insert into the table but I keep getting errors.
    The part where I try to concatenate the time onto the date is where I am going wrong, am I putting it in the correct place and do I have the right syntax.
    I forgot to mention that the dates that I pass in don't have times just (DD-MON-YYYY).
    Thanks Again
    function ADD_RECORD_TO_LEAVE_LEDGER (
      i_employee_id        in varchar2,
      i_leave_type_id      in varchar2,
      i_start_date         in varchar2,
      i_end_date           in varchar2,
      i_doctors_note       in varchar2,
      i_short_description  in varchar2,
      i_comments           in varchar2)
      return number
      AS
        v_routine_name CONSTANT VARCHAR2(100) DEFAULT 'ADD_RECORD_TO_LEAVE_LEDGER';
        v_return                     NUMBER;
        v_debug_information          VARCHAR2(32000) ;
        v_employee_id                NUMBER ;
        v_leave_type_id              NUMBER ;
        v_start_date                 DATE   ;
        v_end_date                   DATE   ;
        v_doctors_note               NUMBER ;   
        v_leave_date                 DATE;
      BEGIN
        v_employee_id   := TO_NUMBER( i_employee_id) ;
        v_leave_type_id := TO_NUMBER( i_leave_type_id) ; 
        v_doctors_note  := TO_NUMBER( i_doctors_note) ;
        v_start_date    := TO_DATE(   i_start_date, 'DD-MON-YYYY' ) ;
        v_end_date      := TO_DATE(   i_end_date,   'DD-MON-YYYY' ) ;
        v_leave_date       := v_start_date;
        WHILE v_leave_date <= v_end_date
        LOOP
          INSERT INTO lev_calendar
            ( employee_leave_ledger_id
             ,leave_date_start
             ,leave_date_end
             ,part_of_day_id
             ,leave_type_id
             ,doctor_note_id
             ,credit
          VALUES
            ( v_employee_leave_ledger_id
             ,v_leave_date
             ,v_end_date
             ,v_part_of_day_id
             ,v_daily_leave_type_id
             ,v_doctors_note
             ,v_credit
          v_leave_date       := v_leave_date       + 1;
          v_leave_date     := to_date(to_char(v_leave_date,'DD-MON-YYYY') || to_char(v_leave_date,'08:30'),'DD-MON-YYYY HH24:MI')+ 1; 
          v_end_date       := to_date(to_char(v_leave_date,'DD-MON-YYYY') || to_char(v_leave_date,'17:00'),'DD-MON-YYYY HH24:MI'); 
        END LOOP; Edited by: Marie on Oct 13, 2011 8:36 AM

    Marie wrote:
    Hi All,
    Thanks for any help. I need to get this fixed asap.All the more reason for posting a clear question right away, and not waiting for people to beg you to do it.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    If you're asking about a DML statement, such as INSERT, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using.
    Below is a function I wroteor part of a function. It deosn't seem to have a RETURN or an END statement.
    to insert data into a table but I would also like to add a default time onto the start date and end date and insert into the table but I keep getting errors.If you're anxious to get this solved, why hide the error message? Share what you know about the problem if you expect others to share what they know about solutions. Post the complete error message, including line numbers.
    The part where I try to concatenate the time onto the date is where I am going wrong, am I putting it in the correct place and do I have the right syntax.
    I forgot to mention that the dates that I pass in don't have times just (DD-MON-YYYY).
    Thanks Again
    function ADD_RECORD_TO_LEAVE_LEDGER (
    i_employee_id        in varchar2,
    i_leave_type_id      in varchar2,
    i_start_date         in varchar2,
    i_end_date           in varchar2,
    i_doctors_note       in varchar2,
    i_short_description  in varchar2,
    i_comments           in varchar2)
    return number
    AS
    v_routine_name CONSTANT VARCHAR2(100) DEFAULT 'ADD_RECORD_TO_LEAVE_LEDGER';
    v_return                     NUMBER;
    v_debug_information          VARCHAR2(32000) ;
    v_employee_id                NUMBER ;
    v_leave_type_id              NUMBER ;
    v_start_date                 DATE   ;
    v_end_date                   DATE   ;
    v_doctors_note               NUMBER ;   
    v_leave_date                 DATE;
    BEGIN
    v_employee_id   := TO_NUMBER( i_employee_id) ;
    v_leave_type_id := TO_NUMBER( i_leave_type_id) ; 
    v_doctors_note  := TO_NUMBER( i_doctors_note) ;
    v_start_date    := TO_DATE(   i_start_date, 'DD-MON-YYYY' ) ;
    v_end_date      := TO_DATE(   i_end_date,   'DD-MON-YYYY' ) ;
    v_leave_date       := v_start_date;
    WHILE v_leave_date <= v_end_date
    LOOP
    INSERT INTO lev_calendar
    ( employee_leave_ledger_id
    ,leave_date_start
    ,leave_date_end
    ,part_of_day_id
    ,leave_type_id
    ,doctor_note_id
    ,credit
    VALUES
    ( v_employee_leave_ledger_id
    ,v_leave_date
    ,v_end_date
    ,v_part_of_day_id
    ,v_daily_leave_type_id
    ,v_doctors_note
    ,v_credit
    v_leave_date       := v_leave_date       + 1;
    v_leave_date     := to_date(to_char(v_leave_date,'DD-MON-YYYY') || to_char(v_leave_date,'08:30'),'DD-MON-YYYY HH24:MI')+ 1; 
    v_end_date       := to_date(to_char(v_leave_date,'DD-MON-YYYY') || to_char(v_leave_date,'17:00'),'DD-MON-YYYY HH24:MI'); 
    END LOOP;
    Maybe you should replace the 3 assignments near the end with these:
          v_leave_date     := v_leave_date       + 1;
          v_start_date     := v_leave_date           + 1 + (8.5 / 24);
          v_end_date       := v_leave_date          +     (17  / 24);Once you have the strings converted to DATEs, continue to work with them as DATEs. don't keep converting them back to strings, and then back to DATEs again. You know how to add 1 day to a DATE. An hour is just 1/24 of a day, so adding 8 1/2 hours to a DATE is just a matter of adding (8.5 / 24) to it.
    If you want this kind of thin to apply to all the rows INSERTed, then do it before the INSERT statment, not after it.
    If you're always setting v_end_date to be 17 hours after v_leave date, then the loop condition
    WHILE v_leave_date <= v_end_date will always be TRUE, so the function will never return. (However, that happens at run-time. You still need a RETURN and an END statement so the function will compile.)

Maybe you are looking for

  • Doesn't sync my library with iPod... Help me please or I'll dye...

    Hi, please please help me if you can. I was working all the summer and I've bought iPod nano for my money and... Firt it worked well and everything was going well but.. From Friday I cannot sync my iPod with library. I tried restore it, but it didn't

  • XML parser with document support

    Hi all, For a whole week now, I m still looking for a nice (but lite) XML parser for J2ME applications. Of course I found kXML 2 parser but I'm confused. kXML 2 implements the XmlPull API (xmlpull.org) so you can parse easly an XML file with function

  • Update passed in XML doc with pl/sql xmldom

    Hi, I have an xml document that is passed in through a stored procedure as CLOB. I'm trying to use the XMLParser and XMLDOM to add an additional node The XML looks something like the following <rowset> <row> <firstname>john</firstname> </row> <row> <

  • CRM 5.0 ear files - How to get the b2c.ear file for custom development

    Hi all, We are using CRM 5.0 e-commerce (B2C). We are looking to import the b2c.ear file into the NW dev studio. We do not seem to be able to find the file. Alexandre PS: Do we need to have the NWDI in order to do custom ISA (b2c) development ?

  • Designjet 450c

    I have a 450c printer that I have tried everything on and am about ready to give up.  Long story short, I have the new cable that this forum said I needed, I put a new ink cartridge in and the printer will print a test page if I manually print it fro