Case statement with several ATHENS

Try to see if the following is possible:

-Case when regexp_like (code1, ' 123') or code1 = "456"

then "Category1".

Where regexp_like (code1, ' 123')

then "Category2".

Another null

end category

Then, of course, that no record being updated with the title of Category2 as criteria code1 already was met.

I am trying to create 2 files for each instance of regexp_like (code1, ' 123').  One record with "Category1" and one with "Category2".

Thank you

I thought that too, but for this:

I am trying to create 2 files for each instance of regexp_like (code1, ' 123')

Looks like a job for the union of all the...

Tags: Database

Similar Questions

  • Case statement with a select & date in

    Hello everyone,

    This is my first discussion, so please bare with me.

    I am trying to write a case statement with a select statement that compares the dates.

    When I write an instruction box with a select statement in it compares everything but dates it works fine.  Once the date is there, he collapses.

    Here is a super simple example of what I'm trying to do, "b.in_serv_dt" is a date

    Select unit_no,

    case when ((sélectionnez b.in_serv_dt de b unit_dept_comp_main où a.unit_id = b.unit_id et b.in_serv_dt) > = 1 January 2012 "") then "everybody wins."

    When ((sélectionnez b.in_serv_dt dans l'unit_dept_comp_main b où a.unit_id = b.unit_id et b.in_serv_dt) < = 1 January 2012 "") then "Nobody wins".

    end

    of ottawa_unitmain_v one

    Any help would be greatly appreciated

    Thank you very much

    Hello

    your statement of formatting:

    Select unit_no
    case when ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    and b.in_serv_dt
    ") > = JANUARY 1, 2012"
    ) and then "everybody wins."
    When ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    and b.in_serv_dt
    )<=>
    ) and then "no winner".
    end
    of ottawa_unitmain_v one

    I see "partial conditions": <... and="" b.in_serv_dt="">> that have no meaning.
    I guess it's a kind of "typo" and I ignore them.
    If the statement is:
    Select unit_no
    case when ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    ") > = JANUARY 1, 2012"
    ) and then "everybody wins."
    When ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    )<=>
    ) and then "no winner".
    end
    of ottawa_unitmain_v one

    I guess that the "b select" retrieve one line, through the design of database (forced...)

    As already written: be careful with data types: avoid "implicit conversions" (when you compare different data types, Oracle has convert the data type of the other side, a side example: "mystring = mynumber" is transformed into 'TO_NUMBER (mystring) = mynumber', or 'mydate = mystring' translates mydate = TO_DATE (mystring, ) ")
    Even better: use explicit conversions, use explicit formats when necessary.
    Best: use no conversion on columns from the constants, but use the correct data type for the constant.

    With this in mind:
    Select unit_no
    case when ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    ) > DATE = ' 2012-01-01'
    ) and then "everybody wins."
    When ((select b.in_serv_dt
    of unit_dept_comp_main b
    where a.unit_id = b.unit_id
    )<= date="">
    ) and then "no winner".
    end
    of ottawa_unitmain_v one
    But note that b.in_serv_dt EQUAL to 1 January 2012 (at 00:00:00) is OK for both WHEN the conditions; then the a "win."

    Now: the subselect statement is identical in the 2 options of the case... You could work differently: (I add the "ELSE" in case one line as NULL in_serv_dt;) I guess that an INNER JOIN is OK, maybe you need a LEFT OUTER JOIN (if some lines of A have no corresponding row in B)

    SELECT a.unit_no
    , CASE WHEN b.in_serv_dt > = DATE '' 2012-01-01
    THEN "everyone wins"
    WHEN b.in_serv_dt< date="">
    While "Nobody wins".
    ELSE ' who knows... ". »
    END who_wins
    Of ottawa_unitmain_v one
    INNER JOIN unit_dept_comp_main b
    ON a.unit_id = b.unit_id
    ;

    Best regards

    Bruno Vroman

  • Case statements with AND

    Hi all.

    I use a case statement to represent the values for different regions in a command prompt. I'm having some difficulties, with the values in the case statement. Here is an example of a simplified and shortened my code version.

    CASE

    WHEN 'Region '. "" Region name "="A"THEN"AMERICA ".

    WHEN 'Region '. "" Region name "= 'B' THEN 'CHINA '.

    WHEN 'Region '. "" Region name "= 'C' THEN 'EUROPE '.

    WHEN 'Region '. "' Name of the region ' = 'A' AND 'B' AND 'C' THEN 'GLOBAL '.

    END

    My error when I use it in my statement. The formula is accepted, however, all the values are displayed in my guest except 'GLOBAL '.

    How can I be able to assign a "GLOBAL"value in my guest? ".

    Jagadekara I think that you do not get the point. Any given row retrieved from a data source cannot have all three at one point values!

    AJ was trying to tell you, is that your CASE logic has no sense at all.

  • Help in the CASE statement with amount

    Hello Experts

    I amw Group on

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options

    I'm unable to solve this Case statement.

    My requirement is that if the value of the attribute is greater than 50, then add 1 to the sum for attribute 4 the sum should be 4


    WITH T AS
    (
    Select MATH_CONV_SCR 70, 68 MATH_PERC, writ_conv_scr 66, 67 writ_per Union double all the
    Select MATH_CONV_SCR 70, MATH_PERC 48, writ_conv_scr 66, 67 writ_per Union double all the
    Select MATH_CONV_SCR 70, 68 MATH_PERC, writ_conv_scr 66, 67 double writ_per
    )
    (
    Select)
    CASE
    WHEN MATH_CONV_SCR > 50 THEN 1
    WHEN MATH_PERC > 50 THEN 1
    WHEN WRIT_CONV_SCR > 50 THEN 1
    WHEN WRIT_PER > 50 THEN 1
    TOTAL END)
    T
    )


    The expected answer is
    4
    3
    4
    for the respective folders


    Please give me the solution

    Thank you

    RB

    Hello

    Rb2000rb65 wrote:
    Hello Experts

    I amw Group on

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production...

    Thanks for posting the version and sample data; It is very useful.

    ... Select)
    CASE
    WHEN MATH_CONV_SCR > 50 THEN 1
    WHEN MATH_PERC > 50 THEN 1
    WHEN WRIT_CONV_SCR > 50 THEN 1
    WHEN WRIT_PER > 50 THEN 1
    TOTAL END)
    T

    Don't forget that the WHEN of a CASE expression clauses are mutually exclusive. If none of them are evaluated to TRUE, then all of the following are not even tried.

    )

    The expected answer is
    4
    3
    4
    for the respective folders

    Please give me the solution

    Here's one way:

    SELECT  CASE WHEN math_conv_scr > 50 THEN 1 ELSE 0 END
          + CASE WHEN math_perc      > 50 THEN 1 ELSE 0 END
          +     CASE WHEN writ_conv_scr > 50 THEN 1 ELSE 0 END
          + CASE WHEN writ_per      > 50 THEN 1 ELSE 0 END     AS total
    FROM       t;
    
  • Case statement with building xml

    Select
    () XMLType.GetClobVal
    XMLElement ("variable"
    XMLAttributes (vcInternationalDate?" as "type")
    XMLAgg (XMLElement ("item",
    CASE WHEN THE TEMPO IS NOT NULL THEN
    , XMLElement ("utc", TO_CHAR (TIME,' dd/MM/YYYY HH24:MI:SS)) END))
    , XMLElement ("timezone_offSet", ZONE SCHEDULE)
    )
    )
    )
    )
    like 'CREATIONDATE '.
    of twgenericosdb. TEST
    WHERE ID = 1

    The query above without the case statement producing the result to follow:

    < type variable = "vcInternationalDate [:]" >
    < item >
    < utc > 2009-12-20 15:00 < / utc >
    < timezone_offSet > 3600000 < / timezone_offSet >
    < / point >
    < / variable >

    I'm looking for is a way in the case where the time utc is null statement do not tag the utc, utc is NULL the query returns the following result

    < type variable = "vcInternationalDate [:]" >
    < item >
    < utc > < / utc >
    < timezone_offSet > 3600000 < / timezone_offSet >
    < / point >
    < / variable >

    I'm trying to use the instruction box to return utc of the tag in the case of the UTC is NULL, but I get the error ORA-00917: Missing comma.

    Can someone help me?


    Thank you very much.

    Try

    SELECT XMLTYPE.GetClobVal
              (XMLELEMENT
                    ("variable",
                     XMLAttributes('vcInternationalDate[]' AS "type"),
                     XMLAGG(XMLELEMENT("item",
                                       CASE
                                          WHEN TEMPO IS NOT NULL
                                          THEN XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS'))
                                       END),
                            XMLELEMENT("timezone_offSet", TIMEZONE)))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
     WHERE ID = 1
    

    You can replace the CASE with NVL2

    SELECT XMLTYPE.GetClobVal
              (XMLELEMENT("variable",
                          XMLAttributes('vcInternationalDate[]' AS "type"),
                          XMLAGG(XMLELEMENT("item",
                                            NVL2(TEMPO,
                                                 XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS')),
                                                 NULL),
                                            XMLELEMENT("timezone_offSet", TIMEZONE))))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
     WHERE ID = 1
    

    URS

    Edited by: metzguar the 06.05.2010 15:04

  • Merger of statement: with several Update statement.

    Hello

    I'm trying under the merge statement. However to get the error "not correctly completed 0ra-00933 sql command.

    In fact, my join conditions are the same, but I wanted to update the different columns based on the different places where clause in the update statement.

    for example.

    FUSION
    IN abc3 tgt
    With the HELP of abc CBC
    WE (src.cust = tgt.cust)
    WHEN MATCHED
    THEN
    UPDATE
    SET tgt.sales = src.sales
    where tgt.cust = 'Cust3'
    UPDATE
    SET tgt.sales1 = src.sales
    where tgt.cust = 'Cust2';

    Please let me know if there is no work around for this.

    Hi, pm

    You can try this please.

    MERGE
     INTO ABC3 TGT
     USING ABC SRC
      ON (src.cust = tgt.cust)
    WHEN MATCHED THEN
    UPDATE SET TGT.SALES = DECODE(TGT.CUST,'Cust3',SRC.SALES,TGT.SALES),
               TGT.SALES1 = DECODE(TGT.CUST,'Cust2',SRC.SALES,TGT.SALES1)
    WHERE TGT.CUST='Cust3' OR tgt.cust='Cust2';
    
  • Case statement with endorsement instr

    Hi here is my code:
    Update table_1
    
    SET Financial_Review = ( case when instr(Judgement||Liquidation||under_admin,'Y') > 0 then  'Y' else 'N' end)
    This works perfectly. I now need to add another factor Debt_Review. The option is Debt_Review 0 or 1, where 1 means Y and 0 implies N.

    I essentially seeks to Debt_review in the update above statement. If the judgment or Liquidation or under_admin Y or Debt_Review is 1 then Financial_Review = O n else.

    Thanks in advance!

    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Hello

    Use this...

    UPDATE table_1
       SET financial_review =
              (CASE
                  WHEN (   INSTR (judgement || liquidation || under_admin, 'Y') >
                                                                                 0
                        OR debt_review = 1
                       )
                     THEN 'Y'
                  ELSE 'N'
               END
              );
    

    I hope this helps...

    Thank you
    Prakash P

  • A CASE statement with additional where clause

    Hi all

    I need assistance in which this obligation clause

    Table:-balance_table

    Columns:-balance_type, balance_amount, balance_month, budget_name

    balance_type column had given 'Real' OR 'Budget '.

    Now I am trying to extract data such as: if: entered_month is Mar-2009 then before and including Mar-2009 will show real balance sheet Date and after Mar-2009 will show budget data.

    It works fine, I need to add a condition more restrict the budget name, there are several budget_name in the table for balance_type = 'Budget '.



    SELECT SUM (balance_amount), balance_type, balance_month
    OF balance_table
    WHERE balance_type =
    (CASE
    WHEN balance_month < =: entered_month
    THEN 'real '.
    ANOTHER 'Budget '.
    END
    )
    AND budget_name = 'BUDGET1.
    Balance_type GROUP, balance_month

    Stated above is erroneous because ' AND budget_name = ' BUDGET1 "clause restricts the set of data."

    Please help in contrcuting where clause 1) to sort the data according to Budget/actual and 2) for specific budgets, so budget_type = Budget

    Thank you
    Bobin

    That should do it.

    SELECT SUM (balance_amount),
           balance_type,
           balance_month
    FROM balance_table
    WHERE (balance_type = 'Actual'
           and balance_month <= :entered_month
          )
    or (balance_type = 'Budget'
        and balance_month > :entered_month
        and budget_name = :entered_budget_name
       )
    GROUP BY balance_type,
             balance_month
    ORDER BY 2
    

    See you soon
    Sarma.

  • Case statement with multiple queries to the THEN clause

    Y at - it a syntax something like:

    Case

    When A = 1
    Then B: = 2 and C: = 3

    When A = 2
    Then B: = 4 and C: = 5

    Else B: = 6 and C: = 7

    End case;

    where clause can then have multiple assignments?

    Also, how to mark entries as code on this forum?

    TIA,

    Extreme Farley

    You can simplify a bit:

    SQL> declare
      2     a number := 0;
      3     b number := 0;
      4     c number := 0;
      5  begin
      6
      7     Case A
      8          WHEN 1 Then
      9            B := 2;
     10            C := 3;
     11          WHEN 2 Then
     12            B := 4;
     13            C := 5;
     14          Else
     15            B := 6;
     16            C := 7;
     17     End Case;
     18     dbms_output.put_line('A=' || a);
     19     dbms_output.put_line('B=' || b);
     20     dbms_output.put_line('C=' || c);
     21  end;
     22  /
    A=0
    B=6
    C=7
    
    PL/SQL procedure successfully completed.
    
  • Case mix with Nested ifs statement

    Hello I need to mix a case statement with a few nested ifs, but I get an error I do not know how to start or complete the case statement. I've shortened the statement FOR readability

    Here is the code:

    < tt >

    BEGIN

    FOR events IN (SELECT EBA_CA_EVENTS. EVENT_NAME, EBA_CA_EVENTS. EVENT_ID,...)

    LOOP

    If the events. TYPE_ID <>(32230291965131516245569156552736940921) AND to_date (SYSDATE) = ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT1)

    THEN

    Dbms_output.put_line ('adjustments of the SEND E-MAIL Alert 1 "criteria);

    on the other

    If the events. TYPE_ID = (32230291965131516245569156552736940921) and nvl(events.COMPLETED_MAIL_SENT,0) <>room ')

    THEN

    Dbms_output.put_line ('SEND EMAIL FILLED WITH TERRY');

    UPDATE EBA_CA_EVENTS set COMPLETED_MAIL_SENT = piece ') where ROW_KEY = events. ROW_KEY;

    on the other

    If the events. TYPE_ID <>(32230291965131516245569156552736940921) AND to_date (SYSDATE) = ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT2)

    THEN

    Dbms_output.put_line (' fits the criteria 2nd SEND E-MAIL alert 2 "");

    on the other

    If the events. TYPE_ID <>(32230291965131516245569156552736940921) AND to_date (SYSDATE) = ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT3)

    THEN

    Dbms_output.put_line ('fits the 3rd criteria SENDING E-MAIL Alert 3 ");

    end if; -4

    end if; -3

    end if; -2

    end if; -1

    CASE

    Events WHEN. EVENT_NOT2 is null

    THEN

    If to_date (SYSDATE) > ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT1) AND nvl (events. ALERT1_SENT, 0) part <>')

    THEN

    Dbms_output.put_line ('send e-mail if day part 1');

    UPDATE EBA_CA_EVENTS set ALERT1_SENT = piece ') where ROW_KEY = events. ROW_KEY;

    end if;

    END

    other cases

    Events WHEN. EVENT_NOT2 is NOT NULL

    THEN

    If to_date (SYSDATE) > ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT1) AND nvl (events. ALERT1_SENT, 0) part <>') AND to_date (SYSDATE) < ((to_date (to_char (events. ((EVENT_DUE_DATE, "DD-MON-YYYY HH24:MI:SS"), "HH24:MI:SS MON-DD-YYYY"))-events. EVENT_NOT2)

    THEN

    Dbms_output.put_line ('If day spent game 2 with the value');

    UPDATE EBA_CA_EVENTS set ALERT1_SENT = piece ') where ROW_KEY = events. ROW_KEY;

    end if;

    END

    END LOOP;

    END

    < /tt >

    The error occurs towards the end of the case statement-case.PNG

    I also tried this the 'else' deletion before the case and a few other variations, I can't just not perfect the code however, any help would be appreciated, thanks

    BTW, I can't use IF... Logical I already tried, then once a particular branch occurs then the else statements are ignored.

    You had an extra 'END' where he shouldn't have been and were not an 'END' where TI EXPECTED have been.

    This is your modified code (I had to fill out the... that my trainer Toad worked properly)

    BEGIN
    
       FOR EVENTS IN (
                      SELECT eba_ca_events.event_name, eba_ca_events.event_id
                        FROM 
                     ) LOOP
    
          IF(
             EVENTS.type_id <> (32230291965131516245569156552736940921)
             AND
             TO_DATE(SYSDATE) = ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS') - EVENTS.event_not1))
            ) THEN
    
             DBMS_OUTPUT.PUT_LINE('Criteria fits SEND EMAIL Alert 1');
    
          ELSE
    
             IF(
                EVENTS.type_id = (32230291965131516245569156552736940921)
                AND
                NVL(EVENTS.completed_mail_sent, 0) <> ('S')
               )
                 THEN
    
                DBMS_OUTPUT.PUT_LINE('SEND COMPLETED EMAIL TO TERRY');
    
                UPDATE eba_ca_events
                   SET completed_mail_sent = ('S')
                 WHERE row_key = EVENTS.row_key;
    
             ELSE
    
                IF(
                   EVENTS.type_id <> (32230291965131516245569156552736940921)
                    AND
                    TO_DATE(SYSDATE) = ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS')) - EVENTS.event_not2)
                  ) THEN
    
                   DBMS_OUTPUT.PUT_LINE('2nd Criteria fits SEND EMAIL Alert 2');
    
                ELSE
    
                   IF(
                      EVENTS.type_id <> (32230291965131516245569156552736940921)
                      AND
                      TO_DATE(SYSDATE) = ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS')) - EVENTS.event_not3)
                     ) THEN
    
                      DBMS_OUTPUT.PUT_LINE('3rd Criteria fits SEND EMAIL Alert 3');
    
                   END IF; -- 4
    
                END IF; -- 3
    
             END IF; -- 2
    
          END IF; -- 1
    
          CASE
    
             WHEN EVENTS.event_not2 IS NULL THEN
    
                IF(
                   TO_DATE(SYSDATE) > ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS')) - EVENTS.event_not1)
                   AND
                   NVL(EVENTS.alert1_sent, 0) <> ('S')
                  ) THEN
    
                   DBMS_OUTPUT.PUT_LINE(' send email if date past part 1');
    
                   UPDATE eba_ca_events
                      SET alert1_sent = ('S')
                    WHERE row_key = EVENTS.row_key;
    
                END IF;
    
             ELSE
    
                CASE
    
                   WHEN EVENTS.event_not2 IS NOT NULL THEN
    
                      IF(
                         TO_DATE(SYSDATE) > ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS')) - EVENTS.event_not1)
                         AND
                         NVL(EVENTS.alert1_sent, 0) <> ('S')
                         AND
                         TO_DATE(SYSDATE) < ((TO_DATE(TO_CHAR(EVENTS.event_due_date, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS')) - EVENTS.event_not2)
                        ) THEN
    
                         DBMS_OUTPUT.PUT_LINE('if date past part 2 with value');
    
                         UPDATE eba_ca_events
                            SET alert1_sent = ('S')
                          WHERE row_key = EVENTS.row_key;
    
                      END IF;
    
                END CASE;
    
          END CASE;
    
       END LOOP;
    
    END;
    

    I hope this helps.

  • 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

  • Excel and the CASE statement.

    Hello Experts,

    I use a CASE statement on the column of CHAR type as follows:

    CASE WHEN Sales.Ret = 'Y' THEN 'Return' END of OTHER 'new '.

    It gives an error: Odbc driver returned an error (SQLExecDirectW).

    Whereas, when I use another CASE statement with column Numrical it works perfectly.
    CASE WHEN Sales.Amount < END If NOT 100 40 THEN 40

    Am I missing an Excel data source definition related to the CHAR data type?

    My source is MS Excel 2003 and OBIEE 10.1.3.4.1

    Thank you for any comments, help.

    ~ Ash

    PS: the details of the error are the following:*.
    Error codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 16001] ODBC error state: 37000 code:-3100 message: error [Microsoft] [ODBC Excel Driver] syntax (missing operator) in query expression ' case when T46. [Retirement] = "Y" then "known" other "new" end "... [nQSError: 16014] Prepare the SQL statement failed. (HY000)
    Publ. SQL: SELECT Sales.Tran_date, saw_0, CASE WHEN Sales.Ret = 'Y' THEN 'Return' ELSE 'New' END saw_1, network. "" Network name "saw_2, Sales.Amount saw_3 FROM P4UD ORDER BY saw_0, saw_1, saw_2

    Sorry, the button is 'Ask DBMS' (biee 10g)

  • Closure of a state machine in queue event with several parallel loops

    I am trying to find the best way to stop a program that consists of an architecture of State machine in line waiting for event with several parallel loops. Can anyone recommend the best way to achieve this in my attached VI? (To browse the forum, this seems to be a frequently asked question, but I have not found a solution that works for me.)

    I look forward to any comments on my as well code, if someone is willing to offer it.

    My program needs:

    If the user press the 'Stop' button, the program should prompt the user with "are you sure you want to stop the program?" and then return to a State of rest or move forward to stop the program. In addition if there is an error, the program should prompt the user to ' clear the error and continue, or stop the program. Then back to the idle state or move forward to stop the program.

    Architectural details:

    The program consists of 3 parallel loops: (1) a loop of event management that places different States of a queue of the State, (2) a State Machine that enters the State that is removed from the queue of the State and (3) a loop error/Shutdown, which deals with errors in the error queue management.

    During normal shutdown, where running handling loop in the case of event 'Program.Shutdown' and 'Shutdown' and the 'Idle' States are added to the queue of the State. In the state machine, the State of 'Stop' is invoked. Special "5000" error code is added to the queue of the error. In the loop of error handling and stopping, "5000" error triggered a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the State of 'Stop' and 'Program.Shutdown' event case with notification 'Go '. If the user decides to stop, the Notifier sends the notification "Stop". Loop and event management State Machine ends when they receive the notification "Stop".

    In case of error, the program behaves in the same way: If the user chooses to clear the error and continue, the program returns to the status "pending".

    HOWEVER - if the user chooses to stop the program, the program crashes. The author of the notification that is sent to stop the loop of events and State Machine management cannot be read because event Program.Shutdown and the stop State (which contain the function "Waiting to notify") are not active.

    I was able to activate the stop State by Queuing in the loop of error/Shutdown management. But I don't know how to activate the "Program.Shutdown" event by program and thus access the function "Waiting to notify" inside.

    I tried to put the function "Waiting to notify" outside the structure of the event, so the event-handling loop never ends. Placing timeouts on the "wait for declaring" and the structure of the event makes the programme of work, but I want to avoid using timeouts because I don't want to turn my event program into a program of polling stations. I would also avoid using variables or nodes property to stop loops, because that requires the creation of a control/indicator for something that the user does not need to interact with.

    Thank you!

    First of all, close the notifier outside loops with your queues.  Second, you must use a user event to send the message to the event structure loop so that it stop in the case of the stop on an error.

  • Interrupted SQL statement and start several times with several SQL_EXEC_ID

    Hi all

    We meet a strange phenomenon, maybe someone can help.

    We see that sometimes, when our client runs a single statement, implemented Oracle to process the statement with a special SQL_EXEC_ID, but after a while stops and starts processing the statement along with different SQL_EXEC_ID. Then, after a while, it happens again - stop Oracle processes the statement and start from the beginning with the new SQL_EXEC_ID. This happens again and again until we kill all of the other sessions on the database (then it ends).

    What we see exactly: Client executes the statement (sql_id = "2tp7pz6yv87qp"). Monitor us v $ SQL_MONITOR and get this:

    SELECT Sql_id, sql_exec_id, to_char (SQL_EXEC_START, "HH24:MI:SS MON-DD-YYYY) SQL_EXEC_START, status OF V$ SQL_MONITOR where sql_id = '2tp7pz6yv87qp' ORDER BY SQL_EXEC_START DESC;

    2tp7pz6yv87qp 16777216 28 may 2015 07:19:14 the EXECUTION

    After a while check us again and see this:

    2tp7pz6yv87qp 16777217 28 may 2015 07:36:17 the EXECUTION

    2tp7pz6yv87qp 16777216 28 may 2015 07:19:14 FACT

    After a while, we see this:

    2tp7pz6yv87qp 16777219 28 may 2015 08:09:58 the EXECUTION

    2tp7pz6yv87qp 16777218 28 may 2015 07:53:37 FACT

    2tp7pz6yv87qp 16777217 28 may 2015 07:36:17 FACT

    2tp7pz6yv87qp 16777216 28 may 2015 07:19:14 FACT

    and so on — will happen again and again until we kill all of the other sessions in the database.

    When comparing the follow-up of the different SQL_EXEC_IDs SQL reports, we see that each of them did exactly the same job: used the same execution plan, beginning treatment she even read/wrote the same amount of e/s and each of them stopped at the same point during execution. You can see that for each SQL_EXEC_ID execution 'stops' in the middle and never reach the end of the plan. She always stops in the JOIN by HASH and never continue to the next steps in the implementation plan.

    When you look more deeply, we see in V$ ACTIVE_SESSION_HISTORY always last thing that happens for every SQL_EXEC_ID is HASH JOIN RIGHT OUTER (SQL_PLAN_OPERATION = HASH and SQL_PLAN_OPTIONS = RIGHT OUTER JOIN). Then comes the new SQL_EXEC_ID and it starts to do the same thing as the previous SQL_EXEC_ID did when it was launched.

    Kill all other sessions, run finally ends. We see that the final (successful) SQL_EXEC_ID work and completes his plan to run to completion.

    When executing the same single statement (when it comes to the single session in the database), it ends with a single SQL_EXEC_ID. Its SQL monitoring report looks like the final execution when the phenomenon occurs after killing all other sessions.

    -We checked that the customer executing the query only once. AWR also only shows simple execution of the query.

    -We have reproduced in many different clients (plus SQL, JDBC thin client OIC and DBMS_SCHEDULER job).

    -It has no PARALLEL in the query or table.

    -In this case for different statements (different INSERT-SELECT and MERGE instructions).

    -Version: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Does anyone have an idea?

    Finally found the root cause of the problem.

    This phenomenon occurs when the cursor of the active query being invalidated. This can occur in several scenarios, in our case, what happens when we work on a single partition (read or write) and perform DDL operations on different partitions of the same or the tables.

    Steps to reproduce:

    1 launch long command DML that affect the single partition

    2. in the course of executing this SQL, do one of the following values in a session different all 1 minute:

    2.1 do the indexes to a different partition unusable: ALTER TABLE X EDIT PARTITION Y UNUSABLE LOCAL INDEX

    2.2 rebuild the unusable index of different partition: ALTER TABLE X EDIT PARTITION Y REBUILD UNUSABLE LOCAL INDEX

    2.3 a partition different truncate

    Support of Oracle we were told that this problem is known and there are several requests for bugs and improvements thereon, for example this one:

    Bug 12905327 : TRUNCATE to an INVALID PARTITION TABLE UNNECESSARILY IMMEDIATELY all THE SLIDERS

    In our case (ETL process), we used to perform all these operations DDL and DML operations long (we work on different partitions in parallel). In order to solve, we have separated these operations to the different phases in our process and don't be DDL and DML operations at the same time more. This solved the problem for us.

  • Help with making SQL query references to column aliases in the Case statement

    I need help with a sql query that I'm trying. I can go about it the wrong way, but I would be grateful if I could get any suggestions on possible solutions. This is my query:


    SELECT DISTINCT spriden_pidm, spriden_id id, spriden_last_name | ',' | spriden_first_name name,

    CASE
    WHEN rcresar_comm_code_01 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_01
    WHEN rcresar_comm_code_02 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_02
    WHEN rcresar_comm_code_03 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_03
    WHEN rcresar_comm_code_04 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_04
    WHEN rcresar_comm_code_05 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_05
    WHEN rcresar_comm_code_06 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_06
    WHEN rcresar_comm_code_07 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_07
    WHEN rcresar_comm_code_08 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_08
    WHEN rcresar_comm_code_09 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_09
    WHEN rcresar_comm_code_10 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_10
    END acg_elig_comm_code

    CASE
    WHEN acg_elig_comm_code = ' 268' THEN 'rigorous HS course. "
    WHEN acg_elig_comm_code = '269' THEN ' 2 or several AP or IB"
    WHEN acg_elig_comm_code = '270' THEN 'NOC as possible ".
    END comm_code_description

    OF spriden, rcresar, rcrapp1

    WHERE (rcresar_comm_code_01 IN ('268 ', '269', ' 270')

    OR rcresar_comm_code_02 ('268 ', '269', ' 270')

    OR rcresar_comm_code_03 ('268 ', '269', ' 270')

    OR rcresar_comm_code_04 ('268 ', '269', ' 270')

    OR rcresar_comm_code_05 ('268 ', '269', ' 270')

    OR rcresar_comm_code_06 ('268 ', '269', ' 270')

    OR rcresar_comm_code_07 ('268 ', '269', ' 270')

    OR rcresar_comm_code_08 ('268 ', '269', ' 270')

    OR rcresar_comm_code_09 ('268 ', '269', ' 270')

    OR rcresar_comm_code_10 ('268 ', '269', ' 270'))


    Rcresar_aidy_code = & aidy_code

    AND rcrapp1_aidy_code = rcresar_aidy_code

    AND rcrapp1_curr_rec_ind = 'Y '.

    AND rcrapp1_seq_no = rcresar_seq_no


    AND spriden_pidm = rcresar_pidm

    AND rcrapp1_pidm = rcresar_pidm


    AND spriden_change_ind IS NULL

    ORDER BY name


    The second case statement is where I don't know exactly what it takes to get what I want.

    Output should be like:
    spriden_pidm name ID acg_elig_comm_code comm_code_description
    «0000000000', ' 1111111111 ","John Doe","268", «rigorous HS race"»

    If I take the second case statement it works great except that I do not have my comm_code description column. My question is how can I use my first statement value box to determine this column? I think that I need a case statement as I have, but I don't know how to reference the value of acg_elig_comm_code. Any help would be greatly appreciated. Thank you.

    Published by: blackhole82 on January 20, 2009 09:20

    Hello

    You cannot use the alias column in the query, even where it is set (except in the ORDER BY clause).
    You can set the alias in a subquery and then use it in a great query, like this:

    WITH  sub_q  AS
    (
        SELECT DISTINCT spriden_pidm,spriden_id id, spriden_last_name||', '||spriden_first_name name,
            CASE
                WHEN rcresar_comm_code_01 IN ('268','269','270') THEN rcresar_comm_code_01
                WHEN rcresar_comm_code_02 IN ('268','269','270') THEN rcresar_comm_code_02
                WHEN rcresar_comm_code_03 IN ('268','269','270') THEN rcresar_comm_code_03
                WHEN rcresar_comm_code_04 IN ('268','269','270') THEN rcresar_comm_code_04
                WHEN rcresar_comm_code_05 IN ('268','269','270') THEN rcresar_comm_code_05
                WHEN rcresar_comm_code_06 IN ('268','269','270') THEN rcresar_comm_code_06
                WHEN rcresar_comm_code_07 IN ('268','269','270') THEN rcresar_comm_code_07
                WHEN rcresar_comm_code_08 IN ('268','269','270') THEN rcresar_comm_code_08
                WHEN rcresar_comm_code_09 IN ('268','269','270') THEN rcresar_comm_code_09
                WHEN rcresar_comm_code_10 IN ('268','269','270') THEN rcresar_comm_code_10
            END acg_elig_comm_code   -- Originally posted with , here (error)
        FROM spriden, rcresar, rcrapp1
        WHERE (rcresar_comm_code_01 IN ('268','269','270')
                OR rcresar_comm_code_02 IN ('268','269','270')
                OR rcresar_comm_code_03 IN ('268','269','270')
                OR rcresar_comm_code_04 IN ('268','269','270')
                OR rcresar_comm_code_05 IN ('268','269','270')
                OR rcresar_comm_code_06 IN ('268','269','270')
                OR rcresar_comm_code_07 IN ('268','269','270')
                OR rcresar_comm_code_08 IN ('268','269','270')
                OR rcresar_comm_code_09 IN ('268','269','270')
                OR rcresar_comm_code_10 IN ('268','269','270'))
        AND rcresar_aidy_code = &aidy_code
        AND rcrapp1_aidy_code = rcresar_aidy_code
        AND rcrapp1_curr_rec_ind = 'Y'
        AND rcrapp1_seq_no = rcresar_seq_no
        AND spriden_pidm = rcresar_pidm
        AND rcrapp1_pidm = rcresar_pidm
        AND spriden_change_ind IS NULL
    )
    SELECT    sub_q.*,
              CASE
                  WHEN acg_elig_comm_code = '268' THEN 'Rigorous HS course'
                  WHEN acg_elig_comm_code = '269' THEN '2 or more AP or IB'
                  WHEN acg_elig_comm_code = '270' THEN 'ACG possible'
              END comm_code_description
    FROM      sub_q
    ORDER BY  name
    

    Furthermore, you might think to rearrange your table, so that you do not have 10 columns (rcresar_comm_code_01, rcresar_comm_code_02,...) that essentially do the same thing. The usual way to handle this kind of one-to-many relationship is to have all rcresar_comm_codes in a separate table, one per line, with a pointer to the table where you have them now.

    Published by: Frank Kulash, January 20, 2009 11:35
    Syntax error has been corrected

Maybe you are looking for

  • iMessage / SMS

    Nice day I can repeat a question that can arise before, please forgive. I am a newbie to apple products, I have a 6 s iPhone with the 9.3.1 version of IOS. My question would be, it is possible to manually select the service that you intend to send wh

  • call setup, load or unload the vi in memory

    Hi everyone, I need your help! I tried to call sub-vis in different ways: Sub1.VI call for installation - load with callers (normally) Sub2.VI call setup - refill for each call SUB3.VI call setup - load and keep on first convocation SUB4.VI call dyna

  • Where is the printer manual that was installed on my computer?

    Hello I downloaded the manual installation file of the user for my new Pixma MG5420 printer. The message says nine manuals were being installed but not where to find them or how to open them. I use a Windows PC. Thanks for any help. Bill

  • Polls BBM blackBerry Z10 sort chats?

    could someone help me to sort out the cats bbm by activity (without deleting)... the bbm chat still lowest in the window, even if I am active on what other

  • Order the crypto isakmp his poster 2 VPN

    Hi all! Why my router shows me 2 VPN? Is this normal? R1 #show crypto isakmp his IPv4 Crypto ISAKMP Security AssociationDST CBC conn-State id10.10.0.5 10.10.0.2 QM_IDLE 1870 ACTIVE10.10.0.2 10.10.0.5 QM_IDLE 1871 ACTIVE