conditional clause

I have two table as below

I need to make my clause condition based on a flag value, so if the value of the indicator is 1 then I use table_a table_b else

create table table_a ( L_num number);
create table table_b ( L_num number);


insert into table_a values (1);
insert into table_b values (2);


i need to make my from clause condition based on a flag value , so if flag value is 1 then i want to use table_a else table_b


declare


v_flag number;
L_var number;
begin
v_flag :=1;


select L_num into L_var from decode(v_flag,1,table_a,table_b);


end;

I know that the syntax above is not correct, but can anyone suggest a solution for the same thing?

Thank you

PS: I don't want to use dynamic sql.

I want to be in a request to have two queries if-else won't work for me

So below the solution will not work for me

If v_flag = 1

then

Select from table_a;

on the other

Select of table_b.

Maybe just

Select *.

from table_a

where: flag = 1

Union of all the

Select *.

of table_b

where: Pavilion! = 1

Concerning

Etbin

Tags: Database

Similar Questions

  • Based where conditional clause...

    dear team,
    i have following code..
    
    Declare
      gv_flag1 Varchar2(1)   := 'N';
      gv_flag2 Varchar2(1)   := 'N';
      gv_flag3 Varchar2(1)   := 'N';
      all_where1       Varchar2(250);
      all_where2       Varchar2(250);
      ALL_where3       Varchar2(250);
      V_QTY           Number;
    Begin
      If gv_flag1 = 'N' Then
         all_where1 := 'AND '||'V.OWNER = ''PROD''';
      End If;
      DBMS_OUTPUT.PUT_LINE(all_where1);
      
      If gv_flag2 = 'N' Then 
         all_where2 := 'AND '||'V.OPERATION NOT LIKE (''10%'')';
      End If;   
      DBMS_OUTPUT.PUT_LINE(all_where2);
      
      If gv_flag3 = 'N' Then
         all_where3 := 'AND '||'V.OPERATION NOT LIKE (''07%'')';
      End If;
      DBMS_OUTPUT.PUT_LINE(all_where3); 
       
      --select based on conditions..
    End; 
    
    NOW I want where conditions in select statment to be conditional...
    
    which means if flag1='N' and flag2 = 'N' then use both all_where1 and all_where2 in *where* clause statement...
    if flag1='N' and flag3 = 'N' then then use all_where1 and all_where 3 in *where* clause of select statement...
    if all there flag = 'N' then use all_where conditions in *where* clause of select statement...
    
    i have 3 flags, which means total of 9 combinations,  is there any simpler way to do such kind of thing??
    
    please assist me
    
    nic

    Nicloei W wrote:
    Hi Jeenesh,

    What happens if Flag2 = 'Y' and Indicateur3 = 'Y' in this case, I want only the condition with Flag1

    concerning
    NIC

    SQL> ed
    Wrote file afiedt.buf
    
      1  Declare
      2    gv_flag1 Varchar2(1)   := 'N';
      3    gv_flag2 Varchar2(1)   := 'Y';
      4    gv_flag3 Varchar2(1)   := 'Y';
      5    --all_where1       Varchar2(250);
      6    --all_where2       Varchar2(250);
      7    --ALL_where3       Varchar2(250);
      8    lc_query varchar2(1000):= 'select count(*) from test v ';
      9    lc_where varchar2(500) := ' where 1 = 1 ';
     10    V_QTY           Number;
     11  Begin
     12    If gv_flag1 = 'N' Then
     13       lc_where := lc_where||' AND V.OWNER = ''TEST''';
     14    End If;
     15    If gv_flag2 = 'N' Then
     16       lc_where := lc_where||' AND V.OPERATION NOT LIKE ''10%''';
     17    End If;
     18    If gv_flag3 = 'N' Then
     19       lc_where := lc_where||' AND V.OPERATION NOT LIKE ''07%''';
     20    End If;
     21    lc_query := lc_query||lc_where;
     22    dbms_output.put_line(lc_query);
     23    dbms_output.put_line('-----------');
     24    execute immediate lc_query into v_qty;
     25    dbms_output.put_line('Count: '||v_qty);
     26* End;
    SQL> /
    select count(*) from test v  where 1 = 1  AND V.OWNER = 'TEST'
    -----------
    Count: 3
    
    PL/SQL procedure successfully completed.
    
  • Condition within a where condition clause

    Dear friends,
    I am a beginner in PL/SQL and I need your help.
    I'll show you my code (it does not):
    declare
        var_mese VARCHAR2 (2);
    begin
        select max(to_number(MESE)) 
        into var_mese
        from NOC_MONITORAGGIO;
           SELECT count(*)
            FROM noc_sdoc_work a,
                 noc_sdoc b,
                 NOC_MONITORAGGIO
           WHERE NVL(a.CD_STRUTTURA,'x') = NVL(b.CD_STRUTTURA,'x')
             AND NVL(a.CD_SUB_STRUTTURA,'x') = NVL(b.CD_SUB_STRUTTURA,'x')
             AND NVL(a.NR_PRATICA,'x') = NVL(b.NR_PRATICA,'x')
             AND NVL(a.ASL,'x') = NVL(b.ASL,'x')
             AND b.STATO IN ( 1, 2 )         
            and
                if  var_mese in ('03','04','05','06','07','08','09','10','11','12') then
                    NOC_MONITORAGGIO.ANNO_GESTIONE = b.ANNO;
                else
                    NOC_MONITORAGGIO.ANNO_GESTIONE = to_number(b.ANNO)-1;
                end if;
    end;
    My problem is here:
            and
                if  var_mese in ('03','04','05','06','07','08','09','10','11','12') then
                    NOC_MONITORAGGIO.ANNO_GESTIONE = b.ANNO;
                else
                    NOC_MONITORAGGIO.ANNO_GESTIONE = to_number(b.ANNO)-1;
                end if;
    I need a nested where condition

    Thank you
    Leo

    You can code box that using a statement in the WHERE clause:

     and NOC_MONITORAGGIO.ANNO_GESTIONE =
                case
                   when var_mese in ('03','04','05','06','07','08','09','10','11','12') then b.ANNO
                   else to_number(b.ANNO)-1
                end
    
  • WHERE conditional clause with CASE statement

    Hi experts,

    I have a table:

    CREATE THE TABLE HR. TABLE_Y

    (

    NUMBER (2),

    ID NUMBER (2),

    NUMBER (5) CALC

    )

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (1, 1, 10);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (1, 2, 15);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (1, 3, 17);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (1, 4, 20);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (2, 2, 11);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (1, 2, 14);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (2, 3, 18);

    Insert into human resources. TABLE_Y

    (TYPE, ID, CALC)

    Values

    (3, 1, 30);

    COMMIT;

    SQL > SELECT * FROM TABLE_Y ORDER BY 1.2;

    TYPE ID CALC

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

    1          1         10

    1          2         15

    1          3         17

    1          4         20

    2          1         14

    2          2         11

    2          3         18

    3          1         30

    I have the query as below,

    I pass a TYPE and an IDENTITY value as a condition for a query.

    SELECT THE TYPE, ID, CALC

    OF TABLE_Y

    WHERE TYPE =: TYPE

    AND IN THE CASE OF IDENTITY

    WHEN: TYPE = 1

    THEN 2

    WHEN: TYPE = 2

    THEN 1

    End

    ;

    When passing a TYPE = 1

    Output

    ID of TYPE CALC

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

    1                2           15

    When passing a TYPE = 2

    Output

    ID of TYPE CALC

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

    2               1               14

    I want to move a TYPE and ID more values as a condition for a query.

    I'm trying

    SELECT THE VALUE TYPE, ID,

    OF TABLE_Y

    WHERE TYPE =: TYPE

    AND IN THE CASE OF IDENTITY

    WHEN: TYPE = 1

    THEN (1,3)

    WHEN: TYPE = 2

    THEN (1,2)

    End

    ;

    But gives me error:

    ORA-00907: lack of right parenthesis

    During the passage of a desired output TYPE, = 1

    TYPE ID CALC

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

    1            1            10

    1            3            17

    During the passage of a desired output TYPE, = 2

    TYPE ID CALC

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

    2           1              14

    2           2              11

    Thanks in advance

    BANNER

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

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production

    PL/SQL Release 10.2.0.4.0 - Production

    CORE 10.2.0.4.0;     Production

    AMT for Solaris: release 10.2.0.4.0 - Production

    NLSRTL Version 10.2.0.4.0 - Production

    Hello

    Here's one way:

    SELECT the type, id, value

    OF table_Y

    WHERE type =: type

    AND ((: type = 1))

    AND id IN (1, 3)

    )

    OR (: type = 2)

    AND id IN (1, 2)

    )

    )

    ;

  • Shot summary of a where condition clause...

    I have a form that displays the code material and this number in which different warehouses...

    It is possible to create an element of the summary screen is based on the place where the condition

    for ex.
    SQL> select  sum(arar) from tbs;
    
     SUM(ARAR)
    ----------
          1488
    
    for this query i can create a  display item and in the propery  pallete  i can select mode as summary,
    summary function as count, and select respective block and item...
    
    what i want to know is can this be based on where condition 
    some thing like the count shoudn't include where the column values is zero
    SQL> select count(arar) from tbs where arar!='0';
    
    COUNT(ARAR)
    -----------
            144
    Published by: Chase Suhail on November 9, 2010 22:45

    Hello

    Create a column of formulas no database in the same block to say 'NON_ZERO.
    The formula for the column would be: SET_NON_ZERO - this function returns 1 if arar is non-zero and 0 if it is zero.

    FUNCTION SET_NON_ZERO RETURN NUMBER IS
    BEGIN
     IF :ARAR = 0 THEN
       RETURN (0);
     ELSE
       RETURN (1);
     END IF;
    END;
    

    Now you can create a column of synthesis and use the text-to-speech function 'sum' and item summarised as "NON_ZERO.

    I hope this helps.

    Best regards

    Arif Khadas

  • Calculation with conditional clauses

    Hello

    I have a rather complicated in an Acrobat form calculation cannot get away without writing any javascript. The problem is that I do not know how to write javascript!

    So if there's someone here who is somehow quite help me, I would certainly appreciate it!

    Here are the conditions:

    SUM is a sum of many other areas which is given here, TOTAL is the value that we have to calculate.

    If the SUM is less than 1500, the TOTAL should be SUM

    If the SUM is between 1500 and 1875, the TOTAL should be 1500.

    If the SUM is between 1875 and 2500, the TOTAL should be SUM * 0.8

    If the SUM is between 2500 and 3400, TOTAL should be 2500

    If the SUM is greater than 3400, TOTAL should be SUM * 0.75

    I guess this requires javascript on some fields and also at the level of the document, so please let me know where to put them!

    Thank you 1 million,

    Mark

    For the "TOTAL" field, you can use the following custom calculation script:

    fSum var = this.getField('SUM').value; get the value of the field named "SUM".

    {Switch (true)}

    case (fSum< 1500)="">

    less than 1500

    this.getField('TOTAL').value = fSum; total is the sum

    break; output test

    case (fSum<>

    sum< 1875="" -="" we="" have="" already="" taken="" care="" of =""><>

    this.getField('TOTAL').value = 1500; total is 1500

    break; output test

    case (fSum<>

    sum< 2500="" -="" we="" have="" already="" taken="" care="" of=""><>

    this.getField('TOTAL').value = fSum * 0.8; total is 80% of the sum

    break; output test

    case (fSum<>

    sum< 3400="" -="" we="" have="" already="" taken="" care="" of="" ,="">

    this.getField('TOTAL').value = 2500; total is about 2500

    break; output test

    by default:

    only 3400 and upper-left

    this.getField('TOTAL').value = fSum * 0.75; total is 75% of the sum

    break; output test

    } / / end of all tests

  • Where conditional Clause based on the length of the field

    Hello people,
    I tried to search for this scenario in OTN and not been able to find any success so I will post the question here.

    I have two tables - with the detail records and the other being a table of codes. I need to join these two tables based on the code and the length of the code. Let me explain using examples.

    Scripts for creating the table and inserts
    create table ILLNESS_CODES(illness_code varchar2(4), illness_description varchar2(100));
    create table PATIENT_TB(patient_id varchar2(4), primary_cause varchar2(4));
    
    insert into illness_codes values('B10', 'Flu');
    insert into illness_codes values('B30', 'Hepatitis');
    insert into illness_codes values('B301', 'Hepatitis A');
    insert into illness_codes values('B302', 'Hepatitis B');
    insert into illness_codes values('B303', 'Hepatitis C');
    
    insert into patient_tb values ('1001', 'B101');
    insert into patient_tb values ('1002', 'B102');
    insert into patient_tb values ('1003', 'B30');
    insert into patient_tb values ('1004', 'B301');
    insert into patient_tb values ('1005', 'B302');
    insert into patient_tb values ('1006', 'B302');
    insert into patient_tb values ('1007', 'B303');
    insert into patient_tb values ('1008', 'B30');
    As you can see that patients * 1001 * and * 1002 * have no codes in the Master table. In this case, I want only the first 3 characters of the ILLNESS_CODES table.
    However, for B30, it has a Code and the same for B301, B302 B303 where I would meet the description based on the exact code.

    Example of output
    Patient ID   Illness Description
    =====================================
    1001         Flu
    1002         Flu
    1003         Hepatitis
    1004         Hepatitis A
    1005         Hepatitis B
    1006         Hepatitis B
    1007         Hepatitis C
    1008         Hepatitis
    Thanks in advance!
    SELECT p.*,
           NVL ( (SELECT illness_description
                    FROM ILLNESS_CODES I
                   WHERE i.illness_code = p.primary_cause),
                (SELECT illness_description
                   FROM ILLNESS_CODES I
                  WHERE i.illness_code = SUBSTR (p.primary_cause, 1, 3)))
      FROM PATIENT_TB p;
    
  • Conditional clause in the select statement

    Hi all
    Suppose for example of diagram of HR that I have the following query where it counts the number of Department based on their identity papers and the total number of jobs:
    SQL> select decode(grouping(job_id),1,'total_job',job_id) as JobID, decode(group
    ing(department_id),1,'all_department',department_id) as DepartmentID, count(*) f
    rom employees group by rollup(job_id,department_id) order by job_id,department_i
    d;
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    AC_ACCOUNT 110                                               1
    AC_ACCOUNT all_department                                    1
    AC_MGR     110                                               1
    AC_MGR     all_department                                    1
    AD_ASST    10                                                1
    AD_ASST    all_department                                    1
    AD_PRES    90                                                1
    AD_PRES    all_department                                    1
    AD_VP      90                                                2
    AD_VP      all_department                                    2
    FI_ACCOUNT 100                                               5
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    FI_ACCOUNT all_department                                    5
    FI_MGR     100                                               1
    FI_MGR     all_department                                    1
    HR_REP     40                                                1
    HR_REP     all_department                                    1
    IT_PROG    60                                                5
    IT_PROG    all_department                                    5
    MK_MAN     20                                                1
    MK_MAN     all_department                                    1
    MK_REP     20                                                1
    MK_REP     all_department                                    1
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    PR_REP     70                                                1
    PR_REP     all_department                                    1
    PU_CLERK   30                                                5
    PU_CLERK   all_department                                    5
    PU_MAN     30                                                1
    PU_MAN     all_department                                    1
    SA_MAN     80                                                5
    SA_MAN     all_department                                    5
    SA_REP     80                                               29
    SA_REP                                                       1
    SA_REP     all_department                                   30
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    SH_CLERK   50                                               20
    SH_CLERK   all_department                                   20
    ST_CLERK   50                                               20
    ST_CLERK   all_department                                   20
    ST_MAN     50                                                5
    ST_MAN     all_department                                    5
    total_job  all_department                                  107
    
    40 rows selected.
    The total number of global jobs regardless of which Department is 107. Question: How to make a query that displays the result above and makes the JOBID and DEPARTMENTID column value to two TotalAgregate where the count indicates 107? Like this:
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    AC_ACCOUNT 110                                               1
    AC_ACCOUNT all_department                                    1
    AC_MGR     110                                               1
    AC_MGR     all_department                                    1
    AD_ASST    10                                                1
    AD_ASST    all_department                                    1
    AD_PRES    90                                                1
    AD_PRES    all_department                                    1
    AD_VP      90                                                2
    AD_VP      all_department                                    2
    FI_ACCOUNT 100                                               5
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    FI_ACCOUNT all_department                                    5
    FI_MGR     100                                               1
    FI_MGR     all_department                                    1
    HR_REP     40                                                1
    HR_REP     all_department                                    1
    IT_PROG    60                                                5
    IT_PROG    all_department                                    5
    MK_MAN     20                                                1
    MK_MAN     all_department                                    1
    MK_REP     20                                                1
    MK_REP     all_department                                    1
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    PR_REP     70                                                1
    PR_REP     all_department                                    1
    PU_CLERK   30                                                5
    PU_CLERK   all_department                                    5
    PU_MAN     30                                                1
    PU_MAN     all_department                                    1
    SA_MAN     80                                                5
    SA_MAN     all_department                                    5
    SA_REP     80                                               29
    SA_REP                                                       1
    SA_REP     all_department                                   30
    
    JOBID      DEPARTMENTID                               COUNT(*)
    ---------- ---------------------------------------- ----------
    SH_CLERK   50                                               20
    SH_CLERK   all_department                                   20
    ST_CLERK   50                                               20
    ST_CLERK   all_department                                   20
    ST_MAN     50                                                5
    ST_MAN     all_department                                    5
    TotalAgregate  TotalAgregate                                107
    
    40 rows selected.
    Best regards
    Valerie

    I do not have the HR schema to play with, but isn't it just a nested decode it takes?

    for example something like...

    select decode(grouping(job_id),1,'TotalAggregate',job_id) as JobID
          ,decode(grouping(department_id),1,decode(grouping(job_id),1,'TotalAggregate','all_department'),department_id) as DepartmentID
          ,count(*)
    from employees
    group by rollup(job_id,department_id)
    order by job_id,department_id;
    
  • Question about WHERE Clause

    Hello

    I'm doing a conditional clause where clause displays the lines in a report.

    The desired control is date of two fields (CIC and announcement) must all be virgins or someone not be an 'Admin' (taken from a global variable stored on connection) for her to no display.

    Here's what I have:

    WHERE (DATACOLLECT. ANNOUNCEMENT_OF_DEAL_SIGN IS NOT NULL AND DATACOLLECT. CHANGE_IN_CONTROL IS NOT NULL) OR UPPER(:F19959_USER_ROLE) = "ADMIN".

    During the test of this query, it hides a field with ONE of the two dates being blank and which is not desirable.

    I also tried to write it like this and got an error of analysis for an invalid relational operator:

    WHERE (DATACOLLECT. ANNOUNCEMENT_OF_DEAL_SIGN AND DATACOLLECT. CHANGE_IN_CONTROL IS NOT NULL) OR UPPER(:F19959_USER_ROLE) = "ADMIN".

    Any help would be greatly appreciated. Please let me know if I need to clarify.

    I take what I said back.  Your requirement of "double negative" is odd

    DO NOT SHOW: where (X is null and Y is null)

    translates

    Show: where not (x is null and Y is null)

    WHERE NOT (DATACOLLECT. ANNOUNCEMENT_OF_DEAL_SIGN is null AND DATACOLLECT. CHANGE_IN_CONTROL IS NULL) OR UPPER(:F19959_USER_ROLE) = "ADMIN".

    MK

    PS - this is a thing of database.  PL/SQL and SQL would have been a better choice

  • How to add a where condition to seeds VO

    Hi I have a VO PoRequisitionLinesVO.Now knowledge I want to add the SQL where condition...

    How can I do this...? There is no addition of all fields... only adding a where condition clause?

    Will I need to extend that VO? If yes then how should I do this?

    Thank you...

    Yes, you must extend the VO.

    To get the procedure you can search the Internet, there is a great article (that I mentioned below):

    https://blogs.Oracle.com/prajkumar/entry/eo_based_vo_extension_in

    Kind regards

    Sandeep M.

  • Update of several lines using the join condition

    Hi all

    CREATE OR REPLACE
    PROCEDURE update_t
    IS

    BEGIN
    SheikYerbouti IN (SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM hr.employees)
    LOOP
    UPDATE
    HR.employees1
    SET
    FOCA =)
    Select concat (FIRST_NAME, LAST_NAME) in the hr.employees where SheikYerbouti. EMPLOYEE_ID = 197);
    END LOOP;
    END update_t;
    /

    I'm trying to update column Foca Employees1 table. When I run this procedure, I get the error

    Error report:
    ORA-01427: einreihig subquery returns multiple rows
    ORA-06512: at "SYSTEM. UPDATE_T", line 13
    ORA-06512: at line 1
    01427 00000 - "einreihig subquery returns several lines.

    Please let me know a solution for this.

    Thank you
    Mathon

    Hello Mathieu,
    in your internal SQL result set is not limited to just one line.
    Try this

    UPDATE hr.employees1 SET
    FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);
    

    Your version had no restrictions on selected lines of hr.employees. You gave a where condition clause that is not related to the query.

    The best solution for your problem is to avoid completely any PL/SQL loop. You can try something like this:

    update
       (select
           e1.first_last,
           e.first_name,
           e.last_name
        from
           hr.employees1 e1,
           hr.employees e
        where
           e1.employee_id=e.employee_id) set
       first_last=first_name||last_name;
    

    But beware, the updates on the joints work only under certain restrictions. The key of the table to be updated must be the join key. (key preserved is the word to look for).

    Hope that helps,
    dhalek

  • WHERE in MessagechoiceLOV condition

    Hello

    I know how to use messagechoice to filter records based on the value in the other field. Basically, I can put a where condition clause in the VO, associated with the messagechoice to achieve this. But how can I optimize the similar condition in a messagechoiceLOV?

    Thank you

    Nullpointer exception, you make stupid mistakes.

    If (PageContext.isLovEvent ()) - this must be praav1s to the basic page controller

    Following must be the writtern LOV controller.
    Dictionary d1 = pageContext.getLovCriteriaItems ();
    String s1 = (String) d1.get ("positionname");
    System.out.println ("value is" + s1);

    Thank you
    Kumar

  • long data type in where clause

    Hello

    I need to select in an Oracle table with a column having
    Long data type and Oracle does not use this column in the
    WHERE clause. Doco Oracle suggests that the columns with LARGE data types may
    only be used in the select statement (not in the CASE or any other
    conditional clause).

    Anyone know any work around for this problem?

    What is the way to see the value of long data type?

    How can we use them in where clause?

    We can all utility to display the specified records? There are Lakes of records...


    I ned use it in where clause...

    Thanks and greetings
    VD

    Published by: vikrant dixit on November 23, 2008 22:47

    So can OK we use CLOB/BLOB in where clause?

    Yes, you can query the LOB columns using the package (F.ex.SUBSTR or INSTR) DBMS_LOB functions.

    Why u say that the result is FTS?

    This would result in FTS as you cannot index LARGE data or create a function based on the column index.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/sql_elements001.htm#sthref149


    LONG columns cannot be indexed.

    No other way to my knowledge.

    You can convert the LOB column with function TO_LOB as described in

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions185.htm#i79464

    Published by: Sissi Kandi on November 24, 2008 12:28

  • case where the condition

    Hello
    I want to use the case (or decode etc.) in which a part of sql.
    I want to find the number of rows depending on where the conditions.
    For example, I have a table b, d, e, p and s are fields of this table.
    If the value of the field b is 1 then my condition clause that will be value fields d, e value fields
    If the value of the fields of b is 2 then my condition clause where the declaration will be p field value < s value fields.


    Select count (*) of A
    where
    (if b = 1 then) d, e
    (if b = 2 then) p < s

    How can I achieve this?
    where (b = 1 and d		   
  • Initial value for the interactive report

    I have an interactive report that has a where clause condition clause: where =(:P50_employeeName) used.

    (: P50_employeeName) is a a list of selection without value null. When the page loads the selection list displays the value employee1, but the interactive report is empty. It's not until I select another value within the selection list becoems active report. How I can so when page loading the interactive report shows instead of being blank? I can't the values of hard employee-coding as each user can see only the user in their Department.

    Hello

    Since I don't know all your table structure, it was just a quick sampling of the approach.

    I guess that your LOV would have the correct where clause to control its content, and you can add additional conditions to the IR where clause as well.

    Here is an example of one of my IR where clauses

    the case when: P200_DEPARTMENT = 0 then 1

    When: P200_DEPARTMENT <> 0 and: P200_CREW = 0 and: P200_DEPARTMENT = c.crewdeptkey, 1

    When: P200_DEPARTMENT <> 0 and: P200_CREW | " <> 0 and: P200_CREW = c.crewkey, 1

    end if 0 = 1

    Kind regards
    Brad

Maybe you are looking for

  • Can I share a folder to iCloud by car?

    I am now on MacOS, and I was wondering if I can share a link to a folder that is located on iCloud drive to friends? Thank you!

  • Toshiba Satellite Pro 4600; Cannot load Windows.

    A friend recently gave me a refurbished from this laptop model that has been updated with Windows XP Pro and it worked for about a month before a windows system file has been altered. I got a new OS disk and I replaced the file and it worked fine for

  • HP 15 r-045tx: problem with audio driver of hp r045tx

    Hi people, I am facing problems using Skype video call feature as it also appears with a message "problem with recording devce" or a "problem with the playback device. and secondly, I also used audition Adobe and in that also, I faced the problems wi

  • Satellite L650-19W - FN and ReelTime button do not work

    Im having problems with the function key. Since he can't work easily does not alter changes such as the brightness of the screen, screen etc. Other Toshiba software do not either as ReelTime. I think that I may have to reinstall the Toshiba Utilities

  • Experts Question Remote Desktop connection...

    I'm looking for someone with a lot of experience with Windows Remote Desktop Connection to answer a basic question or two...  I have a WireShark capture (one side unfortunately) which shows 880 MB sent from the client connection remote desktop, runni