How to use CASE stmt in Where clause

Hi,
How to use CASE stmt in WHERE clause?. I need the code. Please send me as early as possible..........

Hi,
1004977 wrote:
Hi,
How to use CASE stmt in WHERE clause?. There's no difference between how a CASE expression is used in a WHERE clause, and how it is used in any other clause. CASE ... END always returns a single scalar value, and it can be used almost anywere a single scalar expression (such as a column, a literal, a single-row function, a + operation, ...) can be used.
CASE expressions aren't needed in WHERE clauses very much. The reason CASE expressions are so useful is that they allow you to do IF-THEN-ELSE logic anywhere in SQL. The WHERE clause already allows you to do IF-THEN-ELSE logic, usually in a more convenient way.
I need the code.So do the peple who want t help you. Post a query where you'd like to use a CASE expression in the WHERE clause. Post CREATE TABLE and INSERT statements for any tables used unless they are commonly available, such as scott.emp). Also, post the results you want from that sample data, and explain how you get those resuts from that data.
See the forum FAQ {message:id=9360002}
Please send me as early as possible..........As mentioned bfore, that's rude. It's also self-defeating. Nobody will refuse to help you because you don't appear pushy enough, but some people will refuse to help you if you appear too pushy.

Similar Messages

  • How to use case function in where clause

    Hi,
    Suppose a table DEMO has columns
    DEMO TABLE
    user_id
    user_name
    location
    In this table i have 15 users. but out of 15 users i want to use only 5 users for passing as user_name.
    then how to achieve the result
    1. when i pass the particular 5 user_name in where clause then i should get all the user_name and for other 10 users it will show only the passing user_name.
    how to use case function

    Do you mean this ?
    SQL> var name varchar2(10)
    SQL> exec :name := 'ALLEN'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'SMITH'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'BLAKE'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    BLAKERgds.

  • How to use Alias Columns in WHERE CLAUSE

    Hi ,
    I have a query where in there are 2 alias columns, start_date and end_date where in i need to use them in my WHERE clause as start_date < end_date. Please let me know if this is possible. please see the bwlow query
    SELECT (GREATEST (MIN (a.start_date_active),
    MIN (b.start_date_active),
    MIN (c.start_date_active),
    d.start_date_active ) start_date ,
    LEAST (MAX (NVL (a.end_date_active, b.end_date_active)),
    MAX (c.end_date_active),
    MAX (b.end_date_active),
    NVL (d.end_date_active,'31-DEC-2099')) end_date,
    c.terr_id,
    a.source_number,
    e.resource_id mgr_resource_id,
    d.role_relate_id role_relate_id
    ,g.resource_id
    FROM table1 a,
    table5 e,
    table4 d,
    table6 f,
    table7 g,
    table8 h ,
    table2 b,
    table3 c,
    table9 i
    WHERE 1=1
    AND b.resource_id = g.resource_id
    AND c.terr_id = b.terr_id
    AND to_number (c.attribute3) = i.party_id
    AND a.source_number = UPPER (e.salesrep_number)
    AND d.role_resource_type = 'RS_INDIVIDUAL'
    AND e.resource_id = d.role_resource_id
    AND d.role_id = f.role_id
    AND (a.start_date_active <= b.end_date_active
    AND (NVL (a.end_date_active, b.end_date_active) >= b.start_date_active))
    AND h.resource_id = a.resource_id
    AND UPPER (g.salesrep_number) = h.source_number
    GROUP BY a.source_number, c.terr_id, e.resource_id,d.start_date_active,d.end_date_active,d.role_relate_id,g.resource_id
    Thanks,
    Lakshmi

    I did not understand your query but have you tried using the HAVING clause?
    HAVING clause allows you to use a "where" like condition for your groupings.
    See http://www.techonthenet.com/sql/having.php for some examples.
    Sandeep Gandhi

  • How to use alias name in where clause

    Hello,
    DECODE (item.inv_type,'OT', (DECODE (item.attribute2, 'STONE', 0, xfer.release_quantity1 * xfer.attribute10)
    'FG', (xfer.release_quantity1 * xfer.attribute10)
    ) matl_val
    In the above code matl_val is alias name i need to use that one in where clause as
    where matl_val > 0
    is this possible or anyother way can anyone help me.

    But the point is as you haven't read the documentation you may miss some valuable points about alias and will soon end with another problem.
    >
    Specify an alias for the column expression. Oracle Database will use this alias in the column heading of the result set. The AS keyword is optional. The alias effectively renames the select list item for the duration of the query. The alias can be used in the order_by_clause but not other clauses in the query.
    >
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702

  • How to use between timestamp in where clause

    Hi All,
    i have a colum column2 of data type timestamp.now i wants to fatch record having between two date of column2.how to use between operator in where condition having column as timespamp'

    Hi,
    You can use a timestamp literal, or use a function that return a timestamp datatype, here is an example:
    (TIMESTAMP 'YYYY-MM-DD HH24:MI:SS.FF')
    select * from yourtable where column2 between TIMESTAMP '1997-01-31 09:26:50.12' and  systimestampHave a look to the documentation, for example http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch4datetime.htm

  • Using :case when  in where clause

    Hello,
    I need some help with using of case statement in a where clause
    Table that contains info about employees taking some coursework:
    Class (values could be SAP, ORACLE, JAVA)
    Code (if Class is SAP then CODE is not null; if class is any other CODE is NULL)
    Start Date (date they began class not null)
    End Date (date then ended the class - could be null)
    Employee Level(numbers from one through five)
    I need a single LOV in forms that should show Employee_Level for input class,code,date.
    How to do this?
    I started off with this but get 'missing statement error'
    select distinct employee_level from e_course
       where (
       case when &class='SAP' then code ='1' and start_date > to_date('20000101','YYYYMMDD') and
                                               end_date < to_date('20000101','YYYYMMDD')
               else
                   null
       end) order by employee_level;Thanks

    Hi,
    user469956 wrote:
    But all these examples have only one condition for each case.Depending on how you count, all WHERE clauses have only one condition.
    I see an example in that thread that has 6 atomic conditions, linked by AND and OR.
    I need to check date & code. This is what is causing the error.Why do you want to use a CASE statement?
    Why can't you put all your conditions directly iinto a WHERE clause, soemthing like this:
    WHERE   (   &class='SAP'
            AND code ='1'
    OR      (   start_date  > to_date('20000101','YYYYMMDD')
            AND end_date    < to_date('20000101','YYYYMMDD')
            )I said "something like this" because I don't know what you really want to do.

  • No output for XML Publisher Report using CASE/DECODE in Where Clause

    Hi,
    I've a business requirement to modify an existing report which has two input parameters,
    -> p_statcode (Closed Status) which can have values 'Y' or 'N'
    -> p_overdue (Overdue Flag) which can have values 'Y' or 'N'
    The Overdue Flag is an evaluated column having values of Y/N and it is evaluated as follows,
    ONTF_MOD_VAL(NVL (
                                         (TRUNC (SYSDATE)
                                          - (TO_DATE (oe_order_lines.attribute18,
                                                      'DD-MON-RRRR')
                                             + TO_NUMBER (fnd_lookup_values.meaning))),
                                         0
                            overdue_flagThe user requirement now is they needs to be a third option for parameter p_overdue called ALL,
    passing which the output should include records having
    p_statcode is Y ELSE p_statcode is N AND p_overdue is Y OR p_overdue is N
    In other words records having both Y and N vlaues for Overdue Flag have to be returned irrespective of the value given to Closed Status.
    Original where clause in the Data Definition file is as follows,
    WHERE Closed_Status = nvl(:p_statcode,Closed_Status)
                       AND overdue_flag = nvl(:p_overdue,overdue_flag)My modified code is as follows,
    WHERE   Closed_Status = NVL (:p_statcode, Closed_Status)
             AND overdue_flag = (CASE
             WHEN :p_overdue = 'Y' THEN 'Y'
             WHEN :p_overdue = 'N' THEN 'N'
             ELSE overdue_flag
             END)
    OR
    WHERE   Closed_Status = NVL (:p_statcode, Closed_Status)
             AND overdue_flag = DECODE (:p_overdue, 'Y', 'Y', 'N', 'N',overdue_flag)Both approaches have the same problem.
    The output is in EXCEL format. The modified query works fine for p_overdue as Y or N but when p_overdue is passed as ALL it returns an empty EXCEL sheet with just the report output column headers.
    Any help as to why this is the case ?? What is wrong in my approach ?
    Regards,
    Vishal

    not clear about p_overdue = ALL
    which values needed for p_overdue = ALL ?
    try smth like
    WHERE   Closed_Status = NVL (:p_statcode, Closed_Status)
    AND (
       overdue_flag = DECODE (:p_overdue, 'Y', 'Y', 'N', 'N',overdue_flag) and :p_overdue != 'ALL'
       or
      :p_overdue = 'ALL' and (overdue_flag = 'Y' or overdue_flag = 'N')
    )for overdue_flag which has more then 'Y', 'N' values
    if overdue_flag only in ('Y','N') then
    WHERE   Closed_Status = NVL (:p_statcode, Closed_Status)
    AND (
       overdue_flag = DECODE (:p_overdue, 'Y', 'Y', 'N', 'N',overdue_flag) and :p_overdue != 'ALL'
       or
      :p_overdue = 'ALL'
    )

  • How to use string operation in where clause of select query

    Hello All,
    I just want to know how can i write a restriction in select query saying retrive data only begins with name "DE*".
    Explaination: If my table has records and names starts with character then i want to write a query to fetch all the records in which names starts with DE*.
    Thanks in advance for your quick reply...
    Dev.

    Hi
    In the where clause you need to write like
    WHERE NAME LIKE 'DE%'
    Regards
    Sudheer

  • Using Case Statement in Where Clause

    Hello All,
    I wish to conditionally use different columns for retrieving unique row. This will be dependent upon a parameter passed to the Function/Procedure.
    The SQL framed looks as below:
    +select *+
    from Test_Table
    where column_1 = <some_value>
    and case when p_call_location = 'A' then column_2 like '%ABC%'
    when p_call_location = 'B' then column_2 Not Like '%ABC%'
    when p_call_location = 'C' then column_3 like '%EFG%'
    when p_call_location = 'D' then column_3 like '%IJKL%'
    END;
    However, I am not sure if this works, as I am getting a Missing Right Paranthesis error. Major hinderance is the depedency on multiple columns, which would need to be referred for particular scenario.
    Can somebody please help me with an example or a skeleton of how a query should be formed?
    Appreciate an early reply!!!

    HI,
    i think this may solve your issue...get back to me if u have any qry's on this.
    CREATE TABLE Test_Table
    (p_call_location VARCHAR2(10),
    COLUMN_1 VARCHAR2(20),
    COLUMN_2 VARCHAR2(20),
    COLUMN_3 VARCHAR2(20))
    INSERT INTO Test_Table VALUES('A','COMNVAL','ABC_PER','XXXX');
    INSERT INTO Test_Table VALUES('A','COMNVAL','PER','XXXX');
    INSERT INTO Test_Table VALUES('B','COMNVAL','ABC_PER','XXXX');
    INSERT INTO Test_Table VALUES('B','COMNVAL','PER','XXXX');
    INSERT INTO Test_Table VALUES('C','COMNVAL','ABC_PER','EFG_XXXX');
    INSERT INTO Test_Table VALUES('C','COMNVAL','ABC_PER','XXXX');
    INSERT INTO Test_Table VALUES('D','COMNVAL','ABC_PER','EFG_XXXX_IJKL');
    INSERT INTO Test_Table VALUES('D','COMNVAL','ABC_PER','GGG_XXXX');
    SELECT * FROM Test_Table WHERE ROWID IN (
    select case when p_call_location = 'A' AND column_2 like '%ABC%' THEN ROWID
    when p_call_location = 'B' AND column_2 Not Like '%ABC%' THEN ROWID
    when p_call_location = 'C' AND column_3 like '%EFG%' THEN ROWID
    when p_call_location = 'D' AND column_3 like '%IJKL%' THEN ROWID
    END AS KK
    from Test_Table
    where column_1 = 'COMNVAL');
    even u can use the below qry also
    select *
    from test_table
    where column_1 = 'COMNVAL'
    and (case when p_call_location = 'A' and column_2 like '%ABC%' then 'VALID'
    when p_call_location = 'B' and column_2 Not Like '%ABC%' then 'VALID'
    when p_call_location = 'C' and column_3 like '%EFG%' then 'VALID'
    when p_call_location = 'D' and column_3 like '%IJKL%' then 'VALID'
    else 'INVALID'
    END) = 'VALID';
    thanks
    prasuna.
    Edited by: user13820845 on Feb 21, 2011 10:25 PM

  • How to use DATE in the where clause

    I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
    select query used to get the list of records
    CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
    SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
    not returning expected records
    SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;Edited by: Balaji on Mar 19, 2012 9:13 PM

    Hi,
    Balaji wrote:
    I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
    select query used to get the list of records
    CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
    INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
    SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;
    Both operands to LIKE are supposed to be strings. Don't try to use a DATE, such as SYSDATE, with LIKE.
    I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
    not returning expected records
    SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;
    It's returning the results I expect.
    If you'd say what results you were expecting, someone could help you wite a query to get them.
    Assuming 1 second elapses between the time 'ITEM4' is inserted and the time the 2nd query is run, then, at run-time, available_date will be 1 second less than SYSDATE, so it should not be included.
    If you want to find rows that are on the same calendar day as SYSDATE, or later, then use
    WHERE    available_date >= TRUNC (SYSDATE)

  • How to use division with a Where() clause

    I have to report four specific time periods dynamically so I made Date variables. I cannot use division of the metrics without applying the date codes to the individual metrics. There has to be a way I am not thinking of. This is a massive report so I need to keep variables to a minimum.
    Example:
    [Sales 1] / [Quota 1] = Percent to Quota
    I have a Date Variable for Quarter to Date: [Months in QTD] That returns multiple "Fiscal Periods" (months) per date formulas
    However, to get the right time period data using DIVISION, say for Quarter To Date I have to use:
    [Sales 1] Where( [Fiscal Period] = [Months In QTD]) / [Quota 1] Where( [Fiscal Period] = [Months In QTD])
    The above returns the correct value for the three months in the quarter.
    That would be OK except I need an IF..Then..ElseIf..Else statement to solve for zeros and nulls and it gets very long adding the “Where( [Fiscal Period] = [Months In QTD])” to every measure in the statement.
    I have tried nesting:  =(SUM(  [Sales 1] ) / Sum( [Quota 1) ) Where( [Fiscal Period] = [Months In QTD])
    And that does not work as with other attempts to nest.
    I tried an IF( [Fiscal Period] = [Months In QTD] … but it returns MULTI error I assume becaause the variable [Months in QTD] delivers more that one Fiscal Period.
    Come on brainac’s.  Division has its own rules but there should be a way.
    Thank you.

    Hi,
    Just to give you rough idea. I would suggest you to apply following logic at query level.
    Create a query with prompt and try to get Months in QTD there only a single object.
    Now apply filter on second query "where result from another query" that will filter data for perticular quarter.
    I hope you can understand.
    Thanks,
    Swapnil

  • Case statement in where clause ??

    Hello gurus,
    Can we use case statements in where clause ?? Any example will be great!
    And also i would like to know, besides CASE and DECODE statements, Is there any way we can use IF ELSE statements in SELECT clause or in WHERE clause ?
    Thank you!!

    Hi,
    user642297 wrote:
    Hoek,
    Thanks for the reply
    Whatever you return from 'then' should match your criteria.I didnt get this part...can you elaborate this part ?? Thank you!!Remember what a CASE expression does: it returns a single value in one of the SQL data types (or NULL).
    You're probably familiar with conditions such as
    WHERE   col = 1Inthe example above, col could be replaced by any kind of expression: a function call, and operation (such as "d * 24") or a CASE expression, which is exactly what Hoek posted:
    where  case
             when col = 6 then 1
             when col = 9 then 1
           end = 1;I think what Hoek meant about mnatching was this: since the CASE expression is being compared to a NUMBER, then every THEN clause (as well as the ELSE, if there is one) should return the same data type. You can't have one THEN clause return a NUMBER, and another one in the same CASE expression return a DATE, like this:
    where  case
             when col = 6 then 1
             when col = 9 then SYSDATE     -- WRONG! Raises ORA-00932: inconsistent datatypes
           end = 1; 
    By the way, it's rare when a CASE expression really helps in a WHERE clause. CASE is great for doing conitional stuff in places where you otherwise can't (in the ORDER BY clause, for example), but the WHERE clause was designed for conditions.
    Hoek was just trying to give a simple example. If you really wanted those results, it would be simpler to say:
    where  col = 6
    or     col = 9and simpler still to say
    where  col  IN (6, 9)

  • How can we use DECODE function in where clause.

    Hi Guys,
    I have to use DECODE function in where clause.
    like below
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and decode(code, 'a','approved')
    in this manner its not accepting?
    Can any one help me on this or any other aproach?
    Thanks
    -LKR

    >
    I am looking for to decode the actual db value something in different for my report.
    like if A then Accepted
    elseif R then Rejected
    elseif D then Denied
    these conditions I have to check in where clause.
    >
    what are you trying to do?
    may be you are looking for
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and
       (decode(:code, 'A','Accepted') = <table_column>
        or
        decode(:code, 'R','Rejected') = <table_column>
       or
        decode(:code, 'D','Denied') = <table_column>
       )

  • How to use case when statements in ODI

    I need to put conditional logic before DVM look up in ODI. In the expression editor I put the following statement:-
    CASE WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS' THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME=EBIZ_CELL.CELL_DATA
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC' THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)=EBIZ_CELL.CELL_DATA
    END
    It did not work,
    Under Operators ->All Executions, found the error:-
    905 : 42000 : java.sql.SQLException: ORA-00905: missing keyword
    The description in Session Task contained:-
    select     
         C1_JOURNAL_TEMPL
    from     APPS.POC_JOURNAL_TEMP_SOURCE_TBL POC_JOURNAL_TEMP_SOURCE_TBL, APPS.C$_0POC_JOURNAL_TEMP_TARGET_TB
    where     
         (1=1)
    And (CASE
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS'
    THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME=C2_CELL_DATA
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC'
    THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)=C2_CELL_DATA
    END)
    Checked the above code in PL/SQL Developer but it gave errors.
    In PL/SQL developer tried to check a simple query using case-when but even that is giving errors in the case-when portion.
    The query is as follows:-
    select phase_code, accounting_period, sum(eff_cc) as BD_Eff_QTD
    from prj_detail
    where
    case POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    when 'EXT'
    then
    1
    when 'RAC'
    then
    2
    when 'XXX'
    then
    3
    else
    end
    I would like to know what is wrong with the above code.
    Please let me know what is the correct way of using case-when in PL/SQL as well as in ODI.

    Your ODI case statement and PL/SQL Case statement both looks confusing.
    You are writing case statement under where clause which is not a good practise. If you want to implement logic like-
    select a,b,c from <table>
    where
    when cond^n^ 1 then do 1
    when cond^n^ 2 then do 2
    then better you seperate your query for each filter and do a union, in other words-
    select a,b,c from <table>
    where cond^n^ 1
    union
    select a,b,c from <table>
    where cond^n^ 2
    If you are writing case staement to retrieve a value/column (EBIZ_CELL.CELL_DATA) then no need to include it under filter.
    ODI case for column EBIZ_CELL.CELL_DATA will be:
    CASE
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS'
    THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC'
    THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)
    END
    Pl/SQL query-
    select phase_code, accounting_period,
    case POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    when 'EXT'then 1
    when 'RAC' then 2
    when 'XXX' then 3
    else 'default value' --- (if no else needed then can also remove else part)
    end,
    sum(eff_cc) as BD_Eff_QTD
    from prj_detail
    Suggested as per what is understood, hope it helps.
    Edited by: 939451 on Jul 5, 2012 12:47 AM
    Edited by: 939451 on Jul 5, 2012 12:48 AM

  • Can I use SYSDATE in the WHERE clause to limit the date range of a query

    Hi,
    Basicaly the subject title(Can I use SYSDATE in the WHERE clause to limit the date range of a query) is my question.
    Is this possible and if it is how can I use it. Do I need to join the table to DUAL?
    Thanks in advance.
    Stelios

    As previous poster said, no data is null value, no value. If you want something, you have nvl function to replace null value by an other more significative value in your query.<br>
    <br>
    Nicolas.

Maybe you are looking for

  • Discoverer report with PO_RELEASES in R12

    Hi all, I'm migrating a Discoverer report from 11i to R12. The query of the folder uses the po_releases and this join condition "and rcv_transactions.po_release_id = po_releases.po_release_id(+)". When I run the report I get the error "invalid number

  • BEFW11S4 ver.3 - NETWORK CABLE UNPLUGGED

    My father-in-law gave me a BEFW11S4 ver.3 router and said that it was working fine.  I downloaded the user guide from Linksys and follwed the instructions to hook it up through my DSL modem but it keeps saying "NETWORK CABLE UNPLUGGED".   I'm trying

  • Red screen and freeze... huh?

    I was happily viewing a simple .mov file before, when the computer suddenly froze and a red curtain came down from the top of the screen (not solid... but making everything on my screen tinted red). Little spinning wheel... everything else frozen. On

  • Question on internal table logic..

    Gurus, I have a internal table as follows: it_tab: ID---ACTION---CHANGE A1-----X-- B2---- U C1-----X-- U C2-----X-- Without looping at the table, how can I find get the result that the internal table has 3 ids with ACTION ='X' and 1 ID with ACTION  =

  • PM SHOP PAPERS

    Hi PM Gurus, We have a problem while printing shop papers through t code IW3D. There are 2 shop papers for the order. First paper prints the long text also but second shop paper does not. Can anyone tell if there is any setting in config which allows