[JDev ADF] How is made the ' where clause ' default display criteria "all searchable attributes?

Hallo,


on a view object, I create my view of the criteria customized; I'm going to use it to create a "query with the table panel.

I wish that his beahviour, when I use it to create a "query with the table panel", corresponds to that of "attributes searchable all.

Unfortunately I'm having some trouble in his creation and I would like to see how is made the "object view where Clause" CV "all searchable attributes.

My VO motion is:

Select the username, name, RegisteringDate

I would like to create my VC in a way that is the result "query with table Panel:

UserId | ___ |

Name | ___ |

RegisteringDate of | ___ | to |_________|

For each search field, I set a variable binding (PName, PUserId, PRegisteringDateTo, PRegisteringDateFrom).

Each field must be used in the "query with table Panel" only if it is filled with a value.

You kindly help me?

Thank you very much

F.

The criteria to view all searchable attributes is implied all the attributes of a vo. Each attribute is used unless you specify a value for it. The problem with this IS, is that you can not change it.

However, you can build your own RESUME that works in the same way, but allows you to change certain attributes. To do this, you create a new business card and add each attribute, select the operation you want to test the attribute against (equals, start by,...). You do not bind variables for attributes specify. The framework will add them for you automatically.

The only thing that can not this vc is check varies as you want to do when you check "RegisteringDate." To do this you must use bind variables.

Once you have create this EGG and it makes you drag onto the page you can use it as the "all attributes searchable.

Timo

Tags: Java

Similar Questions

  • [JDev ADF] How 1) auto - submit search Query Panel when loading the page and 2) 'secretly' proceed to the query a param

    Hello

    in my page, there is a "query with table Panel" created from all the "named criteria | All the attributes of a"of a display object.

    The request of this display object has in its where clause 1 param required.

    When JDeveloper creates the "query with table Panel" it adds to the search also fields that the param required of the View object.

    The user doesn't have to choose the value of the param: I secretly turn the param to query and to hide the search field in the "query with table Panel".

    The query must always be performed with the param I secretly put (reading the value of a managed bean).

    You kindly help me?

    Thank you

    F.

    For this you must intercept the query and add your parameter. You can use the criteria to view "All searchable attributes" for this because this IC is to build implicit and you cannot change it. However, you can create your own CV and imitate the "all attributes searchable" vc. In the t create a new Victoria Cross and all all the attributes of the query itself. One you don't want to see you can hide (like the rohanwalia post).

    Then, you must use the technique described in this blog https://blogs.oracle.com/aramamoo/entry/interpret_af_query_s_queryevent but instead to display the context menu, you set the bean to your hidden setting viewcriteria line.

    Timo

  • Try adding conditions to clause "and" stored in the table for the where clause, unknown syntax

    I am trying to add additional segments to the 'where' clause, and I don't know exactly how to proceed. I am currently using another table to search for keywords and sometimes there aren't everything. I use this table containing the key words to search the description and associate a symbol with a path.

    The code loops through the keywords with the keywords most associated and try to find links to a symbol then excludes those and search for symbols that correspond to those with less keywords and all. I am able to do this with 6 queries and manually changing the arguments, but I want to loop together so that if the changes need to be made in the future, I won't need to go digging in the code.

    Thanks, but that's ok. I already have a solution for this.

  • How to dynamically generate where clause in Linq

    Hi all


    Oracle DB: 11 gR 2
    Oracle Client: 11.2.0.3.0 (ODP.NET)
    Oracle Developer Tools for Visual Studio
    VS 2010 (C#)

    In a Windows Form, it must query the data based on the values in list dropdown listboxes, which the user selects.
    Let's say two combox, one Department and one for salary
    Department:
    -1 all the
    10 Department 1
    20 Department 2
    30 Department 3

    Salary:
    -1 all the
    1 < 20000
    2 20000 to 50000
    3 50000 to 100000
    4 > 100000


    Here is the c# code to query data:
    using (var myEDMctx = new HREntities())
    {
    var LINQrslt = from emp in myEDMctx.EMPLOYEES
    Select emp;

    }


    The default values for the two combox should be everything.
    How to write dynamic where clause for this LINQ?

    Thanks in advance!

    That's what I do.

    var query = from c in customers
    Select c;

    If (where1 > - 1).
    Query = query. Where(c.Where1 > where1);

    If (where2 > - 1).
    Query = query. Where(c.where2 == where2);

    to return the query;

    Published by: Invincible on July 4, 2012 09:25

    Published by: Invincible on July 4, 2012 09:27

  • In the WHERE clause string variable

    I have the procedure

    CREATE OR REPLACE PROCEDURE proc1 (p_1 IN varchar2)
    IS
    BEGIN

    DELETE FROM TABLE1
    WHERE
    Col1 = '@p_1. '
    ;

    Dbms_output.put_line (number of rows sql %);

    COMMIT;

    EXCEPTION
    WHILE OTHERS THEN
    ROLLBACK;
    RAISE_APPLICATION_ERROR (-20000, SQLERRM);
    Proc1 END;
    /


    You will need to pass a string input parameter to the procedure. This string is applied to the WHERE clause. The foregoing does not work correctly the value of @p1 is in the WHERE clause. The value passed to the stored procedure does not run.

    Please let me know the solution. I have to use BIND variables only.

    Thank you

    user12038051 wrote:
    Thank you all. Yes, the underside of the works.

    DELETE FROM TABLE1
    WHERE
    Col1 = p_1
    ;

    PS: Both COL1 and p_1 are string values. Would like to know how it works with out the quotes because it is a string.

    In addition I would like to follow the number of lines executed in each statement. Preference will have to use sql % rowcount. Are there other alternatives. Please let me know. Thanks in advance.

    Oracle 'knows' that the variable p_1 is a varchar2 data type and that col1 is a varchar2 data type, so he makes a comparison between them strinf. This is how variables work in any programming language that I am aware. The only time that you must provide a value is when you use a literal value (for example in an assignment variable, or as a parameter of a procedure).

    If you need to know the number of deleted rows, then sql % rowcount is the only sensible option. Just be aware that you need to get the value before committing yourself ot other options of SQL.

    John

  • Tuning - using the CASE statement in the WHERE clause of the query

    Hi all

    My request has been changed to use a CASE statement in the WHERE clause to examine the data to some columns based on a parameter value. This modified request is made a full table and constantly running scan. Please suggest what can be done to improve its performance:

    Query:
    SELECT LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS summary_date,
    os.acctnum,
    os.avieworigin_refid,
    COUNT(1) cnt_articleview,
    SUM(NVL(autocompletedterm,0)) cnt_autocompletedterm
    FROM TABLE1 os
    WHERE os.acctnum IS NOT NULL
    AND os.avieworigin_refid IS NOT NULL
    AND os.requestdatetime IS NOT NULL
    AND UPPER(os.success_ind) = 'S'
    
    AND CASE WHEN
    Param_ValueToCheck  = 'FULL' AND get_date_timestamp(os.requestdatetime)  BETWEEN 
    TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    WHEN
    Param_ValueToCheck  = 'INCR' AND os.entry_createddate  BETWEEN 
    TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    END = 1
    AND CASE WHEN
    Param_ValueToCheck  = 'FULL' AND os.entry_CreatedDate BETWEEN 
    TO_DATE('01-APR-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('07-JUN-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    WHEN
    Param_ValueToCheck  = 'INCR' THEN 1
    END = 1
    GROUP BY LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))), os.acctnum,os.avieworigin_refid;
    Description of the table:
    (Number of lines: approx. > amount 600 000 000)
    Name                           Null     Type       
    ------------------------------ -------- ------------
    ARTICLEID                      NOT NULL NUMBER(20) 
    USERKEY                                 NUMBER(10) 
    AVIEWORIGIN_REFID                       VARCHAR2(10)
    SUCCESS_IND                             VARCHAR2(2)
    ENTRY_CREATEDDATE                       DATE       
    CREATED_BY                              VARCHAR2(10)
    FILENUMBER                              NUMBER(10) 
    LINENUMBER                              NUMBER(10) 
    ACCTNUM                                 VARCHAR2(10)
    AUTOCOMPLETEDTERM                       NUMBER(2)  
    REQUESTDATETIME                         VARCHAR2(19)
    Explain Plan
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 2224314832
    
    ----------------------------------------------------------------------------------------------------------
    | Id  | Operation            | Name              | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    ----------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT     |                   |   590 | 33040 |  2501K  (1)| 08:20:15 |       |       |
    |   1 |  HASH GROUP BY       |                   |   590 | 33040 |  2501K  (1)| 08:20:15 |       |       |
    |   2 |   PARTITION RANGE ALL|                   |   590 | 33040 |  2501K  (1)| 08:20:15 |     1 |1048575|
    |*  3 |    TABLE ACCESS FULL | TABLE1 |   590 | 33040 |  2501K  (1)| 08:20:15 |     1 |1048575|
    ----------------------------------------------------------------------------------------------------------
    
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter(UPPER("OS"."SUCCESS_IND")='S' AND CASE  WHEN ('FULL'='FULL' AND
                  "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' 2011-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN
                  'FULL'='INCR' THEN 1 END =1 AND "OS"."REQUESTDATETIME" IS NOT NULL AND CASE  WHEN ('FULL'='FULL'
                  AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")>=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")<=TO_DATE(' 2011-05-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN ('FULL'='INCR' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE('
                  2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE('
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                  2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 END =1 AND "OS"."ACCTNUM" IS NOT NULL AND
                  "OS"."AVIEWORIGIN_REFID" IS NOT NULL)
    Published by: Chaitanya on June 9, 2011 02:44

    Published by: Chaitanya on June 9, 2011 02:47

    When it is executed individually, MERGE LOGIC 1 and LOGIC of MERGE 2 take about ten for a daterange of 30 days data.

    BUT FULL is to get the scores of APR - JUN, INCR becomes partitions for MAY so not both 30 days.
    Are compare us like with like?

  • DECODE does not work in the WHERE clause when subquery returns more than one line

    Hi gurus,

    I want to write a query against the table CCENTERS (Script given below) and wait for the following result:

    1. in the transition from a value of 0 for the ID, it returns all the rows in the table.
    2. in the passage of one value other than 0, it returns the row corresponding to the given value and all its records of the child.

    CCENTER has parent-child relationship in the column ID and the BASE. I use a query with the DECODE function. but the function in the WHERE clause is not capable of managing the subquery with multiple lines of DECODE.

    *************************************************
    VARIABLE ParaCCenter NUMBER

    BEGIN
    : paraccenter: = 0;
    END;
    /

    CREATE TABLE ccenters
    (id NUMBER,
    name VARCHAR2 (20).
    number base);

    INSERT INTO ccenters VALUES(1,'NUST',null);
    INSERT INTO ccenters VALUES(2,'SEECS',1);
    INSERT INTO ccenters VALUES(3,'NBS',1);
    commit;

    SELECT * from ccenters
    WHERE id IN DECODE(:ParaCCenter, 0, id,)
    (SELECT id FROM ccenters
    START WITH basic =: ParaCCenter
    ID of CONNECTION BY PRIOR = base
    UNION
    SELECT: ParaCCenter OF double
    )
    )
    /
    BEGIN
    : paraCCenter: = 1;
    END;
    /

    SELECT * from ccenters
    WHERE id IN DECODE(:ParaCCenter, 0, id,)
    (SELECT id FROM ccenters
    START WITH basic =: ParaCCenter
    ID of CONNECTION BY PRIOR = base
    UNION
    SELECT: ParaCCenter double))
    /
    The result is
    (SELECT id FROM ccenters
    *
    ERROR at line 3:
    ORA-01427: einreihig subquery returns multiple rows

    How this query can be rewritten for the given feature. Any response will be appreciated.

    Thank you

    Try something like this:

    SELECT * FROM ccenters
    WHERE :ParaCCenter = 0
    OR id in
      (SELECT id FROM ccenters
       START WITH base=:ParaCCenter
       CONNECT BY PRIOR id = base
       UNION
       SELECT :ParaCCenter FROM dual
      )
    
  • Trouble using a function in the where clause

    Hello

    I use a function that is located at ask.tom.oracle.com, which converts a long data type in a character. The function returns an error when it is placed in the where clause. The sql statement, the error message and the function of asking tom are listed below. Does anyone know how to fix this?


    < pre >

    SELECT A.FLDPHYSICAL,
    A.FLDEXPOSURE,
    A.FLDDATEDUE,
    A.FLDDATELAST,
    A.FLDEMPLOYEE,
    B.FLDBDATE,
    B.FLDMAILSTOP,
    B.FLDREC_NUM,
    B.FLDLNAME,
    B.FLDMI,
    B.FLDFNAME,
    B.FLDBDATE,
    B.FLDDEPT,
    B.FLDSTATUS,
    B.FLDSSN,
    B.FLDHOMEPHON,
    B.FLDWORKPHON,
    B.FLDID,
    B.FLDDIVISION

    OF REQEXAM,.
    B OF THE EMPLOYEE,
    C EMPLOYEE_MEMO
    WHERE A.FLDEMPLOYEE = B.FLDREC_NUM
    AND b.flduserstr = c.fldrec_num
    AND OHM_PKG. GET_LONG ('EMPLOYEE_MEMO', 'FLDDATA', C.ROWID) AS ' % CDL YES % '.
    "AND A.FLDDATEDUE > 1 January 1900"
    AND A.FLDPHYSICAL = 'COP '.
    ORDER OF B.FLDDIVISION,
    B.FLDLNAME,
    B.FLDFNAME,
    B.FLDMI,
    A.FLDDATEDUE

    -------------------------------------------------------------------------
    The error message

    Error in the command line: 26 column: 4
    Error report:
    SQL error: ORA-00904: "OHM_PKG." "" GET_LONG ": invalid identifier
    00904, 00000 - '% s: invalid identifier '.



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

    create or replace
    PACKAGE OHM_PKG AS

    / * TODO type (types, exceptions, methods etc.) package declarations here * /.
    getlong function (p_tname in varchar2, p_cname in varchar2, p_rowid in rowid) return varchar2;

    END OHM_PKG;

    create or replace
    PACKAGE BODY OHM_PKG AS

    getlong function (p_tname in varchar2, p_cname in varchar2, p_rowid in rowid) return varchar2 as
    whole l_cursor default dbms_sql.open_cursor;
    number of l_n;
    l_long_val varchar2 (4000);
    number of l_long_len;
    number of l_buflen: = 4000;
    l_curpos number: = 0;
    Start
    DBMS_SQL. Parse (l_cursor,
    "select" | p_cname | 'from ' | p_tname |
    ' where rowid =: x',.
    DBMS_SQL.native);
    DBMS_SQL.bind_variable (l_cursor, ': x', p_rowid);

    DBMS_SQL.define_column_long (l_cursor, 1);
    l_n: = dbms_sql.execute (l_cursor);

    If (dbms_sql.fetch_rows (l_cursor) > 0)
    then
    DBMS_SQL.column_value_long (l_cursor, 1, l_buflen, l_curpos,)
    (l_long_val, l_long_len);
    end if;
    DBMS_SQL.close_cursor (l_cursor);
    Return l_long_val;
    getLong end;

    END OHM_PKG;

    < / prev >

    Remove the '_' in the name of the function as below:

    AND OHM_PKG. GETLONG('EMPLOYEE_MEMO', 'FLDDATA', C.ROWID) AS "CDL % YES % '.

  • How to compare in Where clause

    Hello

    I need help comparing the value in where clause


    There is a table called productivity which has columns as
    OBJECT_TYPE, COMPLEXITY, OBJECTIVE


    Now my requirement is I have a query like this


    SELECT
    PRO. PROJECT NAME,
    POBJ. OBJECT_NAME,
    POBJ.COMPLEXITY,
    PRO. EFFORT
    Of
    PROJECT PRO, PROJECT_OBJECTS POBJ
    WHERE
    PRO.ID = POBJ.ID

    I have to compare data between the effort of columns in the query and target in the table of productivity

    SELECT
    PRO. PROJECT NAME,
    POBJ. OBJECT_NAME,
    POBJ. OBJECT_TYPE,
    POBJ.COMPLEXITY,
    PRO. EFFORT
    Of
    PROJECT PRO, PROJECT_OBJECTS POBJ
    WHERE
    PRO.ID = POBJ.PRO_ID



    now I change the query to compare


    SELECT
    PRO. PROJECT NAME,
    POBJ. OBJECT_NAME,
    POBJ.COMPLEXITY,
    -case when
    POBJ. OBJECT_TYPE IN (SELECT OBJECT_TYPE OF PRODUCTIVITY) AND
    POBJ.COMPLEXITY (SELECT COMPLEXITY OF PRODUCTIVITY)
    PRO. EFFORT > (SELECT GOAL OF PRODUCTIVITY WHERE type_objet =? AND
    COMPLEXITY =? ) / / here instead of? I have to say
    POBJ. OBJECT_TYPE and POBJ.COMPLEXITY
    then
    10
    ON THE OTHER
    0
    END "Effort."
    Of
    PROJECT PRO, PROJECT_OBJECTS POBJ
    WHERE
    PRO.ID = POBJ.PRO_ID


    How to specify this POBJ column. OBJECT_TYPE and POBJ.COMPLEXITY in please of? I put please suggest.

    Is there a way where we can spend the value of POBJ. OBJECT_TYPE and POBJ.COMPLEXITY to a variable binding and select it in the where clause

    Indicate please let me know if this issue is not understood.


    Thank you
    Sudhir

    Something like that, maybe?

    SELECT PRO.PROJECT_NAME,
           POBJ.OBJECT_NAME,
           POBJ.COMPLEXITY,
           case when PRO.EFFORT > PROD.GOAL
                     then 10
                ELSE 0
           END "Effort"
    FROM   PROJECTS PRO,
           PROJECT_OBJECTS POBJ,
           PRODUCTIVITY PROD
    WHERE  PRO.ID = POBJ.PRO_ID
    AND    POBJ.OBJECT_TYPE = PROD.OBJECT_TYPE (+)
    AND    POBJ.COMPLEXITY = PROD.COMPLEXITY (+)
    

    I did an outer join; don't know if that's what you want - if not, just get rid of the (+) {noformat} {noformat}

  • Outer joins and null in the 'where' clause condition

    Hi people,

    Please help me on this.

    Here's my query.

    with x

    (select 'a' as a dual union all col1)

    Select 'b' as col1 of union double all the

    Select 'c' as double col1

    ),

    y as

    (

    Select 'b' as col2 from dual Union all the

    Select 'c' as col2 from dual Union all the

    Select would be "as col2 from dual Union all the"

    Select 'e' as col2 from dual

    )

    Select * x y right outer join

    on x.col1 = y.col2 and y.col2 is null

    Get all the lines of 'COL1' as null. Why like this?

    Just add the condition to the WHERE clause for example

    WITH x AS
    (SELECT 'a' AS col1 FROM dual UNION ALL
    SELECT 'b' AS col1 FROM dual UNION ALL
    SELECT 'c' AS col1 FROM dual
    ),
    y AS
    (
    SELECT 'b' AS col2 FROM dual UNION ALL
    SELECT 'c' AS col2 FROM dual UNION ALL
    SELECT 'd' AS col2 FROM dual UNION ALL
    SELECT 'e' AS col2 FROM dual
    )
    SELECT * FROM x LEFT OUTER JOIN y
    ON x.col1=y.col2                     ----want to add "and y.col2 is null " condition to get value "a"
    where y.col2 is null
    
  • T/t with the WHERE clause using a list breaks

    Hello, all,.

    I have a project where I need to use a list as part of the WHERE clause for a t/t, and it is breaking.  I don't know what I'm doing wrong.

    For some pseudo-code, do I have a complete query of a database called 'people '.  A list of values for the t/t with the first query; the second query is my t/t:

    <cfquery name="getDIR" datasource="#request.THISDSN#">
        SELECT thisName dir FROM orgs WHERE thisID in (<cfqueryparam value="#form.org#" cfsqltype="cf_sql_varchar" list="yes" />)
    </cfquery>
    
    <cfquery name="people" database="people">
        SELECT colA, colB, colC, colD
        FROM people
        WHERE 1=1
            AND (
                div IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                OR dir IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                )
    </cfquery>
    
    
    

    I get the error message is "t/t syntax error: encountered" div IN \'thisValue\' ".»  Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition. »

    Can support _not_ QoQ lists of WHERE clauses?

    V/r,

    ^_^

    SMH - so much... I just found.

    I forgot to give the lists in the second query bracket.


    (The pseudocode was manually typed, since my dev system is isolated from the internet, and I added the in my pseudo code when they were not in my original code.)

    * headdesk * headdesk * headdesk * headdesk *.

    V/r,

    ^_^

  • by the way check box values in the WHERE clause

    Hello

    I created a data block - 'CONTACT' (block of data in database)

    and has an element of database - 'Code', 'Descr '.

    The number of records displayed has the value 5.

    When enabled - value 'Y '.

    Value when disabled - n

    Box mapping of other values - "unchecked."


    I write the code inside "WHEN the BUTTON PRESS. My main goal is to return the number of records from

    According to several conditions and one among them is the CODE which can be single or multiple based on the checked checkbox.

    The requirement is when I check one or more boxes, I should pass the "Code" element values in the WHERE clause.

    I tried to use the simple loop but things havmt worked as shown below.

    The next_record refers to the COCHEE BOX as well, and thus return all the eventhough lines if it is not checked.

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

    -LOOP

    IF: contact.cb = 'Y' THEN

    LOOP

    IF p_where is null then

    p_where: =: contact.code;

    on the other

    p_where: = p_where | «, » || : contact.code;

    end if;

    When the output: system.last_record = "TRUE";

    next_record;

    END LOOP;

    end if;

    -END LOOP;

    MESSAGE ("p_where :'|| p_where);

    MESSAGE (' ');

    END;


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

    And even if I write the LOOP before the first CASE, it returns me the current value and move to the last record.

    Please suggest

    Try something like this:

    FIRST_RECORD;
    
    LOOP
    
      IF :contact.cb = 'Y' THEN
        IF p_where is null then
           p_where := :contact.code;
         else
           p_where := p_where ||','||:contact.code;
         end if;
       END IF;
      exit when :system.last_record = 'TRUE';
      next_record;
    END LOOP;
    
    -- END LOOP;
    MESSAGE ( 'p_where :'||p_where);
    MESSAGE (' ');
    
    END;
    
  • DECODE inside the WHERE clause

    Hi all:

    I can't get the DECODE statement to work inside my WHERE clause. I have read the information on
    Tahiti.Oracle.com
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions049.htm#i1017437

    But still can not get it to work. Initially, I had he works as dynamic SQL and then run that string, but I am not allowed to use dynamic SQL statements and to do 'Real' PL/SQL.

    I have the following WHERE clause (more info after the WHERE clause)
    WHERE 
         a.ebiz_asn_no(+) = te.ebiz_cntrl_no
         AND w.ebiz_work_no(+) = te.ebiz_cntrl_no
         AND o.ebiz_ord_no(+) = ebiz_cntrl_no
         AND t.ebiz_trailer_no(+) = te.ebiz_trailer_no
         AND ms.ebiz_sku_no(+) = te.ebiz_sku_no 
         AND NVL(ms.ebiz_sku_no, -1) = NVL(p_SKU, nvl(ms.ebiz_sku_no, -1))
         AND tl.ebiz_lp_no(+) = te.ebiz_lp_no 
         AND NVL(te.ebiz_lp_no, -1) = NVL(p_LP, nvl(te.ebiz_lp_no, -1))
         AND eu.ebiz_user_no(+) = te.act_ebiz_user_no 
         AND NVL(te.act_ebiz_user_no, -1) = NVL(p_UserID, NVL(te.act_ebiz_user_no, -1))
         AND NVL(te.begin_location, '~') = NVL(p_BeginLocation, NVL(te.begin_location, '~')) 
         AND NVL(te.end_location, '~') = NVL(p_EndLocation, NVL(te.end_location, '~')) 
         AND te.comp_id = p_CompID 
         AND te.site_id = p_SiteID 
         AND INSTR('' || p_TaskType || '', te.task_type) > 0 
         AND NVL(task_priority, -1) = NVL(p_Priority, NVL(task_priority, -1)) 
         AND NVL(te.ebiz_cntrl_no, -1) = DECODE(te.task_type, 'IULD', DECODE(p_Order, null, te.ebiz_cntrl_no, ebiz_po2asn.get_ebiz_po_no(p_Order)), NVL(p_Order, NVL
                           (te.ebiz_cntrl_no,-1)))
         AND NVL(te.batch_no,'~') = NVL(p_Batch, NVL(te.batch_no, '~'))
         AND NVL(te.ebiz_wave_no, -1) = NVL(p_Wave, NVL(te.ebiz_wave_no, -1)) 
         || whereClauseStatus 
         || whereClauseFromDate 
         || whereClauseToDate;
    As you can see, initially I was adding values of "whereClauseStatus, whereClauseFromDate, whereClauseToDate" and it has been defined with the following PL/SQL code:
         IF(p_TaskStatus = 'C') THEN
              -------------------------------------------------------------------------------------------
              --     Set From Date Clause
              -------------------------------------------------------------------------------------------
              IF(p_FromShipDate IS NOT NULL) THEN
                   whereClauseFromDate := ' AND TRUNC(te.act_end_date) >= TO_DATE(''' || p_FromShipDate || ''',''MM/dd/yyyy'') ';
              END IF;
              -------------------------------------------------------------------------------------------
              --     Set To Date Clause
              -------------------------------------------------------------------------------------------
              IF (p_ToShipDate IS NOT NULL) THEN
                   whereClauseToDate := ' AND TRUNC(te.act_end_date) <= TO_DATE(''' || p_ToShipDate || ''',''MM/dd/yyyy'') ';
              END IF;
         ELSE
              -------------------------------------------------------------------------------------------
              --     Incomplete and All statuses are filtered on the currdate
              -------------------------------------------------------------------------------------------
              -------------------------------------------------------------------------------------------
              --     Set From Date Clause
              -------------------------------------------------------------------------------------------
              IF(p_FromShipDate IS NOT NULL) THEN
                   whereClauseFromDate := ' AND TRUNC(te.currdate) >= TO_DATE(''' || p_FromShipDate || ''',''MM/dd/yyyy'') ';
              END IF;
              -------------------------------------------------------------------------------------------
              --     Set To Date Clause
              -------------------------------------------------------------------------------------------
              IF (p_ToShipDate IS NOT NULL) THEN
                   whereClauseToDate := ' AND TRUNC(te.currdate) <= TO_DATE(''' || p_ToShipDate || ''',''MM/dd/yyyy'') ';
              END IF;
         END IF;
         
    
         IF (p_TaskStatus = 'I') THEN
              whereClauseStatus := ' AND act_end_date IS NULL ';
         ELSIF (p_TaskStatus = 'C') THEN
              whereClauseStatus := ' AND act_end_date IS NOT NULL ';
         ELSE
              whereClauseStatus := '';
         END IF;
    I have serious problems getting the DECODE statement to replace the three variables in the annex.

    Any help would be greatly appreciated.

    Thank you
    Andy

    Published by: BluShadow on August 2, 2011 15:11
    addition of {noformat}
    {noformat} tags for clarity. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    I'll take a wild shot in the dark, and suggests that it is perhaps what you are looking for...

    WHERE
         a.ebiz_asn_no(+) = te.ebiz_cntrl_no
         AND w.ebiz_work_no(+) = te.ebiz_cntrl_no
         AND o.ebiz_ord_no(+) = ebiz_cntrl_no
         AND t.ebiz_trailer_no(+) = te.ebiz_trailer_no
         AND ms.ebiz_sku_no(+) = te.ebiz_sku_no
         AND NVL(ms.ebiz_sku_no, -1) = NVL(p_SKU, nvl(ms.ebiz_sku_no, -1))
         AND tl.ebiz_lp_no(+) = te.ebiz_lp_no
         AND NVL(te.ebiz_lp_no, -1) = NVL(p_LP, nvl(te.ebiz_lp_no, -1))
         AND eu.ebiz_user_no(+) = te.act_ebiz_user_no
         AND NVL(te.act_ebiz_user_no, -1) = NVL(p_UserID, NVL(te.act_ebiz_user_no, -1))
         AND NVL(te.begin_location, '~') = NVL(p_BeginLocation, NVL(te.begin_location, '~'))
         AND NVL(te.end_location, '~') = NVL(p_EndLocation, NVL(te.end_location, '~'))
         AND te.comp_id = p_CompID
         AND te.site_id = p_SiteID
         AND INSTR('' || p_TaskType || '', te.task_type) > 0
         AND NVL(task_priority, -1) = NVL(p_Priority, NVL(task_priority, -1))
         AND NVL(te.ebiz_cntrl_no, -1) = DECODE(te.task_type, 'IULD', DECODE(p_Order, null, te.ebiz_cntrl_no, ebiz_po2asn.get_ebiz_po_no(p_Order)), NVL(p_Order, NVL
                           (te.ebiz_cntrl_no,-1)))
         AND NVL(te.batch_no,'~') = NVL(p_Batch, NVL(te.batch_no, '~'))
         AND NVL(te.ebiz_wave_no, -1) = NVL(p_Wave, NVL(te.ebiz_wave_no, -1))
         AND TRUNC(te.act_end_date) >= NVL(TO_DATE(p_FromShipDate,'MM/dd/yyyy'),TRUNC(te.act_end_date))
            AND TRUNC(te.act_end_date) <= NVL(TO_DATE(p_ToShipDate,'MM/dd/yyyy'),TRUNC(tw.act_end_date))
            AND TRUNC(te.currdate) >= NVL(TO_DATE(p_FromShipDate,'MM/dd/yyyy'),TRUNC(te.currdate))
         AND TRUNC(te.currdate) <= NVL(TO_DATE(p_ToShipDate,'MM/dd/yyyy'),TRUNC(te.currdate))
            AND (  (act_end_date IS NULL AND p_TaskStatus = 'I')
                OR (act_end_date IS NOT NULL AND p_TaskStatus = 'C')
                OR p_TaskStatus NOT IN ('I','C')
                )
    

    Published by: BluShadow on August 2, 2011 16:27
    spleen the last clause. Oops.

  • Beginner: Get on the WHERE clause syntax error in SELECT

    I am very new to php and mySQL.  Use DW master/detail to generate Basic code I need.  One thing I have to do is to modify a select statement in the master to include a WHERE clause to limit the selection to a particular value in a field.

    I get a syntax error with the select statement in the WHERE clause, I add to the map.

    It's the part of the error message showing the location of the error:

    "WHERE group = 'Community' LIMIT 0, 10'"

    Php that generated the select is:

    $query_maps = "SELECT * FROM tblmaps ORDER BY tblmaps.» DispSeq ';

    $query_limit_maps = sprintf ("%s WHERE group =' LIMIT %s %d, %d", $query_maps, $selectGroup, $startRow_maps, $maxRows_maps);

    This approach to create the select statement is on the generated code for the master page.  He added the LIMIT clause.  I didn't add the ' WHERE group = '%s' and the variable $selectGroup, which comes from the old code.»  You can see that the $selectGroup variable is equal to the "community: group.»

    I scanned the web to see what syntax error, I could do, but haven't found anything that explains it.

    The resolved full select statement is:

    SELECT * FROM tblmaps ORDER BY tblmaps. WHERE DispSeq = 'Community' LIMIT 0,10 group

    What I don't see?

    Tom

    The group is a reserved word in MySQL. You could probably put single quotes around it, but I suggest to rename this column. Do not use reserved words for column names.

  • Session variable in the WHERE clause of the SQL statement

    Hey all,.

    I was wonering just if there is a way to set the WHERE clause of the query that the session variable?  I have the following so far and have tried to go through a ton of tutorials, but it doesn't seem to work.  Is it still possible?  I don't know what follows is wrong, but can someone help me with changing the following code, or pointing me to a good tutorial?  (I write it with PHP)

    $query = "SELECT * from members where user_id = ' $_SESSION ['members']";

    Thanks for your help.

    $member = "-1";
    If (isset($_SESSION['members'])) {}
    $member = $_SESSION ['members'];

    }
    $query = "SELECT * from members where user_id = $member;

Maybe you are looking for

  • My friend 5s IPhone uses a ridiculous amount of storage for photos

    My friend iPhone keeps running out of memory (Yes, it's a 5s with 16 gigabytes). The biggest memory hog's Photos, which use 7.1 GB for storage of photos. The problem is, this is a ridiculous amount: there only 30 pictures! (For comparison, my iPhone

  • Logos that are still using 6001 in Windows 7 64

    We seem to still have a case in a 64-bit windows system 7 where the installation OR use ports 6001 and 6002 (which are required by Safenet). The update of the register: HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\Logos\Ports\FirstClientPort = 50

  • Hi, can someone please let me know in detail the Management server and server of specialty?

    Hello Can you get it someone please let me know the full details on the administration server (M.S) and specialty Server (uninsured)? What exactly is a Management Server? What he does? Features of the administration server? How many CAL can be instal

  • How can I activate my printer spooler

    Hello, I am currently using Windows XP Home Edition and I was attacked by a Trojan virus. I could get the PC in safe mode and by installing an anti-malware program, but for some reason that I can't print more than the laptop. Whenever I try to instal

  • HP Deskjet all-in-One Printer - CX027A 2510

    Have tried all the troubleshooting availabe and program patches.  Will not print black. Download blue grey or very light print.  The cartridge is almost full.