How to do the calculation in the plsql loop?

Hi,
I have table like below below
MODEL_NAME     ITEM_NUMBER     DA_VALUE
     A     A-1          2.1
     A     A-2          3.1
     A     A-3          1.1
     A     A-4          4.5
     B     B-1          3.2
     B     B-2          5.3
     B     B-3          7.2
     C     C-1          3.9
     C     C-2          4.0
     C     C-3          9.9          I need to write a stored procedure with 2 input values. One is design_code and another one is model_name. I will pass the model name as comma
separated values to the procedure. Model name is nothing but A,B,C in the above table. Procedure has to split those model names and display
all the item_numbers and da_numbers for the model names.
Here the logic is i have to take all the model's item da_value and multiply.
For example for the above table, I have to multiply all A-1 da_values and B-1 da_value and C-1 da_value then stored in to one array that result.
Again A-1 da_value and B-2 da_values and C-2 da_values then stored into the same array.
Again A-1 da_value and B-3 da_values and C-3 da_values then stored into the same array.
After that come to A-2 da_value and start B-1 da_value and C-1 da_value then store into the same array.
Again A-2 da_value and B-2 da_values and C-2 da_values then stored into the same array.
Again A-2 da_value and B-3 da_values and C-3 da_values then stored into the same array.
So like this only the flow should go for all the models. Below is the sample example.
v_variable := 2.1 * 3.2 * 3.9;
           A-1   B-1   C-1
v_variable := 2.1 * 5.3 * 4.0;
           A-1   B-2   C-2          
v_variable := 2.1 * 7.2 * 9.9;
           A-1   B-3   C-3
v_variable := 3.1 * 3.2 * 3.9;
           A-2   B-1   C-1          
v_variable := 3.1 * 5.3 * 4.0;
           A-2   B-2   C-2     The calculation should happen like above example. Can anyone share with your thoughts?
Thanks

Hi All,
I have built the below package. It is something like below. But it is working 75%. can you rearrange this?
    PROCEDURE calc_cv_valve (
            i_design_cv     IN NUMBER,
            i_option_class  IN VARCHAR2
            --o_calculated_cv OUT FND_TABLE_OF_VARCHAR2_255,
            --o_item_number   OUT FND_TABLE_OF_VARCHAR2_255
    IS
        CALC_CV     FND_TABLE_OF_VARCHAR2_255 := FND_TABLE_OF_VARCHAR2_255();
        ITEM_NUMBER FND_TABLE_OF_VARCHAR2_255 := FND_TABLE_OF_VARCHAR2_255();
        TYPE calculate_oc1_cv_rec IS RECORD
                 ITEM_NUMBER          VARCHAR2(100) := NULL,
                 CV_NUMBER      NUMBER := NULL                
        TYPE calculate_oc1_cv_tbl_type IS TABLE OF calculate_oc1_cv_rec INDEX BY BINARY_INTEGER;
        v_calculate_oc1_cv_tbl_type   calculate_oc1_cv_tbl_type;
        v_calc_oc1_index  PLS_INTEGER;
        TYPE calculate_oc2_cv_rec IS RECORD
                 ITEM_NUMBER          VARCHAR2(100) := NULL,
                 CV_NUMBER      NUMBER := NULL                
        TYPE calculate_oc2_cv_tbl_type IS TABLE OF calculate_oc2_cv_rec INDEX BY BINARY_INTEGER;
        v_calculate_oc2_cv_tbl_type   calculate_oc2_cv_tbl_type;
        v_calc_oc2_index  PLS_INTEGER;
        TYPE calculate_oc3_cv_rec IS RECORD
                 ITEM_NUMBER          VARCHAR2(100) := NULL,
                 CV_NUMBER      NUMBER := NULL                
        TYPE calculate_oc3_cv_tbl_type IS TABLE OF calculate_oc3_cv_rec INDEX BY BINARY_INTEGER;
        v_calculate_oc3_cv_tbl_type   calculate_oc3_cv_tbl_type;
        v_calc_oc3_index  PLS_INTEGER;               
        TYPE option_class_rec IS RECORD
                 OPTION_CLASS      VARCHAR2(100) := NULL
        TYPE option_class_tbl_type IS TABLE OF option_class_rec INDEX BY BINARY_INTEGER;
        v_option_class_tbl_type   option_class_tbl_type;
        v_option_index  PLS_INTEGER;
        v_count_option_class    NUMBER;
        v_attribstart           NUMBER;
        v_attribpos             NUMBER;
        v_calc1_inc     NUMBER;
        v_calc2_inc     NUMBER;
        v_calc3_inc     NUMBER;
        v_end_loop2     NUMBER;
        v_end_loop3     NUMBER;
        v_end_loop4     NUMBER;
        v_end_loop5     NUMBER;
        v_prior_loop    NUMBER;
        v_valid_cv      NUMBER;
        v_calculation   NUMBER;
    BEGIN
        BEGIN
            SELECT  COUNT(COLUMN_VALUE)
            INTO    v_count_option_class
            FROM    TABLE(xxcz_va_sizing_util_pkg.get_string_comma(i_option_class,','));
            DBMS_OUTPUT.PUT_LINE('Count of Option Class----: '||v_count_option_class);
        EXCEPTION
        WHEN OTHERS
        THEN
            NULL;       
        END;
        IF v_count_option_class = 3
        THEN
            v_attribstart := 1;
            v_attribpos := 1;
            v_option_index := 1;
            WHILE (v_attribpos <> 0)
            LOOP
                v_attribstart := v_attribpos;
                xxcz_va_sizing_util_pkg.tokenize_string (v_attribstart,
                                                        ',' || i_option_class,
                                                        v_option_class_tbl_type(v_option_index).option_class,
                                                        v_attribpos
                v_option_index := v_option_index + 1;
            END LOOP;
            SELECT  item_number, cv_number
            BULK COLLECT INTO v_calculate_oc1_cv_tbl_type
            FROM    SAMPLE_CONTROLS--xxcz_va_controls_info
            WHERE   control_name = v_option_class_tbl_type(1).option_class;
            SELECT  item_number, cv_number
            BULK COLLECT INTO v_calculate_oc2_cv_tbl_type
            FROM    SAMPLE_CONTROLS--xxcz_va_controls_info
            WHERE   control_name = v_option_class_tbl_type(2).option_class;           
            SELECT  item_number, cv_number
            BULK COLLECT INTO v_calculate_oc3_cv_tbl_type
            FROM    SAMPLE_CONTROLS--xxcz_va_controls_info
            WHERE   control_name = v_option_class_tbl_type(3).option_class;
            --v_calc1_inc := v_calculate_oc1_cv_tbl_type.count;
            DBMS_OUTPUT.PUT_LINE('v_calculate_oc1_cv_tbl_type----: '||v_calculate_oc1_cv_tbl_type.count);
            --v_calc2_inc := v_calculate_oc2_cv_tbl_type.count;
            DBMS_OUTPUT.PUT_LINE('v_calculate_oc2_cv_tbl_type----: '||v_calculate_oc2_cv_tbl_type.count);          
            --v_calc3_inc := v_calculate_oc3_cv_tbl_type.count;
            DBMS_OUTPUT.PUT_LINE('v_calculate_oc3_cv_tbl_type----: '||v_calculate_oc3_cv_tbl_type.count);
            v_calc1_inc := 0;
            v_calc2_inc := 0;
            v_calc3_inc := 0;
            v_end_loop2 := 0;
            v_end_loop3 := 0;
            v_end_loop4 := 0;
            v_end_loop5 := 0;
            v_prior_loop    := 0;
            v_valid_cv  := 0;
            WHILE (v_calculate_oc1_cv_tbl_type.next(v_calc1_inc) IS NOT NULL) AND v_valid_cv = 0
            LOOP
                DBMS_OUTPUT.PUT_LINE('Pre index count of oc1----: '||v_calc1_inc);
                v_calc1_inc := v_calculate_oc1_cv_tbl_type.next(v_calc1_inc);
                DBMS_OUTPUT.PUT_LINE('Post index count of oc1----: '||v_calc1_inc);
                v_prior_loop := v_calculate_oc1_cv_tbl_type.prior(v_calc1_inc);
                --IF v_calc1_inc <> v_prior_loop--v_end_loop2 = 1 OR v_end_loop4 = 1
                --THEN
                    v_calc2_inc := 0;
                    DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Y');
                --END IF;
                DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'N');
                WHILE (v_calculate_oc1_cv_tbl_type.next(v_calc2_inc) IS NOT NULL)
                LOOP
                    DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Pre index count of oc2----: '||v_calc2_inc);
                    v_calc2_inc := v_calculate_oc1_cv_tbl_type.next(v_calc2_inc);
                    DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Pre index count of oc2----: '||v_calc2_inc);
                    --IF v_calc1_inc <> v_prior_loop AND v_calc2_inc = v_calculate_oc1_cv_tbl_type.prior(v_calc2_inc)--v_end_loop3 = 1 OR v_end_loop5 = 1
                    --THEN
                        v_calc3_inc := 0;
                        DBMS_OUTPUT.PUT_LINE('Y');                       
                    --END IF;
                    DBMS_OUTPUT.PUT_LINE('N');                                       
                    WHILE (v_calculate_oc1_cv_tbl_type.next(v_calc3_inc) IS NOT NULL)
                    LOOP
                        DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Pre index count of oc3----: '||v_calc3_inc);
                        v_calc3_inc := v_calculate_oc1_cv_tbl_type.next(v_calc3_inc);
                        DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Pre index count of oc3----: '||v_calc3_inc);
                        DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Calc Value----: '||v_calculate_oc1_cv_tbl_type(v_calc1_inc).cv_number||','
                                                                ||v_calculate_oc2_cv_tbl_type(v_calc2_inc).cv_number||','
                                                                ||v_calculate_oc3_cv_tbl_type(v_calc3_inc).cv_number);
                        v_calculation := v_calculate_oc1_cv_tbl_type(v_calc1_inc).cv_number + v_calculate_oc2_cv_tbl_type(v_calc2_inc).cv_number +
                                            v_calculate_oc3_cv_tbl_type(v_calc3_inc).cv_number;
                        DBMS_OUTPUT.PUT_LINE(v_calc1_inc||'Calculated value----: '||v_calculation);                                           
                        IF i_design_cv <= v_calculation
                        THEN
                            v_valid_cv  := 1;
                            DBMS_OUTPUT.PUT_LINE('v_valid_cv----: '||v_valid_cv);                           
                            GOTO end_loop;                           
                        END IF;
                        IF v_calculate_oc2_cv_tbl_type.next(v_calc2_inc) IS NOT NULL
                        THEN
                            v_end_loop2 := 1;
                            DBMS_OUTPUT.PUT_LINE('v_end_loop2----: '||v_end_loop2);                           
                            GOTO calc2_loop;                           
                        END IF;
                        IF v_calculate_oc3_cv_tbl_type.next(v_calc3_inc) IS NOT NULL
                        THEN
                            v_end_loop3 := 1;
                            DBMS_OUTPUT.PUT_LINE('v_end_loop3----: '||v_end_loop3);
                            GOTO calc3_loop;
                        END IF;                       
                        IF v_calc2_inc = v_calculate_oc2_cv_tbl_type.count AND v_calc3_inc = v_calculate_oc3_cv_tbl_type.count
                        THEN
                            IF v_calc2_inc = v_calculate_oc2_cv_tbl_type.count
                            THEN
                                v_end_loop4 := 1;
                            ELSE
                                v_end_loop5 := 1;
                            END IF;
                            DBMS_OUTPUT.PUT_LINE('Count point reached for both oc2 and oc3----: '||v_calculate_oc2_cv_tbl_type.count
                                        ||','||v_calculate_oc3_cv_tbl_type.count);
                            GOTO next_record;
                        END IF;
                        <<calc3_loop>>
                        DBMS_OUTPUT.PUT_LINE('Third Loop Conditions finished-------: '||v_calculation);
                    END LOOP;
                    <<calc2_loop>>
                    DBMS_OUTPUT.PUT_LINE('Second Loop Conditions finished-------: '||v_calculation);
                END LOOP;
                <<end_loop>>
                DBMS_OUTPUT.PUT_LINE('Loop Conditions Satisfied-------: '||v_calculation);
                <<next_record>>
                DBMS_OUTPUT.PUT_LINE('Loop Conditions Started with next record-------: '||v_calculation);
            END LOOP;
        END IF;
    END calc_cv_valve;

Similar Messages

  • HOW TO TRACE THE PLSQL API BEING CALLED WHEN WE USE FORM

    Dear ALL,
    How I can track the PLSQL API name when we press any button in form.
    For example when I click on Bill By Requirement button on EAM Work Order Billing FORM , how will I know which PLSQL API is being called.
    Please give me an idea about how to identify the PLSQL API being called.
    Thanks and Regards,
    Lavan

    Please refer to (FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]).
    Thanks,
    Hussein

  • How to remove the simulation loop from the block diagram

    hi,
    i have used lap view version 8.6 to design pid system. i have the pid block diagram with daq  on simulation loop. now my supervisor want me to remove the simulation loop. anyone know how to remove the simulation loop without deleting the pid block diagram. i have attached my pid program.
    Attachments:
    Copy of LAP VIEW FINAL for engine dyno.vi ‏221 KB

    logaraj wrote:
    hi,
    i have used lap view (  ) version 8.6 to design pid system. i have the pid block diagram with daq  on simulation loop. now my supervisor want me to remove the simulation loop. anyone know how to remove the simulation loop without deleting the pid block diagram. i have attached my pid program.
    You cannot remove the simulation loop alone because all the functions kept inside that loop will work inside that loop only. If you have to remove means then you have to find another way to inplement the PID control.
    The best solution is the one you find it by yourself

  • How to override the event loop

    As a windows game developer, I have always overridden the application message loop to make sure that graphics were rendered when the CPU was idle, and still being able to process windows messages like keyboard/mouse events. CPU is then maxed out (except when a forced sleep or v-sync is enabled) to give highest performance on graphics, making a simple clear opengl window render at 3500 frames per second (I know this is idiotic but I'm trying to make a point).
    Now that I'm porting my game engine (c++ code) to cocoa, I  am struggling with how to implement the main loop. I could use a timer but this will fix the framerate and might be slow. It will prevent me to use the CPU to its full extent.
    So: is there some kind of OnIdle event I can override? Or do I have to do the Event loop processing myself? And can anyone tell me how to do something like this? Is there a tutorial or a book or anything I can study to learn about this? I presume this is lower level API.
    Any help is appreciated!
    Dirk.

    etresoft wrote:
    Michael may profess ignorance about MacOS X applications, but he is still 100% correct. You need to study the architecture and find the best way to work with it. The first thing to know is that the CPU is irrelevant. Let the GPU handle your graphics - that is what it does best. You do want your CPU to be as idle as possible. Approach it from a device-driver or event-driven perspective.
    Just to clarify that I'm not a total noob trying to write his first program: of course I will not overly use the CPU if not necessary. I completely agree with what you guys say about maximizing CPU usage. My game engine on windows will put the CPU to sleep when it's not necessary making my engine perform very good with almost no CPU usage.
    But... when I want to test if changes to my engine/shaders/... improve or degrade performance of the renderings, I want to be sure that everything is maxed out so that I can be sure that the difference is correct. On maxed out CPU/GPU, I will notice the difference when framerate goes for example from 2000 to 1900 while this will not be visible when just at 60 fps and a lot of free time. I will see 60 fps even when my code is worse. That's why I need to be able to test this.
    Anyway, as I said, I completely agree and I will certainly do my very best to make sure that CPU is not overly used. So my question remains: how can I make sure that I have everything I need at the time I need it while I will do my best to make sure nothing more is used?
    Timer-events at 1/60th of a second is not the answer...
    Using threads for these things is not the answer... I use them for other things (loading from disk/processing data/generating data)
    But are there other options?
    Can you point me to where I can learn more about the architecture and its possibilities?

  • How to detect the final loop iteration of a step in a PostStep Engine Callback?

    I see the need to use a PostStep Engine Callback and look at the Step.Result container of the caller.
    My issue: If the caller is configured to loop, the PostStep Engine CB executes with each iteration and I do not see how to detect the final iteration (which is the only iteration I am interested in).
    Ideas are welcome. Thanks in advance,
    Guenter

    Guenter,
    well, the way i discripted IS the generic way. The reason for this is the following:
    You can compare TestStand very well with procedural programming languages. So you have variables with different lifetimes and scope. RunState is one variable, which is available in every scope, but it may have different content.
    So you leaving the execution of your clientsequence in order to call the callback, you leave the scope of the RunState from your clientsequence. But only there the information is stored on how many iterations are left. It does not make sense to pass this anywhere, since the execution of your clientsequence has to decide if to loop further or not.
    But, please note that there are different scopes for the "disable result recording" as well. You have found the most global one, the station option. But you can as well set this in the sequence settings (Edit >> Sequence Properties >> Disable Result Recording for All Steps) and at step-level (Run Options >> Record Result {uncheck it}).
    Looping on a single step using the step settings, you can additionally choose not to record results for each iteration. This will lead to only a single entry in the ResultList, the overall result of the looped step (if resultcollection is enabled of course!).
    hope this helps,
    Norbert 
    Message Edited by Norbert B on 08-22-2008 02:10 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to EXIT the while loop in Event response section?

    I'm writing a program to grab image using a NI card. The application uses the Event structure. When the GRAB button was pressed, it snaps image continually by putting the SNAP function in a while loop. Is there some way to exit the while loop?(Note :The while loop was put in the GRAB IMAGE event response section.)

    edit this event-case AND uncheck "lock front panel until the event case for this event completes".
    BTW, your thanks should go to Ankita, <a href='http://forums.ni.com/ni/board/message?board.id=170&message.id=151282'>here</a>
    cheers! 
    Message Edited by Dynamik on 11-13-2005 01:26 AM
    Message Edited by Dynamik on 11-13-2005 01:38 AM
    When they give imbeciles handicap-parking, I won't have so far to walk!
    Attachments:
    untitled.GIF ‏20 KB

  • How to handle the plsql error occuring in the exception block

    We know how to handle exceptins which occur in BEGIN block.
    But am unable to catch the exception in the exception block. Am writing an erroeneous code so that the control will go to exception block and there is also one plsql error, but am unable to handle that error, it's returning the error to the calling environment.
    DECLARE
    cnt NUMBER(5):=0;
    BEGIN
    select 'debalina' INTO cnt from dual;
    DBMS_OUTPUT.PUT_LINE(to_char(cnt));
    EXCEPTION
    WHEN invalid_number THEN
    DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
    cnt:='deba';
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
    END;
    please suggest me how to catch this exception?

    Hi,
    DECLARE
    cnt NUMBER(5):=0;
    BEGIN
    select 'debalina' INTO cnt from dual;
    DBMS_OUTPUT.PUT_LINE(to_char(cnt));
    EXCEPTION
    WHEN invalid_number THEN
    DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
    cnt:='deba';
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
    END;
    First of all your namee exception which you have posted i.e invalid_number itself is wrong.
    You need to use named exception VALUE_ERROR for catching the exception in the main block.
    SQL> DECLARE
      2  cnt NUMBER(5):=0;
      3  BEGIN
      4  select 'debalina' INTO cnt from dual;
      5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
      6  EXCEPTION
      7  WHEN Invalid_number THEN
      8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
      9  end;
    10  /
    DECLARE
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 4
    SQL>  DECLARE
      2   cnt NUMBER(5):=0;
      3  BEGIN
      4  select 'debalina' INTO cnt from dual;
      5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
      6  EXCEPTION
      7  WHEN VALUE_ERROR THEN
      8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
      9  end;
    10  /
    error has occured inside main block
    PL/SQL procedure successfully completed.Your doubt regarding catching the exception in exception block, you can execute as below, by nesting a Begin block inside the exception block itself.
    SQL> DECLARE
      2  cnt NUMBER(35):=0;
      3  BEGIN
      4  select 'debalina' INTO cnt from dual;
      5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
      6  EXCEPTION
      7  WHEN Value_error THEN
      8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
      9  Begin
    10  cnt:='deba';
    11  Exception
    12  WHEN OTHERS THEN
    13  DBMS_OUTPUT.PUT_LINE('error has occured inside exception block');
    14  End;
    15  END;
    16  /
    error has occured inside main block
    error has occured inside exception block
    PL/SQL procedure successfully completed.Hope your doubt is clear.
    Twinkle

  • How to get the plsql table data into output cursor

    Hi,
    Could anybody please help me.
    Below is an example of the scenario..
    CREATE OR REPLACE PACKAGE chck IS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
    TYPE get_rec is record (ename varchar2(20),
    eno number(12));
    TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
    emp_tab t_recs;
    END chck;
    CREATE OR REPLACE PACKAGE BODY chck AS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
    is
    BEGIN
    select ename, eno
    bulk collect into emp_tab
    from emp;
    open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
    END;
    END chck;
    the above package is giving me an error:
    LINE/COL ERROR
    10/29 PL/SQL: SQL Statement ignored
    10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
    item
    let me know what needs to be changed
    Thanks
    Manju

    manjukn wrote:
    once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
    It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
    It is an extremely primitive structure - and should never be confused as being just like a table.
    Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it.

  • How to run the cursor loop once even if it is true for many times - urgent

    Hi,
    Say
    loop
    tdate='12-JAN-2005'
    loop
    cursor.......
    if '10-JAN-2005'<=tdate then
    fetch
    end loop
    tdate=tdate+1 month
    end loop;
    in the above query i want my cursor to run the loop only once at the first true of my condition....in the second run the tdate will be = '12-FEB-2005'....but my cursor loop should not go in..it has to comeout....
    how to do this....plz help very urgent

    in the above query i want my cursor to run the loop only once at the first true of
    my condition....in the second run the tdate will be = '12-FEB-2005'....but my
    cursor loop should not go in..it has to comeout....Simply control has been the cursor processed or not.
    Something like that
    SQL> declare
      2    tdate date := to_date('12-JAN-2005','DD-MON-YYYY');
      3    cursor cr is select * from dual;
      4    rt dual%rowtype;
      5    cursor_has_been_processed boolean := false;
      6  begin
      7   loop
      8     if to_date('10-JAN-2005','DD-MON-YYYY') <=tdate then
      9             if not cursor_has_been_processed then
    10                     open cr;
    11                     loop
    12                     fetch cr into rt;
    13                     exit when cr%notfound;
    14                     end loop;
    15                     close cr;
    16                     cursor_has_been_processed := true;
    17                     dbms_output.put_line('Cursor has been processed');
    18             end if;
    19     --DO something
    20     null;
    21          end if;
    22     dbms_output.put_line(tdate);
    23     tdate := add_months(tdate,1);
    24     exit when tdate >= to_date('12-MAY-2005','DD-MON-YYYY');
    25   end loop;
    26  end;
    27  /
    Cursor has been processed
    12-JAN-05
    12-FEB-05
    12-MAR-05
    12-APR-05
    PL/SQL procedure successfully completed.Rgds.

  • How to control the acquisition loop?

    Hello,
    I have the following structure in my code, in the acquisition below, I would like to set some sort of a trigger or condition to control when to start reading. Without the condition,It works fine, But it reads all the time as long as my thread is on. In traditional drivers, I had DAQ-DB-HalfReady flag to control when to start reading. How could I accomplish the same concept here?
    Thanks
    while(Thread is ON)
    {  GetNIRawData()....}
    int GetNIRawData()
       if( Condition here){
    DAQmxReadAnalogBinary16(taskHandle1,ai0:ai3,....) // Read Analog
    DAQmxReadCounterU32(taskHandle2, 1000,......) // Read Counter1
    DAQmxReadCounterU32(taskHandle3, 1000,......) // Read Counter2
            } // end condition here
    Note if I use the following structure, I get error code -200019,
    int GetNIRawData()
    int status = DAQmxReadAnalogBinary16(taskHandle1,ai0:ai3,....) // Read Analog
    if(Status==0) // as my condition
         DAQmxReadCounterU32(taskHandle2, 1000,......) // Read Counter1
         DAQmxReadCounterU32(taskHandle3, 1000,......) // Read Counter2

    Hi softwareguy,
    You could trigger analog input and counter tasks off of your
    encoder. The example DAQmx
    – Event Counting on Multiple Counters with Digital Start Trigger shows how
    you can set a digital start trigger for two counter tasks. For your
    application, wire your encoder to a PFI line and select that line as your
    trigger. This method will not require you to read or check the motor state
    since it won’t begin reading until the encoder starts moving.
    Alternatively, if you are using a DAQmx Task to drive your
    motor, you can use the DAQmxIsTaskDone function to query the execution status
    of that task. The Boolean variable isTaskDone will return true if the task has completed
    or is not currently executing and false otherwise. Below is a screen shot of
    the NI-DAQmx C Reference Help (Start »
    Programs » National Instruments » NI-DAQmx C Reference Help) on this
    function.
    Please post back if you have any questions. Have a great day!
    Message Edited by ryan_d on 12-03-2007 02:43 PM
    Ryan D.
    District Sales Manager for Boston & Northern New England
    National Instruments
    Attachments:
    DAQmxIsTaskDone.png ‏35 KB

  • How to recover the for loop or seq() from a sequence result

    assume generate a sequence with code
    for i in 1..2 do
        append 1 to a list to represent outer loop
        for j in 1..3 do
               append 2 to list to represent inner loop
    result in [1,2,2,2,1,2,2,2]
    is it possible to recover for loop code and seq() function code from [1,2,2,2,1,2,2,2] ?
    with fold or unfold or other method?
    computing nightmare

    Yes; and in doing so, your program will converge towards being an exemplar of the generalization of
    Greenspun's tenth rule to any arbitrary language (rather than just 'C' or Fortran).

  • How to treat error handling in the consumer loop in the queue message handler structure?

    Hi,
    I'd like to know how to stop the producer loop(event loop) in the QMH structure when the error happened in the consumer loop.
    I've construct a demo code by myself as the attached image, but it's a pity that I have to create a recdundant indicator "End" to trigger the value change event to stop the program. This is not a good way to do it. Could someone give me some better idea how to deal with it? Very appreciated to you sharing ideas.

    Concerning your doubts about the "traditional" implementation of this pattern, I hear you. As I have written many times before, its main benefit is that it is easy to explain in a training class. It unfortunately has a lot of drawbacks.
    Tim's suggestion about User Events, is a good one. But to use it to the best advantage, you will need to get away from having everything on one block diagram. If you think about it there is no real need for the two loops to be on the same block diagram and a lot of really good reasons for them not to be. For example, if they are in separate VIs, they can both be event driven and any communication problems between loops evaporates.
    Its also more modular, easier to maintain, more reusable, etc...
    Check the link in my signature.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to time stretch a 2 bar audio loop to fit logic tempo, please help

    hi, i can match the logic tempo to fit the audio loop ok.
    But say if i have a song which is 84.7153 tempo.
    I have a 2 bar audio loop that i want to incorporate. The audio loop is a little faster than my logic tempo, so i just want it to fit exactly in two cycled logic bars.
    Ive just managed to do it pretty close, in recycle, manually.
    But can i do this in logic? Audio factory or something?
    Ive been using logic for years, and ive never exlplored logics audio depths.
    can someone help?
    thankyou.

    Use the Apple Loops Utility
    http://www.digimixstudios.net/sd1al/
    In my 3rd video here, I show how to use the Apple Loops Utility. Very simple.
    The 4th video shows bringing the apple loop I just created, into a Logic 8 project.
    Notice how I change the tempo and the apple loop stays within the 4 bar beat.

  • How to write the expression when create the calculated column?

    Dear,
           I want to create some calculated column in my attribute view, but I don't know how to write the code in the expression, is there any introduction about this part, how to use those function and how about the grammar in this expression code ?  or is there any example about this calculated column?
       Thanks for your sincerely answer.

    Hi Zongjie,
    you can find some information about the creation of calculated columns in the HANA Modeling Guide (http://help.sap.com/hana/SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en.pdf).
    Within chapter 6.2.1 (Create Analytic Views) you can see under point 7 some basics and also a simple example. The same is also valid for Calculation Views.
    Chapter 8.9 (Using Functions in Expressions) describes the different available functions.
    You also can use the integrated search in the HANA Studio by clicking the "?" button in the button left corner. Then you get some links in the side panel with related information.
    In general you can write your expression manually or you can just drag and drop the functions, elements, operators into the editor window. For example if you drag and drop the "if" function into the editor window you get "if(intarg,arg2,arg3)" inserted. The arguments can be replaced manually or also by drag and drop.
    It is also worse to use the "Validate Syntax" button on top of the editor window. It gives you directly a feedback if your expression syntax is correct. If not you get some helpful information about the problem (ok, sometimes it is a little bit confusing because of the cryptic error message format ).
    Best Regards,
    Florian

  • How to use the Calculated attibute in view object

    Hi,
    I have a view object query with the calculated attribute name as 'TRANCODE' in the below sql.This query works for the initial page loading.
    After the page gets loaded, there is a search section in the same page at the top.
    Here i will have to build the whereclause to the same query and retrieve the values.
    i am using jDeveloper 10.1.3.1, with adf and jHeadstart.
    Can some one tell as how to use the calculated attribute TRANCODE in whereclause?
    SELECT /*+ first_rows(10) */
    BatchCntl.FILE_CNTL_ID,
    CASE WHEN chk_bit(Entry.ENTRY_FLAGS, 2)='Y' OR Entry.ENTRY_SUBSTATUS = 'D' OR Entry.ENTRY_SUBSTATUS = 'J'
    THEN
    CASE eeh.TRAN_CODE
    WHEN '21' THEN 'C'
    WHEN '22' THEN 'C'
    WHEN '31' THEN 'C'
    WHEN '32' THEN 'C'
    WHEN '26' THEN 'D'
    WHEN '27' THEN 'D'
    WHEN '36' THEN 'D'
    WHEN '37' THEN 'D'
    ELSE eeh.TRAN_CODE
    END
    ELSE
    CASE Entry.TRAN_CODE
    WHEN '21' THEN 'C'
    WHEN '22' THEN 'C'
    WHEN '31' THEN 'C'
    WHEN '32' THEN 'C'
    WHEN '26' THEN 'D'
    WHEN '27' THEN 'D'
    WHEN '36' THEN 'D'
    WHEN '37' THEN 'D'
    ELSE Entry.TRAN_CODE
    END
    END AS TRANCODE,
    FROM Batch_Cntl BatchCntl, Entry, ENTRY_EDIT_HIST eeh
    WHERE (BatchCntl.BATCH_TYPE = 'E')
    AND (BatchCntl.BATCH_STATUS in ('A','D','R','P'))
    AND entry.in_batch_cntl_id = BatchCntl.BATCH_CNTL_ID
    and Entry.fi_rt = eeh.fi_rt (+)
    and Entry.entry_id = eeh.entry_id (+)
    AND (Entry.ENTRY_STATUS in ('A','D','R','P'))
    ORDER BY BatchCntl.BATCH_CNTL_ID, Entry.entry_id
    regards
    Raj.

    Let's say your application module is com.yourcompany.someapp.services.MyService, and let's say you authored a method like the following in the MyServiceImpl.java file:
      public void doSomething(int i, String s) {
      }and you exposed this AM custom method using the AM editor.
    BC4J design time will automatically create you the com.yourcompany.someapp.services.common.MyService interface that will look like this if you go look at the source code:
    package com.yourcompany.someapp.services.common;
    import oracle.jbo.ApplicationModule;
    public interface MyService extends ApplicationModule {
      public void doSomething(int i, String s);
    }To use your custom method from a client, just cast your ApplicationModule to your custom interface like this:
    import com.yourcompany.someapp.services.common.MyService;
      MyService mySvc = (MyService)yourAM;
      mySvc.doSomething(1,"foo");

Maybe you are looking for

  • Interactive report & htmldb_Get

    I have 3 pages in my application: 1. Main 2. Report 3. Interactive report The source SQL code of Report is the same as Interactive report. The HTML header&footer of Report is the same as Interactive report. I use function load_report for calling the

  • Refreshing MV when connection failed

    hi , I am using Oracle 9i, in my mv refresh in the event of an ip addr change and it cannot makes the connection , will that data in my MV table got deleted as well or Oracle will establish the connection is ok first and only then does a MV refresh ?

  • App Store on Mac osx crash when attempting to update

    I am using a Mac mini 2011 late. OSX Mountain  lion  latest penultimate version, just prior to the release of the AFP upgrade.  Problem is: The App Store crashes! When I attempt to run the App Store it loads but as soon as I hit the Update icon, the

  • DHCP in 6509E in VSS mode

    Hi, I am in the process of installing two 6509Es in VSS mode. Our enviroment uses the core switches as the DHCP server for the IP Phones; however, I was wondering how this would work in case they go on standalone mode. Which one would be the dhcp ser

  • Oracle BI EE install hangs

    I am new to Oracle BI EE and installing it on RHEL 5 server(32 bit). Completed the installation of the JDK 6.0, Oracle Client on this server before installing Oracle BI EE (Oracle Database is installed on the different server). The Oracle BI EE insta