Why is this game of case statements do not parallel execution?

I have the following Subvi:

I had a similar version which had specific cases for specific devices, but I wanted to make it more generic. I tested their work in parallel before the Subvi to GET all THE DATA is re-entrant I wonder if the merge errors feature prevents cases work properly. Maybe having the error returned to the Subvi on the top of the terminal will make a difference? Just try to understand what is happening.

RavensFan wrote:

James,

Why the constant true connected to the conditional tunnel?

I was simulating a Subvi, which has a Boolean result. He did not share his code so I don't have the Subvi himself.

I see now why OP does without a loop For, if there are more devices there carrots. The loop For could save code duplication to a minimum the number of cores.

Tags: NI Software

Similar Questions

  • Case statement is not spend.

    Hello

    I'm having a strange problem with a case statement.  I'm passing is a Boolean value that is set to false, but the case statement never switches to the loop of "false".  I have attached a word doc who did the screen has a step of this unique through being shot.  The photo of the top has the case highlighted with the probe #8 beside him indicate 'False. '  In the lower screen shot is the very next step that highlights the outside circle while ' loop', but the case statement is always 'True '.  Anyone seen this before?

    Gary Tyrna

    Hey Mello,

    Well, I see what you're saying and you are right, the problem is the case statement works when highlight of execution.  But I have a main case statement in the loop that either allows the state machine to execute a loop or hides them and that case is triggered for no steps to true or false.  So that was the reason why I sent the first e-mail because I could see this case change, but not the smallest.  But if this is the fix well I'll run with it and lets see case statement switch the highlight of the performance.

    Thanks again.

    Gary Tyrna

  • CASE STATEMENT DOES NOT HIERARCHY

    Hi Experts

    I have this case statement:

    BOX WHEN ' @{pvCalType} "="Cal1"THEN"Calendar Cal1"". "" Year. "

    WHEN ' @{pvCalType} "="Cal2"THEN"Calendar Cal2"". "" Year

    ANOTHER NULL

    END

    All the columns in the YEAR of different sizes have properties of the hierarchy.

    When I view my results of this statement, there is no hierarchy.

    I want the hierarchy in order to drill down of the YEAR > QUARTER > MONTHS

    Help, please.

    Hello

    do you have other possible values for "pvCalType"?

    If not try this formula: "@{pvCalType} schedule". " Year. "

    (not sure this is the right syntax, if it does not work after the return of the error and I get the right thing...)

  • Case statement does not work

    Dear all,

    We have the database oracle 11g r2 on windows.

    I created under function: -.

    SQL > CREATE OR REPLACE FUNCTION FUNC_TEST (P_TEST VARCHAR2)

    2 RETURN VARCHAR2

    3 AS

    4 V_TEST VARCHAR2 (20);

    5

    6 BEGIN

    7

    8 V_TEST: = P_TEST;

    9

    10

    11 CASES

    12. WHEN V_TEST = UPPER ('%UU%') THEN V_TEST: = REPLACE (V_TEST, 'UU', 'U');

    13. WHEN V_TEST = UPPER ('%OO%') THEN V_TEST: = REPLACE (V_TEST, 'OO', 'O');

    14. WHAT V_TEST = UPPER ('%NN%') THEN V_TEST: = REPLACE(V_TEST,'NN','N');

    15 ELSE V_TEST: = "CHANCHAL";

    END 16 CASES;

    17

    18

    19 V_TEST RETURN;

    20 EXCEPTION SO THAT OTHERS THEN

    21 DBMS_OUTPUT. PUT_LINE (' THERE IS AN ERROR ');

    22 END;

    23.

    The function is created.

    SQL > SHOW ERR

    No errors.

    SQL > SELECT FUNC_TEST('toon') FROM DUAL;

    FUNC_TEST ('TOON')

    --------------------------------------------------------------------------------

    CHANCHAL

    above function should show 'YOUR' build 'Toon' but its display "CHANCHAL";

    I train hard get the result OK but could not get it.

    Any suggestions would be very helpful.

    Kind regards
    Chanchal wankhade.

    Hello

    Chanchal Wankhade wrote:

    Dear all,

    We have the database oracle 11g r2 on windows.

    I created under function: -.

    SQL > CREATE OR REPLACE FUNCTION FUNC_TEST (P_TEST VARCHAR2)

    2 RETURN VARCHAR2

    3 AS

    4 V_TEST VARCHAR2 (20);

    5

    6 BEGIN

    7

    8 V_TEST: = P_TEST;

    9

    10

    11 CASES

    12. WHEN V_TEST = UPPER ('%UU%') THEN V_TEST: = REPLACE (V_TEST, 'UU', 'U');

    13. WHEN V_TEST = UPPER ('%OO%') THEN V_TEST: = REPLACE (V_TEST, 'OO', 'O');

    14. WHAT V_TEST = UPPER ('%NN%') THEN V_TEST: = REPLACE(V_TEST,'NN','N');

    15 ELSE V_TEST: = "CHANCHAL";

    END 16 CASES;

    17

    18

    19 V_TEST RETURN;

    20 EXCEPTION SO THAT OTHERS THEN

    21 DBMS_OUTPUT. PUT_LINE (' THERE IS AN ERROR ');

    22 END;

    23.

    The function is created.

    SQL > SHOW ERR

    No errors.

    SQL > SELECT FUNC_TEST('toon') FROM DUAL;

    FUNC_TEST ('TOON')

    --------------------------------------------------------------------------------

    CHANCHAL

    above function should show 'YOUR' build 'Toon' but its display "CHANCHAL";

    I train hard get the result OK but could not get it.

    Any suggestions would be very helpful.

    Kind regards
    Chanchal wankhade.

    I think you meant:

    CASE

    WHEN SUPERIOR (V_TEST) LIKE "% UU" THEN V_TEST: = REPLACE (UPPER (V_TEST), 'UU', 'U');

    WHEN SUPERIOR (V_TEST) LIKE '% OO %' THEN V_TEST: = REPLACE (UPPER (V_TEST), 'OO', 'O');

    ...

    '%' is a wildcard character only on the right-hand side of the LIKE operator. '%' has no particular meaning when you use the = operator.

    You can also use a CASE expression, rather than a CASE statement to this:

    v_test: = UPPER (p_test);

    v_test: = BOX

    WHEN v_test LIKE "% UU" THEN REPLACE (v_test, 'UU', 'U')

    WHEN v_test LIKE "% UU" THEN REPLACE (v_test, 'OO', 'o')

    ...

    END;

    Whatever it is, if v_test contains different models (for example "HOOVER VACUUM"), only 1 of them will be changed.  Is that what you want?

    If this isn't the case, after a few examples of data (CREATE TABLE and INSERT statements) and the results desired from these sample data.  Explain how you get these results from these data.

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • NOT IN clause in State of the CASE statement does not

    Dear friends,

    I want to use on the condition in the WHERE clause of my SELECT statement.

    WHERE <>...
    <>...
    AND eihf.exr_aip_asset_sid NOT IN
    (CASE when safa.fund_relation = 'C' and safa.fund_account_code! = vFundAccount)
    SO (37874,37909,43424,55040,59513,59598,58570,76148,75885,75927)
    ON THE OTHER
    (0)
    END
    )

    But it gives me an error like "missing of good parenthis."

    Help, please.

    Kind regards
    Jonathan

    You can not write a list of values within the case statement.

    try something like this,

     WHERE
    <------------->
       AND CASE WHEN safa.fund_relation = 'C' AND safa.fund_account_code != vFundAccount
             THEN eihf.exr_aip_asset_sid ELSE 1 END
           NOT IN (37874, 37909, 43424, 55040, 59513, 59598, 58570, 76148, 75885, 75927)
       AND CASE WHEN safa.fund_relation = 'C' AND safa.fund_account_code != vFundAccount
             THEN 1 ELSE eihf.exr_aip_asset_sid  END != 0;
    
  • Why this CASE statement would not work?

    If I use a CASE in my SELECT statement and met a strange thing and just need help to understand why he did it.

    When I type this, it does not work:

    CASE TRIM (Column1)
    WHEN NULL THEN Column2
    WHEN 'foo' THEN Column2
    Of ANOTHER Column1
    END AS NewColName

    I use this query in an Oracle procedure to insert data into another table. The data inserted in the column of NewColName end up being 4 empty spaces, located in Column1. In the logic of this, TRIM must remove all the empty spaces, and he should get mapped to the first statement WHEN, who must insert the value of Column2, but that does not occur. I tried the following versions of the first line as well:

    LTRIM (RTRIM (Column1)) CASE
    CASE of REPLACE (Column1, ' ', ")

    and they all produce the same result. I also tried to change WHEN NULL for WHEN " and it changed nothing. However, when I rewrite the statement in this way it works the way it should:

    CASE
    WHEN TRIM (Column1) IS NULL, Column2
    WHEN TRIM (Column1) = 'foo' THEN Column2
    Of ANOTHER Column1
    END AS NewColName

    In my mind, it seems that these two methods are trying the same thing, why we could work and the other not? Only, it has no sense to me.

    Thank you

    Hello

    Welcome to the forum.

    In your first statement, you have

    WHEN NULL THEN.

    This is the same as x = NULL.

    Nothing is never equal to NULL, if you find yourself in your ELSE clause.

    Concerning
    Peter

  • using nested case statement does not get the right result

    Hello all;

    I have a sample of data similar to below
    create table t3
    ( 
           id varchar2(200),
           qty number(30),
           qty2 number(30)
    ); 
     insert into t3
       (id, qty, qty2)
     values
       ('A', 10, null);
     
      insert into t3
       (id, qty, qty2)
     values
       ('A', 20, null);
       
     insert into t3
       (id, qty, qty2)
     values
       ('B', null, 5);
       
    insert into t3
       (id, qty, qty2)
     values
       ('B', null, 5);
       
     insert into t3
       (id, qty, qty2)
     values
       ('C', null, -5);
       
    insert into t3
       (id, qty, qty2)
     values
       ('C', null, 5);
    
    
     insert into t3
       (id, qty, qty2)
     values
       ('D', -1, -2);
       
    insert into t3
       (id, qty, qty2)
     values
       ('D', 1, 4);
    This is what looks like data
    ID  QTY  QTY2
    A    10
    A    20
    B              5
    B              5
    C             -5
    C              5
    D    1        4
    D   -1       -2
    It is the output that I desired below
    ID    Status 
    A      Fail
    B      Fail
    C      Pass
    D      Fail
    A is a failure because the sum of the 2 has the value zero, where the summation of the qty was used to determine the State and because the sum of the quantity is not equal to zero, then, it is a failure
    D is a failure because even if the sum of the Qty 1 equals zero, we must make use of summation of the qty 2 instead because he is not null to determine the status and the summation of the qty is 2, where a failure
    etc.

    I tried write something but can not make it work
    select case when sum(v.qty) is not null
                and sum(v.qty) = 0 then 'Pass'
                when sum(v.qty) is not null
                and sum(v.qty) != 0 then 'Fail'
           else
             case when sum(v.qty2) is not null
               and sum(v.qty2) = 0 then 'Pass'
               else
                when sum(v.qty2) is not null 
                  and sum(v.qty2) != 0 then 'Fail'
                  end as status
              end as status
    
    
     from t3 v;
    any help is appreciated. Thank you.

    Try this,

    SELECT ID,
           CASE WHEN NVL(SUM (qty2),1) !=0 THEN 'fail'
                WHEN NVL(SUM (qty),0) != 0 THEN 'fail'
                ELSE 'pass'
           END
      FROM t3
    GROUP BY ID
    
    OUTPUT
    -------------
    
    ID RESULT
    -- ------
    A  fail
    B  fail
    C  pass
    D  fail
    Z  fail
    

    G.

  • The function "save under" is blocked in Windows Media Player. Why is this and how do I get around it?

    Hello!

    I shot a few videos that I try to make changes to.

    First, in Windows Media Player, there are options to change the video as in video and equalizers settings charts.
    For the project that I'm working, I need to address mainly the saturation, brightness and contrast, which are the options that are available in Windows Media Player, but not in Windows Movie Maker.

    I tried to save the video after you make the necessary changes to skin Mode (Ctrl + 2), but I'm not allowed to do.
    The option "Save as" is blocked.

    Can anyone shed some light as to why this is the case?
    Are not my videos in the right format (they are currently in AVI format)?
    Help!

    Save it under applies only to images

  • Case statement for aging buckets

    OBIEE 11 g. I am trying to create a case statement with aging buckets. Tried in the frontend and the RPD, but on the first bucket made its appearance. (1-30 days old). The other 3 buckets do not appear.

    30 - 60 days old

    60 - 90 days old

    90 - 120 days old

    There are dates in the database who meet the criteria for the other 3 buckets. This is the case statement.

    
    

    use the below the formula instead of what you pasted...

    cases where "Date of creation". ' ' Created Date ' > = TIMESTAMPADD (SQL_TSI_DAY-30, CURRENT_DATE) then 1-30 days old '

    When "Date Created". " Created Date' <= timestampadd(sql_tsi_day,="" -30,="" current_date="" )="" and="" "created="" date"."created="" date"="">= TIMESTAMPADD (SQL_TSI_DAY,-60, CURRENT_DATE) then 30-60 days old '

    When "Date Created". " Created Date' <= timestampadd(sql_tsi_day,="" -60,="" current_date="" )="" and="" "created="" date"."created="" date"="">= TIMESTAMPADD (SQL_TSI_DAY,-90, CURRENT_DATE) then from 60 to 90 days old '

    When "Date Created". " "Created Date" <= timestampadd(sql_tsi_day,="" -90,="" current_date="" )="" and="" "created="" date"."created="" date"="">= TIMESTAMPADD (SQL_TSI_DAY,-120, CURRENT_DATE) then 90-120 days old ' end

    Thank you

    AJ

  • I have problem with value NULL when the use CASE statement please help this question

    I have problem with value NULL when the use CASE statement please help this question


    Table: digital_val

    SNO cl C2

    1 San1 11

    2 22 San2

    Actual result: expected to A         B

    A            B                                                                           11        22

    11 NULL

    22 NULL



    query:

    Select case when c1 = "san1" then c2,.

    case If c1 = "san2" then c2 B

    of digital_val

    I'm more curious why, when you select 2 rows, you expect a result of row?

    WITH digital_val

    AS (SELECT 1 AS 'Sno', 'San1"C1, c2 FROM DUAL 11)

    UNION ALL

    2 SELECT AS 'Sno', 'San2"C1, c2 FROM DUAL 22)

    SELECT CASE WHEN c1 is "San1" THEN END AS A c2.

    CASE WHEN c1 = "San2" THEN END AS B c2

    OF digital_val;

    With no other input, if you select 2 rows, you get 2 rows.  One of the other solutions use a max function, but is this really what you want, does not specify?

  • I'm editing in the bright room of Adobe and when I change in the develop module, I get the image I want, but when I see in the library module in its final State, it changed and degraded. Why is this happening?

    I'm editing in the bright room of Adobe and when I change in the develop module, I get the image I want, but when I see in the library module in its final State, it changed and degraded. Why is this happening?

    The difference between the raw edition photo and editing a PSD is that the PSD has black points and white pinned to the visible pixel values, the raw photo has still "headroom" with values of pixel darker than black visible and brighter than white, so when you export the raw file , there may be details that have improved (or obscured if it was another type of image) of the perception and mapping of the Compensation of the black spot on the final color profile.

    This means not PS is better or LR is lower, it is enough for you to go to a different type of image.  If you don't have PS to do final Assembly, you can probably do the same thing by exporting the raw in a 16 bit ProPhotoRGB TIF file, re-import this TIF and then set it LR, possibly using the tone curve to make the pitch black dark areas.

  • If I have floating values such as 6.3 6.7, 6.9, 7.1, 7.2, how can I write a case statement to handle this

    How can I write a case statement if I want a case for x< 1.5;  ="" a="" case="" for="" 1.5=""><= x=""><= 3.7; ="" case="" for ="" 3.7="">< x="">< 7.2.....etc.  ="" my="" input="" is="" a="" floating="">

    Thank you.

    You don't seem to have set rules on inclusion, but I often use the function in the range and Coerce in these cases.

  • Case statement in the process Page

    Request Express 3.2.1.00.11

    I put the following code in an anonymous block (will return no error) for a process Page;

    BEGIN
    INSERT
      INTO DAD_ASSESSMENT_REQUEST
    ( tenure_id
    , client_id
    )
    VALUES
    ( :P10101_TENURE_ID
    , :P10101_CLIENT_ID 
    );
    END;
    

    But when I put a statement case it throws the following error;

    1 error has occurred
    ORA-06550: line 7, column 3: PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification ORA-06550: line 3, column 1: PL/SQL: SQL Statement ignored
    

    BEGIN
    INSERT
      INTO DAD_ASSESSMENT_REQUEST
    ( tenure_id
    , client_id
    , (CASE 
       WHEN (:P10101_MEASURE_OPTION = 'AREA') THEN estimated_area_ha 
       WHEN (:P10101_MEASURE_OPTION = 'LINE') THEN estimated_length_km 
     END)
    )
    VALUES
    ( :P10101_TENURE_ID
    , :P10101_CLIENT_ID 
    , :P10101_X
    );
    END;
    

    Why is this code not work and it is possible to use a case statement in a Page Apex process

    Concerning

    Ben

    Benton says:

    Request Express 3.2.1.00.11

    I put the following code in an anonymous block (will return no error) for a process Page;

    1. BEGIN
    2. INSERT
    3. IN DAD_ASSESSMENT_REQUEST
    4. (tenure_id
    5. client_id
    6. )
    7. VALUES
    8. (: P10101_TENURE_ID)
    9. ,: P10101_CLIENT_ID
    10. );
    11. END;

    But when I put a statement case it throws the following error;

    1. 1 error has occurred
    2. ORA-06550: line 7, column 3: PL/SQL: ORA-01747: specification user.table.column, table.column or invalid column ORA-06550: line 3, column 1: PL/SQL: statement ignored
    1. BEGIN
    2. INSERT
    3. IN DAD_ASSESSMENT_REQUEST
    4. (tenure_id
    5. client_id
    6. (CASE
    7. WHEN (: P10101_MEASURE_OPTION = 'SPACE') THEN estimated_area_ha
    8. WHEN (: P10101_MEASURE_OPTION = 'LINE') THEN estimated_length_km
    9. END)
    10. )
    11. VALUES
    12. (: P10101_TENURE_ID)
    13. ,: P10101_CLIENT_ID
    14. ,: P10101_X
    15. );
    16. END;

    Why is this code not work and it is possible to use a case statement in a Page Apex process

    Of course, it is possible to use a CASE statement or expression (it is the latter) in a page APEX process. However, it is not possible to use an invalid syntax while doing so. Part of a clause INSERT INTO can contain only static column names.

    In general the SQL expressions (and also the bind variable, another cause frequent errors of syntax) can be used only in

    • the projections of the SELECT queries and subqueries
    • the right side of the disposals in the SET update clause
    • the lists of VALUES of INSERTs
    • WHERE clause predicates

    ReemaPuri wrote:

    Try this

    INSERT

    IN DAD_ASSESSMENT_REQUEST

    (tenure_id

    client_id

    estimated_area_ha

    estimated_length_km

    )

    VALUES

    (: P10101_TENURE_ID)

    ,: P10101_CLIENT_ID

    , (SELECT CASE WHEN: P10101_MEASURE_OPTION = 'SPACE' AND THEN: P10101_X)

    OTHERWISE, NULL END OF DOUBLE)

    , (SELECT CASE WHEN: P10101_MEASURE_OPTION = 'LINE' THEN: P10101_X)

    OTHERWISE, NULL END OF DOUBLE)

    );

    It's a good idea, but it can be simplified, eliminating unnecessary subqueries:

    insert into dad_assessment_request (
        tenure_id
      , client_id
      , estimated_area_ha
      , estimated_length_km)
    values (
        :p10101_tenure_id
      , :p10101_client_id
      , case
          when :p10101_measure_option = 'AREA' then :p10101_x
        end
      , case
          when :p10101_measure_option = 'LINE' then :p10101_x
        end);
    
  • Case statement in where clause

    Hello

    I have to write the following query using the value of the l_var variable in the case statement

    How do I get there?


    Select col3

    of the test

    where col1 = "A".

    and the case

    When l_var = "Y' and col2 = 'B '.

    When l_var = 'n' and col2 = 'C '.

    end;

    In your expression

    case

    When l_var = 'Y' and col2 = 'B '.

    When l_var = ' only then col2 <> 'B '.

    end;

    you try to return a Boolean (True or False) value like 'then' value of the CASE statement.

    Values Boolean are not an Oracle SQL data type, you cannot use the true/false result of col2 = 'B' as an expression. This is why it does not work.

    It's even more simple as:

    Select col3

    of the test

    where col1 = "A".

    and ((l_var = «Y» et col2 = «B») or (l_var = ' no and col2 <> 'B'))

    If you really want a CASE statement then:

    Select col3

    of the test

    where col1 = "A".

    and the CASE WHEN l_var = 'Y', THEN CASE WHEN col2 = 'B', 1 ELSE 0 END

    WHEN l_var = ' no CASE THEN WHEN col2 <> 'B', 1 ELSE 0 END

    END = 1

  • [8i] Case statement generates ORA-00932: inconsistent data types

    Note: I work with a 8i database (Yes, he's old enough) and in this case, I have to deal with the types of data (e.g. TANK), I gives me to work with.

    I am trying to calculate the amount of time product expected between manufacturing steps. As I found out though, sometimes I get a negative value then subtract the date the previous step ends the date of that ongoing stage begins. Since it is generally impossible to start a later stage before a previous step (imagine trying to screw a cap on a bottle that has no son Cup yet - it just may not happen), what I found is that sometimes two steps are started the same day and finished the same day (although not necessarily the day they started). This situation CAN occur when a person is two steps and connected to two steps at the same time, rather than log on to one, then the other. So what I need to do in these situations, is to replace the negative number by zero (I'll treat the stage as having no time-out).

    Some examples of data:
    (Note: the data set real is the result of a query and has about 200 K lines and columns more, but this should be representative enough to find a solution that works on my real application.)
    CREATE TABLE     steps
    (     item_id          CHAR(25)
    ,     ord_nbr          CHAR(10)
    ,     sub_nbr          CHAR(3)
    ,     step_nbr     CHAR(4)
    ,     start_date     DATE
    ,     finish_date     DATE
    );
    
    INSERT INTO steps
    VALUES ('A','0000000001','001','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','001','0020',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','001','0030',TO_DATE('01/05/2011','mm/dd/yyyy'),TO_DATE('01/06/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0020',TO_DATE('01/04/2011','mm/dd/yyyy'),TO_DATE('01/04/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0030',TO_DATE('01/06/2011','mm/dd/yyyy'),TO_DATE('01/07/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('B','0000000002','001','0005',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('B','0000000002','001','0025',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
    Here's the query I use that sometimes returns negative values:
    SELECT     item_id
    ,     ord_nbr
    ,     sub_nbr
    ,     step_nbr
    ,     start_date - last_step_finished
    FROM     (
         SELECT     s.*
         ,     LAG (s.finish_date)     OVER     (
                                  PARTITION BY     s.item_id
                                  ,          s.ord_nbr
                                  ,          s.sub_nbr
                                  ORDER BY     s.step_nbr
                                  )     AS last_step_finished
         FROM     steps s
         );
    
    Returns:
    
    ITEM_ID                   ORD_NBR    SUB STEP START_DATE-LAST_STEP_FINISHED
    ------------------------- ---------- --- ---- -----------------------------
    A                         0000000001 001 0010
    A                         0000000001 001 0020                        -1.000
    A                         0000000001 001 0030                         3.000
    A                         0000000001 002 0010
    A                         0000000001 002 0020                         2.000
    A                         0000000001 002 0030                         2.000
    B                         0000000002 001 0005
    B                         0000000002 001 0025                        -2.000
    These are the results I want to see:
    ITEM_ID                   ORD_NBR    SUB STEP START_DATE-LAST_STEP_FINISHED
    ------------------------- ---------- --- ---- -----------------------------
    A                         0000000001 001 0010
    A                         0000000001 001 0020                         0.000
    A                         0000000001 001 0030                         3.000
    A                         0000000001 002 0010
    A                         0000000001 002 0020                         2.000
    A                         0000000001 002 0030                         2.000
    B                         0000000002 001 0005
    B                         0000000002 001 0025                         0.000
    And that's what I tried to do to get these results (comment pointed out which line has generated the error):
    SELECT     item_id
    ,     ord_nbr
    ,     sub_nbr
    ,     step_nbr
    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     0
              ELSE     start_dt - last_step_finished  -- THIS LINE GENERATES THE ORA-00932 ERROR
         END                         AS days_in_queue
    FROM     (
         SELECT     s.*
         ,     LAG (s.finish_date)     OVER     ( PARTITION BY  s.item_id
                                    ,          s.ord_nbr
                                    ,          s.sub_nbr
                                    ORDER BY     s.step_nbr
                                  )     AS last_step_finished
         FROM     steps s
         );
    I know that I had errors in data type incompatible before with case statements in this particular 8i database, but I can't seem to understand why I'm getting one this time. I think it has something to do with the NULL value which may occur for last_step_finished. Also, if I change the case statement to:
    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     NULL
              ELSE     start_dt - last_step_finished  -- THIS LINE GENERATES THE ORA-00932 ERROR
         END     
    the query works fine. But, I'm not NULL, I 0. In the level of this request, I'll take the averages by item_id/step_nbr, and I want that 0 s to be included in the average. (NULL values, as far as I know, would be excluded. AVG(null,_1,_2) = AVG (1,2) = 1.5 NOT AVG (0,1,2) = 1).

    Thanks in advance!

    CASE requires that all expressions to be of the same type. Numeric data type code is 2, then that date produced different internal datatype 14:

    SQL> select dump(1) a,dump(sysdate) b,dump(sysdate - (sysdate - 1)) c from dual;
    
    A                  B                                   C
    ------------------ ----------------------------------- ------------------------------
    Typ=2 Len=2: 193,2 Typ=13 Len=8: 219,7,6,27,13,7,50,0  Typ=14 Len=8: 1,0,0,0,0,0,0,0
    
    SQL> 
    

    Case is supposed to process until the number, but it does not--a bug in some versions. Use explicit to_number:

    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     0
              ELSE     to_number(start_dt - last_step_finished)
         END                         AS days_in_queue
    

    SY.

Maybe you are looking for

  • get rid of https?

    Come back service Bureau and now each session of travel slowed down considerably by https, which I had not requested, understand or necessarily desire. I want to get rid of him. I tried to do something as suggested in line without result. I'm not tec

  • Identification of the browser blocking &amp; PC

    A Web site with the forums knows I'm registered, so the registration page does not appear (only sign in page). How can I prevent the site from the identification of my browser/PC? Thanks for any help!

  • G7-1365dx: g7-1365dx sm bus controller driver

    Just redid my g7-1365dx and I can't find the "sm bus controller driver" I found an old article here but the links are not good. At all other drivers except this one. Windows 7 Home premium 64-bit.  I went to the AMD website, and let it do a scan and

  • Pavilion dv7 6b56nr

    Hello world. This is my first post and I have a big problem, and I think that's mostly my fault. A month ago, my.computer crashed and I was able to recover from the partitioned upward. This week, it happened again and I couldn't recover. I ordered th

  • Can I make a copy on my computer a little bigger, who can tell me?

    I have problems to read the computer screen and would like to be able to do the inscription: a little larger, is - it possible at all? from {deleted}