Where clause for TaskLOVVO on OTL Timecard

Hi,
Following is the customization on our OTL timecard layout(Projects and Payroll Layout):
->Extended TaskLOVVO and based on a value selected in TaskLOV, i am defaulting Hours type.
The dynamic where clause for the TaskLOVO is taken care of by the below QUALIFIER_ATTRIBUTES(Same as seeded layout)
QUALIFIER_ATTRIBUTE14 = "HxcCuiTaskProjectId|PROJECT|Y#HxcCuiTaskProjectNumber|PROJECT-DISPLAY|Y"
QUALIFIER_ATTRIBUTE15 = "project_id = ::HxcCuiTaskProjectId#upper(project_number) = upper(::HxcCuiTaskProjectNumber)"
But in some scenarios the dynamic layout is not getting appended to TaskLOVO and the query behind the TaskLOV is pulling too many records.
This issue is happening on Fridays when around 15000 employees submit the timecards, as Friday is our deadline for Timecard submission.
I have tried different scenarios to replicate this issue in test intances but I am not able to replicate it.
Please suggest what could be the issue and why is the whereclause is not getting appended in some scenarios.
Thank you

Hi,
Thank you for your reply.
The whoole LDT file is more than 30000 characters, which is not allowed in the post, so I have included only the lines which have customization.
FYI: This is a Projects and Payroll layout.
Following is my LDT file:
# $Header: hxczzhxclayt0093.ldt 120.0 2008/02/08 09:26:10 bbayragi noship $
# dbdrv: exec fnd bin FNDLOAD bin &phase=dat+10 checkfile:~PROD:~PATH:~FILE &ui_apps 0 Y UPLOAD @HXC:patch/115/import/hxclaytlayoutsld.lct @~PROD:~PATH/~FILE
LANGUAGE = "US"
LDRCONFIG = "hxclaytlayoutsld.lct 120.0"
#Source Database seed121
#RELEASE_NAME 12.1.0
# -- Begin Entity Definitions --
BEGIN HXC_LAYOUT_COMPONENTS
"Projects Details Alternate Timecard Layout - Project"
OWNER = "ORACLE12.1.0"
COMPONENT_VALUE = "PROJECT"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_CODE_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "HXC_TIMECARD_PROJECT"
ATTRIBUTE_CODE_APP_SHORT_NAME = "HXC"
SEQUENCE = "200"
COMPONENT_DEFINITION = "LOV"
RENDER_TYPE = "WEB"
PARENT_COMPONENT = "Projects Details Alternate Timecard Layout - Day Scope Building blocks for worker timecard matrix"
LAST_UPDATE_DATE = "2004/05/24"
BEGIN HXC_LAYOUT_COMP_QUALIFIERS
"Projects Details Alternate Timecard Layout - Project"
OWNER = "ORACLE12.1.0"
QUALIFIER_ATTRIBUTE_CATEGORY = "LOV"
QUALIFIER_ATTRIBUTE1 = "ProjectLOVVO"
QUALIFIER_ATTRIBUTE2 = "N"
QUALIFIER_ATTRIBUTE3 = "HXC_CUI_PROJECT_DETAILS_LOV"
QUALIFIER_ATTRIBUTE4 = "809"
QUALIFIER_ATTRIBUTE5 = "25"
QUALIFIER_ATTRIBUTE6 = "HxcCuiProjectDetails|PROJECT-DISPLAY|CRITERIA|N|HxcCuiProjectId|PROJECT|RESULT|N|HxcCuiProjectDetails|PROJECT-DISPLAY|RESULT|N|HxcCuiProjectCoOrgId|LOCATION1|RESULT|N|HxcCuiProjectName|CNAME|RESULT|N"
QUALIFIER_ATTRIBUTE8 = "ProjectDetails"
QUALIFIER_ATTRIBUTE9 = "ProjectId#NUMBER"
QUALIFIER_ATTRIBUTE10 = "oracle.apps.hxc.selfservice.timecard.server.ProjectLOVVO"
QUALIFIER_ATTRIBUTE11 = "RESOURCE_IDENTIFIER_ID"
QUALIFIER_ATTRIBUTE17 = "OraTableCellText"
QUALIFIER_ATTRIBUTE20 = "N"
QUALIFIER_ATTRIBUTE21 = "Y"
QUALIFIER_ATTRIBUTE22 = "L"
QUALIFIER_ATTRIBUTE25 = "FLEX"
QUALIFIER_ATTRIBUTE26 = "PROJECTS"
QUALIFIER_ATTRIBUTE27 = "Attribute1"
QUALIFIER_ATTRIBUTE28 = "PROJECT"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_QUALIFIERS
END HXC_LAYOUT_COMPONENTS
BEGIN HXC_LAYOUT_COMPONENTS
"Projects Details Alternate Timecard Layout - Task"
OWNER = "ORACLE12.1.0"
COMPONENT_VALUE = "TASK"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_CODE_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "HXC_TIMECARD_TASK"
ATTRIBUTE_CODE_APP_SHORT_NAME = "HXC"
SEQUENCE = "210"
COMPONENT_DEFINITION = "LOV"
RENDER_TYPE = "WEB"
PARENT_COMPONENT = "Projects Details Alternate Timecard Layout - Day Scope Building blocks for worker timecard matrix"
LAST_UPDATE_DATE = "2004/05/24"
BEGIN HXC_LAYOUT_COMP_PROMPTS "HxcCuiTaskProjectId" "AK_PROMPT"
OWNER = "ORACLE12.1.0"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "HXC_TIMECARD_PROJECT"
ATTRIBUTE_APP_SHORT_NAME = "HXC"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_PROMPTS
BEGIN HXC_LAYOUT_COMP_QUALIFIERS
"Projects Details Alternate Timecard Layout - Task"
OWNER = "ORACLE12.1.0"
QUALIFIER_ATTRIBUTE_CATEGORY = "LOV"
QUALIFIER_ATTRIBUTE1 = "TaskLOVVO"
QUALIFIER_ATTRIBUTE2 = "N"
QUALIFIER_ATTRIBUTE3 = "HXC_CUI_TASK_DETAILS_LOV"
QUALIFIER_ATTRIBUTE4 = "809"
QUALIFIER_ATTRIBUTE5 = "10"
QUALIFIER_ATTRIBUTE6 = "HxcCuiTaskDetails|TASK-DISPLAY|CRITERIA|N|HxcCuiTaskProjectId|PROJECT|PASSIVE_CRITERIA|Y|HxcCuiTaskId|TASK|RESULT|N|HxcCuiTaskDetails|TASK-DISPLAY|RESULT|N|HxcCuiTaskBillableFlag|EXPTYPE|RESULT|N"
QUALIFIER_ATTRIBUTE8 = "TaskDetails"
QUALIFIER_ATTRIBUTE9 = "TaskId#NUMBER"
QUALIFIER_ATTRIBUTE10 = "oracle.apps.hxc.selfservice.timecard.server.TaskLOVVO"
QUALIFIER_ATTRIBUTE11 = "RESOURCE_IDENTIFIER_ID|TIMECARD_BIND_END_DATE"
QUALIFIER_ATTRIBUTE14 = "HxcCuiTaskProjectId|PROJECT|Y#HxcCuiTaskProjectNumber|PROJECT-DISPLAY|Y"
QUALIFIER_ATTRIBUTE15 = "project_id = ::HxcCuiTaskProjectId#upper(project_number) = upper(::HxcCuiTaskProjectNumber)"
QUALIFIER_ATTRIBUTE17 = "OraTableCellText"
QUALIFIER_ATTRIBUTE20 = "N"
QUALIFIER_ATTRIBUTE21 = "Y"
QUALIFIER_ATTRIBUTE22 = "L"
QUALIFIER_ATTRIBUTE25 = "FLEX"
QUALIFIER_ATTRIBUTE26 = "PROJECTS"
QUALIFIER_ATTRIBUTE27 = "Attribute2"
QUALIFIER_ATTRIBUTE28 = "TASK"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_QUALIFIERS
END HXC_LAYOUT_COMPONENTS
BEGIN HXC_LAYOUT_COMPONENTS
"Projects Details Alternate Timecard Layout - Location"
OWNER = "CUSTOM"
COMPONENT_VALUE = "LOCATION"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_CODE_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "HXC_CUI_LOCATION_LABEL"
ATTRIBUTE_CODE_APP_SHORT_NAME = "HXC"
SEQUENCE = "215"
COMPONENT_DEFINITION = "CHOICE_LIST"
RENDER_TYPE = "WEB"
PARENT_COMPONENT = "Projects Details Alternate Timecard Layout - Day Scope Building blocks for worker timecard matrix"
LAST_UPDATE_DATE = "2004/05/24"
BEGIN HXC_LAYOUT_COMP_QUALIFIERS "Projects Details Alternate Timecard Layout - Location"
OWNER = "CUSTOM"
QUALIFIER_ATTRIBUTE_CATEGORY = "CHOICE_LIST"
QUALIFIER_ATTRIBUTE1 = "Custom2VO"
QUALIFIER_ATTRIBUTE4 = "N"
# QUALIFIER_ATTRIBUTE5 = "10"
# QUALIFIER_ATTRIBUTE8 = "DisplayValue"
# QUALIFIER_ATTRIBUTE9 = "Value#NUMBER"
QUALIFIER_ATTRIBUTE10 = "oracle.apps.hxc.selfservice.timecard.server.Custom2VO"
QUALIFIER_ATTRIBUTE17 = "OraTableCellText"
QUALIFIER_ATTRIBUTE20 = "N"
QUALIFIER_ATTRIBUTE21 = "Y"
QUALIFIER_ATTRIBUTE22 = "L"
QUALIFIER_ATTRIBUTE25 = "FLEX"
QUALIFIER_ATTRIBUTE26 = "Dummy Element Context"
QUALIFIER_ATTRIBUTE27 = "Attribute15"
QUALIFIER_ATTRIBUTE28 = "LOCATION1"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_QUALIFIERS
END HXC_LAYOUT_COMPONENTS
BEGIN HXC_LAYOUT_COMPONENTS "Projects Details Alternate Timecard Layout - Expenditure Type"
OWNER = "ORACLE"
COMPONENT_VALUE = "EXPENDITURETYPE"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_CODE_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "HXC_TIMECARD_EXPTYPE"
ATTRIBUTE_CODE_APP_SHORT_NAME = "HXC"
SEQUENCE = "225"
COMPONENT_DEFINITION = "PACKAGE_CHOICE_LIST"
RENDER_TYPE = "WEB"
PARENT_COMPONENT = "Projects Details Alternate Timecard Layout - Day Scope Building blocks for worker timecard matrix"
LAST_UPDATE_DATE = "2004/05/23"
BEGIN HXC_LAYOUT_COMP_QUALIFIERS "Projects Details Alternate Timecard Layout - Expenditure Type"
OWNER = "ORACLE"
QUALIFIER_ATTRIBUTE_CATEGORY = "PACKAGE_CHOICE_LIST"
QUALIFIER_ATTRIBUTE1 = "BOLINF.XXHXC_TYPE_CHOICE.EXPTTYPE"
QUALIFIER_ATTRIBUTE2 = "@RESOURCE_IDENTIFIER_ID|@TIMECARD_BIND_END_DATE"
QUALIFIER_ATTRIBUTE4 = "N"
QUALIFIER_ATTRIBUTE8 = "aliasname"
QUALIFIER_ATTRIBUTE9 = "value#NUMBER"
QUALIFIER_ATTRIBUTE20 = "N"
QUALIFIER_ATTRIBUTE21 = "Y"
QUALIFIER_ATTRIBUTE22 = "R"
QUALIFIER_ATTRIBUTE24 = "ET_EXPENDITURE_TYPE"
QUALIFIER_ATTRIBUTE25 = "FLEX"
QUALIFIER_ATTRIBUTE26 = "OTL_ALIAS_1"
QUALIFIER_ATTRIBUTE27 = "Attribute1"
QUALIFIER_ATTRIBUTE28 = "EXPTYPE"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_QUALIFIERS
END HXC_LAYOUT_COMPONENTS
BEGIN HXC_LAYOUT_COMPONENTS "Projects Details Alternate Timecard Layout - Customer name"
OWNER = "ORACLE"
REGION_CODE = "HXC_CUI_TIMECARD"
REGION_CODE_APP_SHORT_NAME = "HXC"
ATTRIBUTE_CODE = "XXTW_HXC_TIMECARD_CUST_NAME"
ATTRIBUTE_CODE_APP_SHORT_NAME = "HXC"
SEQUENCE = "205"
COMPONENT_DEFINITION = "TEXT_FIELD"
RENDER_TYPE = "WEB"
PARENT_COMPONENT = "Projects Details Alternate Timecard Layout - Day Scope Building blocks for worker timecard matrix"
LAST_UPDATE_DATE = "2004/05/24"
BEGIN HXC_LAYOUT_COMP_QUALIFIERS "Projects Details Alternate Timecard Layout - Customer name"
OWNER = "ORACLE"
QUALIFIER_ATTRIBUTE_CATEGORY = "TEXT_FIELD"
QUALIFIER_ATTRIBUTE1 = "N"
QUALIFIER_ATTRIBUTE2 = "Y"
QUALIFIER_ATTRIBUTE3 = "20"
QUALIFIER_ATTRIBUTE4 = "1"
QUALIFIER_ATTRIBUTE5 = "20"
QUALIFIER_ATTRIBUTE7 = "OraTableCellText"
QUALIFIER_ATTRIBUTE17 = "NONE"
QUALIFIER_ATTRIBUTE20 = "Y"
QUALIFIER_ATTRIBUTE21 = "Y"
QUALIFIER_ATTRIBUTE22 = "L"
QUALIFIER_ATTRIBUTE25 = "FLEX"
QUALIFIER_ATTRIBUTE26 = "PROJECTS"
QUALIFIER_ATTRIBUTE27 = "Attribute9"
QUALIFIER_ATTRIBUTE28 = "CNAME"
QUALIFIER_ATTRIBUTE30 = "Y"
LAST_UPDATE_DATE = "2004/05/24"
END HXC_LAYOUT_COMP_QUALIFIERS
END HXC_LAYOUT_COMPONENTS
And the query in TASKLOVVO:
SELECT task.task_number tasknumber, task.task_name, task_details taskdetails, task.task_id taskid, bolinf.GETALIASID(proj.project_type,proj.project_id,task.task_id, :1, :2) billable_flag, task.project_id, task.start_date, task.completion_date, task.chargeable_flag, proj.project_number , proj.project_details from pa_online_tasks_v task ,pa_online_projects_v proj where proj.project_id = task.project_id
In the above query GETALIASID is a custom function that returns a value.
Thank you
Edited by: Santo on Mar 18, 2013 2:12 PM

Similar Messages

  • Creating WHERE clause for an outer join using DatabaseFilter

    Hi all,
    I read a post on thie group about constructing the WHERE clause for a RowSet Controls
    SQL Query using the DatabaseFilter and this is what it said:
    ****************************************************************************The
    following example shows adding part of a WHERE clause in an action method of a
    page flow:
    DatabaseFilter.FilterTerm term = new DatabaseFilter.FilterTerm(); term.sColumnName
    = "name"; term.op = DatabaseFilter.opContains; // there are ops for equals, less
    than, etc... term.value = form.getPartialName();
    // You can also add sort terms for an ORDER BY clause allNames = dbControl.getNames(new
    DatabaseFilter(new DatabaseFilter.FilterTerm[] {term}, null));
    I am trying to create a where clause which uses a join like this:
    Select * from x,y where x.id=y.id (+)
    ie. All values from x.id but only corrosponding ones from y.id.
    Is there any way to build this outer join query using the DatabaseFilter class
    or am i forced to use a String which is contruct in my page flow as the where
    clause?like so:
    * @jc:sql command-type="grid"
    * rowset-name="RFPSRowSet"
    * max-rows="1000"
    * statement::
    * SELECT RFPS.RFP_ID,RFPS.NAME AS RFP_NAME,RFPS.FFO_NUMBER,RFPS.RFP_TYPE,RFPS.CFDA_NUMBER,COMPETITIONS.NAME
    AS COMP_NAME,COMPETITIONS.COMPETITION_ID FROM RFPS,COMPETITIONS WHERE {sql: whereClause
    } {sql: filter.getOrderByClause ()}
    public RowSet getAllRfps(java.lang.String whereClause,DatabaseFilter filter)
    throws SQLException;
    and in my pageFlow action, i do the following:
    StringBuffer whereClause= new StringBuffer();
    whereClause.append("RFPS.RFP_ID = COMPETITIONS.RFP_ID (+)");
    if ((form.getRfpTitle() != null) &&
    (!form.getRfpTitle().equalsIgnoreCase("")))
    whereClause.append(" AND UPPER(RFPS.NAME) LIKE %"+form.getRfpTitle().toUpperCase());
    if ((form.getCfdaNumber() != null) &&
    (!form.getCfdaNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.CFDA_NUMBER ="+form.getCfdaNumber());
    if ((form.getFfoNumber() != null) &&
    (!form.getFfoNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.FFO_NUMBER ="+form.getFfoNumber());
    sortFilterService = SortFilterService.getInstance(getRequest());
    DatabaseFilter filter=sortFilterService.getDatabaseFilter(getGridName());
    log.debug("***********"+whereClause.toString()+"***********");
    allRows = searchRfaAndComp.getAllRfps(whereClause.toString(),filter);
    Thanks in advance for your help,
    Regards,
    Vik.

    Thanks for your reply. Just one more question....if we indeed are trying to use
    a simple query and have a where clause like "select * from x where upper(x) like
    {x}", how do we set the UPPER filter on the column using the database filter?
    I see a IDENTIFIER.ISUPPER static field on that DatabaseFilter but am unsure how
    to use it. Would appreciate any pointers .
    Thanks again,
    Vik
    Eddie O'Neil <[email protected]> wrote:
    Vik--
    I believe that the approach that you describe below is the best one
    for dealing with outer joins
    with the DatabaseFilter.
    Apologies for the limitation...
    Eddie
    vik wrote:
    Hi all,
    I read a post on thie group about constructing the WHERE clause fora RowSet Controls
    SQL Query using the DatabaseFilter and this is what it said:
    ****************************************************************************The
    following example shows adding part of a WHERE clause in an actionmethod of a
    page flow:
    DatabaseFilter.FilterTerm term = new DatabaseFilter.FilterTerm(); term.sColumnName
    = "name"; term.op = DatabaseFilter.opContains; // there are ops forequals, less
    than, etc... term.value = form.getPartialName();
    // You can also add sort terms for an ORDER BY clause allNames = dbControl.getNames(new
    DatabaseFilter(new DatabaseFilter.FilterTerm[] {term}, null));
    I am trying to create a where clause which uses a join like this:
    Select * from x,y where x.id=y.id (+)
    ie. All values from x.id but only corrosponding ones from y.id.
    Is there any way to build this outer join query using the DatabaseFilterclass
    or am i forced to use a String which is contruct in my page flow asthe where
    clause?like so:
    * @jc:sql command-type="grid"
    * rowset-name="RFPSRowSet"
    * max-rows="1000"
    * statement::
    * SELECT RFPS.RFP_ID,RFPS.NAME AS RFP_NAME,RFPS.FFO_NUMBER,RFPS.RFP_TYPE,RFPS.CFDA_NUMBER,COMPETITIONS.NAME
    AS COMP_NAME,COMPETITIONS.COMPETITION_ID FROM RFPS,COMPETITIONS WHERE{sql: whereClause
    sql: filter.getOrderByClause ()}* ::
    public RowSet getAllRfps(java.lang.String whereClause,DatabaseFilter
    filter)
    throws SQLException;
    and in my pageFlow action, i do the following:
    StringBuffer whereClause= new StringBuffer();
    whereClause.append("RFPS.RFP_ID = COMPETITIONS.RFP_ID (+)");
    if ((form.getRfpTitle() != null) &&
    (!form.getRfpTitle().equalsIgnoreCase("")))
    whereClause.append(" AND UPPER(RFPS.NAME) LIKE %"+form.getRfpTitle().toUpperCase());
    if ((form.getCfdaNumber() != null) &&
    (!form.getCfdaNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.CFDA_NUMBER ="+form.getCfdaNumber());
    if ((form.getFfoNumber() != null) &&
    (!form.getFfoNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.FFO_NUMBER ="+form.getFfoNumber());
    sortFilterService = SortFilterService.getInstance(getRequest());
    DatabaseFilter filter=sortFilterService.getDatabaseFilter(getGridName());
    log.debug("***********"+whereClause.toString()+"***********");
    allRows = searchRfaAndComp.getAllRfps(whereClause.toString(),filter);
    Thanks in advance for your help,
    Regards,
    Vik.

  • ADF dynamic where clause for VO query using BC

    I'm hoping someone can help me out. I have a read only view object that I want to filter results based on some user choices. For example the user may want to see all results or they may only want to see a much smaller subset. This is for an error dashboard, the smaller subset maybe by application or maybe by application and by error severity. I think I can use a dynamic where clause but I'm not sure, Can someone get me started down the right path, or post an example that I can see.

    Hi user,
    You can use a dynamic where clause for this, but maybe there is a more practical option. Maybe you can have a fixed where clause, but using a bind parameter, like:
    vo.application like :applicationParam. This makes an executeWithParams method available that you can call from your page, and use in the bindings. This parameter you can populate with the results of for example a poplist, with a default value of '%'.
    When you do want to use a dynamic where clause, you will need to add a method to the java code of your application module, and make this method available for the client. In this method, you can use findViewObject to retrieve your VO, use VO.setWhereClause to set the whereclause to what you want, and then call VO.executeQuery. This method can then again be called from the page.
    Success,
    Jeroen van Veldhuizen

  • DATAMOVER: Error: Syntax error in where clause for PSOPRDEFN

    SET LOG C:\PSUSER_HRM.log;
    SET input F:\psoprdefn.dat;
    IMPORT psoprdefn where OPRId = 'PS';
    when i execute this command after importing .dat file from my database i get error:
    Error: Syntax error in where clause for PSOPRDEFN
    any suggestions pls help....
    Thanks
    aravind
    Edited by: 967641 on Nov 20, 2012 11:39 AM
    Edited by: 967641 on Nov 20, 2012 11:40 AM

    That is correct.
    Datamover tries to insert data in PSOPRDEFN and rows exist with these keys.
    To avoid this you can add the following statement in your script:
    SET UPDATE_DUPS;
    This will update the values other than the keys if a row already exists in the database with the keys in the dat file.
    I can advice you to buy the new book of Jim Marion, PeopleSoft PeopleTools Data Management and Upgrade Handbook
    http://www.amazon.com/PeopleSoft-PeopleTools-Management-Upgrade-Handbook/dp/0071787925/ref=sr_1_1?ie=UTF8&qid=1353575734&sr=8-1&keywords=jim+j+marion
    It has an entire chapter on how to use datamover.
    Hakan

  • Dynamic where clause for MULTIPLE values

    In the following of dynamic where clause?
    i have some somewhat different problem.
    Is a dynamic where clause for multiple values possible?
    If the inputvariable varCode1,varCode2,varCode3,varCode4 are 0 then show all id's otherwise filter the resultset on var1 and/or var2,and/or var3,and/or var4.
    Example table:
    create table t
    (d int,var int);
    insert into t values (1 ,1 );
    insert into t values (2 ,1 );
    insert into t values (3 ,2 );
    insert into t values (4 ,3 );
    insert into t values (5 ,4 );
    insert into t values (6 ,4 );
    insert into t values (7 ,4 );
    insert into t values (8 ,4 );
    insert into t values (9 ,5 );
    insert into t values (10, 6);
    insert into t values (11, 6);
    So what i want to change the where clause upon the value of the varCodes. If var1 and var are not 0 a "AND" should be used otherwise an "OR"
    select id
    from tst
    where var = DECODE( :varCode1, 0, var, :varCode1)
    or/and(?) DECODE( :varCode2, 0, var, :varCode2)
    or DECODE( :varCode3, 0, var, :varCode3)
    or DECODE( :varCode4, 0, var, :varCode4)

    Please turn off your Caps Lock
    and try this link
    Dynamic WHERE clause

  • How to construct the where clause for a nested xml target file

    Post Author: jlpete72
    CA Forum: Data Integration
    I'm having some problems getting the desired results creating a multi-level nested xml file.  Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas.  I'm sure I'm constructing something incorrectly, but am running out of ideas. 
    I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
    For testing, I have hardcoded a restriction at the order header line to deal with only one order.  But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
    I'm trying a where clause at the order line level similar to:
    order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
    If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header.  Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section.  Not very practical. 
    What am I missing?

    An External Parsed Entity could be used to reference a schema.
    In your DTD:
    <!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
    Refer the external entity in xml document:
    <datamodules>&datamodules;</datamodules>

  • Using multiple values in a where clause, for values only known at runtime

    Dear all
    I am creating a PL/SQL program which returns multiple rows of data but only where it meets a set id values that a user has previously chosen. The id values are stored in an associative array and are chosen by a user in the preceding procedure at run time.
    I know all the table and column names in advance. The only things I don't know are the exact number of ids selected from the id column and what their values will be. This will only be known at runtime. When the procedure is run by the user it prints multiple rows of data to a web browser.
    I have been reading the following posting, which I understand to a large extent, Query for multiple value search But I cannot seem to figure out how I would apply it to my work as I am dealing with multiple rows and a cursor.
    The code as I have currently written it is wrong because I get an error not found message in my web browser. I think the var_user_chosen_map_list_ids in the for cursor loop could be the problem. I am using the variable_user_chosen_map_list_ids to store all the id values from my associatative array as a string. Which I modified from the code that vidyadhars posted in the other thread.
    Should I be creating a OPEN FOR ref cursor and if so where would I put my associative array into it? At the moment I take the value, turning it into a string and IN part in the WHERE clause holds the string, allowing the WHERE clause to read all the values from it. I would expect the where clause to read everything in the string as 1 complete string of VARCHAR2 data but this would not be the case if this part of the code at least was correct. The code is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    CURSOR cur_map_search (par_user_chosen_map_list_ids IN NUMBER)
    IS
    SELECT MI.map_date
           MT.map_title,
    FROM map_info MI,
         map_title MT,
    WHERE MI.map_title_id = MT.map_title_id
    AND MI.map_publication_id IN
    (var_user_chosen_map_list_ids);
    var_map_list_to_compare VARCHAR2(32767) := '';
    var_exe_imm_map VARCHAR2(32767);
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids ||
       '''' ||
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) ||
    END LOOP;
    var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1,
                                            length(var_user_chosen_map_list_ids)-1);
    var_exe_imm_map := 'FOR rec_search_entered_details IN cur_map_search
    LOOP
    htp.print('Map date: ' || cur_map_search.map_date || ' Map title: ' || cur_map_search.map_title)
    END LOOP;';
    END PROCMAPSEARCH;EXECUTE IMMEDIATE var_exe_imm_map;
    I would be grateful of any comments or advice.
    Kind regards
    Tim

    I would like to thank everyone for their kind help.
    I have now successfully converted my code for use with dynamic SQL. Part of my problem was getting the concept confused a little, especially as I could get everything work in a static cursor, including variables, as long as they did not contain multiple values. I have learnt that dynamic sql runs the complete select statement at runtime. However even with this I was getting concepts confused. For example I was including variables and the terminator; inside my select string, where as these should be outside it. For example the following is wrong:
         TABLE (sys.dbms_debug_vc2coll(par_user_chosen_map_list_ids))....
    AND MI.map_publication_id = column_value;';Where as the following is correct:
         TABLE (sys.dbms_debug_vc2coll('||par_user_chosen_map_list_ids||'))....
    AND MI.map_publication_id = column_value';PL/SQL is inserting the values and then running the select statement, as opposed to running the select statement with the variables and then accessing the values stored in those variables. Once I resolved that it worked. My revised code is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    var_details VARCHAR(32767);
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids ||
       '''' ||
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) ||
    END LOOP;
    var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1,
                                            length(var_user_chosen_map_list_ids)-1);
    var_details := FUNCMAPDATAFIND (var_user_chosen_map_list_ids);
    htp.print(var_details);
    END PROCMAPSEARCH;
    FUNCTION FUNCMAPDETAILS (par_user_chosen_map_list_ids IN VARCHAR2(32767)
    RETURN VARCHAR2
    AS
    TYPE cur_type_map_search IS REF CURSOR;
    cur_map_search cur_type_map_search;
    var_map_date NUMBER(4);
    var_map_title VARCHAR2(32767);
    begin:
    OPEN cur_map_search FOR
    'SELECT MI.map_date,
           MT.map_title
    FROM map_info MI,
         map_title MT,
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_map_list_ids || '))
    WHERE MI.map_title_id = MT.map_title_id
    AND MI.map_publication_id = column_value';
    LOOP
    FETCH cur_map_compare INTO
    var_map_date,
    var_map_title;
    var_details := var_details || 'Map date: '||
                        var_map_date ||
                        'Map title: ' ||
                        var_map_title;
    EXIT WHEN cur_map_compare%NOTFOUND;
    END LOOP;
    RETURN var_details;
    END FUNCMAPDETAILS;Kind regards
    Tim

  • How to add a dynamic where clause for a sql based VO with group by query?

    Hi,
    Here is my case, I have a sql query based VO with the query like "select status, count(*) StatusCount from my_table group by status". Now I used the following java code trying to dynamically add the where clause to my VO to filter the rows based the type attribute in my DB table.
    vo.setWhereClause("type='MyType1' ");
    vo.executeQuery();
    Then I got the sql syntax error. Looks like the ADF has added the where clause to the end of my sql so my sql becomes "select status, count(*) StatusCount from my_table group by status where type='MyType1' ". But what I expected was the correct syntax "select status, count(*) StatusCount from my_table where type='MyType1' group by status".
    Does anyone know if this is an ADF bug? Or is there any other way to achieve my goal?
    Thanks,
    Chunyang
    Edited by: Chunyang on Dec 13, 2012 9:09 PM

    Hi,
    When you use setWhereClause on the VO, it is applied on top of the VO query. I.e, assume your VO has the following query.
    select empno, ename from empNow, if you apply the where clause programatically, only the two attributes that you are using in the select statement could be used. I.e
    select * from (select empno, ename from emp) where ename='KING' - VALID
    select * from (select empno, ename from emp) where deptno=10  - INVALID (because the inner query - the one you've defined as query for your vo does not have deptno attribute selected)If you would need to set a dynamic where clause, you need to make them available in your select statement / use bind variables.
    -Arun

  • TopLink essentials: extra where clause for one to many relationship?

    We have a lot of tables that contain "historic" records. Those are marked by a column "historic" holding a value "Y". Sometimes we are not interested in historic values. For example in the next case:
    @Entity
    @Table(name="ART")
    public class Article {
        @OneToMany(mappedBy="article", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
        private Collection<ArticleStats> arcItems;
        public Collection<ArticleStats> getArticleStats() {
            return arcItems;
    }One article can have multiple "stats". We are in this case only interested in the "stats" of this article that are not historic. In SQL terms, I would like to add an extra where clause: "WHERE historic = 'N'".
    Of course inheritance (with discriminators) is an option, but I don't prefer that. We have a lot of relationships like this and using inheritance would mean we have to add a lot of extra classes. Is there a way to add an extra where clause to the query that is used to retrieve all the stats records related tot my Article?
    We use TopLink essentials with an IBM AS/400 database.

    The JPA Spec does not handle this case, but TopLink Essentials does. You will need to customize your TopLink descriptor using a DescriptorCustomizer. You can set your DescriptorCustomizer in your persistence.xml using the "toplink.descriptor.customizer.<entity-name>" property set to the class name "<package>.<class>" of your customizer class.
    The customizer would look something like:
    public class MyCustomizer implements DescriptorCustomizer {
    public void customize(ClassDescriptor descriptor) {
    OneToManyMapping mapping = (OneToManyMapping )descriptor.getMappingForAttributeName("arcItems");
    ExpressionBuilder builder = new ExpressionBuilder();
    mapping.setSelectionCriteria(builder.getField("STAT.ART_ID").equal(builder.getParameter("ART.ID").and(builder.getField("HISTORY").equal("N")));
    If you never wanted historical records you could also add this expression to your descriptor's additionalJoinExpression.
    James Sutherland

  • Additional where-clause for LOV in 9i needs table-alias

    We have upgraded from 6.0 to 9i. All our Forms had been generated for 100% using Headstart. Now we try to generate them all again and encounter a problem with the list of values. It appears that the Additional restriction in the List of Values Properties always needs the table-alias to work properly when references are made to an item in the form.
    For example:
    We have item ORG_CODE in block ORG and have a lov showing all others organisations. The default-where coded in 6.0 looked like this:
    org_code <> :org.org_code
    In 6.0 this worked perfectly. However, in 9i the where-clause is being translated into
    :org.org_code <> :org.org_code
    Offcourse the lov now always gives the message that it contains no entries!
    We have found a solution for this problem - rewrite the where-clause to
    lov_alias.org_code <> :org.org_code
    However, this solution means that we have to check tens, hundreds of lov's, because we never used to put an alias in the where-clause.
    Because of this problem 95% of our Forms can not be generated anymore.
    Anyone has a easy solution for this problem?

    I mean:
    select * from T-A, T-B
    where T-A.id = T-B.id (+)
    and T-B.number (+) = 570
    to get the null record you'll have to do:
    select * from T-A, T-B
    where T-A.id = T-B.id (+)
    and nvl(T-B.number,0) (+) not in (0,570)
    or
    select * from T-A, T-B
    where T-A.id = T-B.id (+)
    and (T-B.number (+) <> 570
    or T-B.number (+) is null)
    hope that works (untested)
    null

  • Generate WHERE clause for VO using imported entities

    Hi,
    I am using JDev 9.0.3 Preview.
    I attempt to create in one BC project a view based on a join of three entities.
    One of the entities is from the same project, but the other two are imported. After importing the project(s) containing the two additional entities, I have to create the associations (based on database constraints) between the "inner" entity and the "imported" entities. This is OK (apart from known problems, with known workarounds...)
    Now I want to modify the default view created by the wizard for the inner entity and add the two imported entities. When I add the first imported entity, all is OK, the WHERE clause is properly updated, according to the definition of the association. But, when the second imported entity is added, the WHERE clause remains unchanged.
    Is this the expected behaviour?
    Thanks,
    Adrian

    I tried to reproduce this in our production 9.0.3.1035 build which will be available here very shortly on OTN, and this issue is no longer a problem in 9.0.3 production. The WHERE clause is formulated correctly.

  • Conditional WHERE clause for APEX

    Dear SQL gurus,
    I know that there's a APEX forum, but I think that there maybe an sql based solution for this...
    What I have is a query like this:
    SELECT COMMENT_ORIG, COMMENT_CHARGING
    FROM  CL_INVENTORY_OPEN_OUT
    WHERE INCIDENTAL_FK=:P13_INCIDENTAL_FK where :P13_INCIDENTAL_FK is a field in the Web Based GUI...
    What I need is to change the WHERE clause to something like this
    WHERE
      DECODE(:P13_INCIDENTAL_FK, NULL, 1=1, INCIDENTAL_FK=:P13_INCIDENTAL_FK)so to say:
    if the : P13_INCIDENTAL_FK is null, then let the clause be 1=1, otherwise let it be NCIDENTAL_FK=:P13_INCIDENTAL_FK.
    Is there a way to do this inside a sql statement?
    Best Regards and THX
    Johann

    SELECT COMMENT_ORIG, COMMENT_CHARGING
    FROM  CL_INVENTORY_OPEN_OUT
    WHERE INCIDENTAL_FK=:P13_INCIDENTAL_FKDo not know how you are using the query, but you might try something like this
    BEGIN
      CASE :P13_INCIDENTAL_FK
        WHEN NULL THEN
          SELECT COMMENT_ORIG, COMMENT_CHARGING
            FROM  CL_INVENTORY_OPEN_OUT
        ELSE
          SELECT COMMENT_ORIG, COMMENT_CHARGING
            FROM  CL_INVENTORY_OPEN_OUT
           WHERE INCIDENTAL_FK=:P13_INCIDENTAL_FK
      END CASE;
    END;Edited by: ajallen on May 7, 2010 6:44 AM

  • Default where clause for different users

    Hi!
    Is it possible to implement a different where clause to the filter for when different users log into the application?
    Let's say I have a table DEPARTMENTS and users Mark and John.
    I would like the following:
    When Mark logs in and opens the report, it will have the following data:
    select * from DEPARTMENTS where REGION='EUROPE';
    Where John logs in and opens the report, he will see:
    select * from DEPARTMENTS where REGION='NORTH AMERICA';
    Thanks!

    Hi,
    if you go to the Security tab in Edit Application Properties you will find a section called Database Session. This is where you can set a session context that can be used by a database feature called Virtual Private Database (VPD) or Fine Grained Access Control (FGAC). This is a feature where the database can be set up to automatically modify any query in order to add extra query filters that have a context, usually related to the logged on user, thus allowing only access to relevant data. I would suggest the you read up on this feature as it is the recommended method of applying security in a row wise fashion.
    Regards
    Andre

  • Generating HANA where clause for select options having CP as the operator

    Hi All
    I am trying to generate where clause in HANA sql from the select options range table .
    I tried using the function modules  RSDS_RANGE_TO_WHERE and  RH_DYNAMIC_WHERE_BUILD .
    They are working for most of the cases . But  , when the range table has entries like
    Fieldname   sign opt  low high
    VBELN        I/E    CP  *4*
    Both of them fail to generate the right result .
    Could you suggest any other function modules , which take care of all such cases like include single values , exclude single values , incluse and excluse ranges , patterns etc .
    Thanks and Best Regards
    Varsha

    Hi Karthik,
    this is the api, I have done,
    create or replace
    FUNCTION get_where_clause_for_emp_req (
       emp_id       IN   NUMBER,
       salary            IN   NUMBER,
       job         IN   VARCHAR2,
       dept IN NUMBER
       RETURN VARCHAR2
    IS
       l_where_clause   VARCHAR2 (2000);
    BEGIN
       IF (    (emp_id IS NULL)
           AND (salary IS NULL)
           AND (job IS NULL)
           AND (deptIS NULL)
       THEN
          RETURN NULL;
       ELSE
          l_where_clause := 'WHERE ';
       END IF;
       IF (emp_id IS NOT NULL)
       THEN
          l_where_clause :=
                        l_where_clause || ' emp_id =' || emp_id || '';
       END IF;
       IF ((emp_id IS NOT NULL) AND (salary IS NOT NULL))
       THEN
          l_where_clause :=
                          l_where_clause || ' AND salary= ' || salary;
       ELSIF (salary IS NOT NULL)
       THEN
          l_where_clause := l_where_clause || ' salary= ' || salary;
       END IF;
       IF (((salary IS NOT NULL) AND (dept IS NOT NULL)) OR ((emp_id IS NOT NULL) AND (salary IS NULL) AND (dept IS NOT NULL)))
       THEN
          l_where_clause := l_where_clause || ' AND dept= ' || dept;
       ELSIF (status_i IS NOT NULL)
       THEN
          l_where_clause := l_where_clause || ' dept= ' || dept;
       END IF;
    l_where_clause := l_where_clause || ' ;';
       RETURN l_where_clause;
    END;I have done for three parameters, i need to include two more input parameters for this function, so I see going forward my testing cases will increases,
    so am looking for the best solution
    Thanks
    Edited by: NSK2KSN on Jul 7, 2010 3:11 PM

  • Where-clause for date-string

    Hi specialist's,
    i have a simple question about a select, but I think I do not see the forrest becaus of too many trees ...
    I have a table where timestamps are stored in seconds-since-epoch.
    I select a human readble format with this statement:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog;
    TIMESTAMP
    19-10-2013 09:31:27
    19-10-2013 09:31:27
    19-10-2013 09:31:27
    Now I want to filter i.e. for dates of 19-01.... 
    My first try was this:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog
      where timestamp like '19-%'
    Result:
    ORA-00904: "TIMESTAMP": invalid identifier
    My next try was this:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog
    where 1 like '19%'
    Result: 0 rows!
    If I change this to
    ... where 1 like '%'
    I get all rows.
    What is wrong with my selects ???

    Felix_GG wrote:
    Hi specialist's,
    i have a simple question about a select, but I think I do not see the forrest becaus of too many trees ...
    I have a table where timestamps are stored in seconds-since-epoch.
    I select a human readble format with this statement:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog;
    TIMESTAMP
    19-10-2013 09:31:27
    19-10-2013 09:31:27
    19-10-2013 09:31:27
    Now I want to filter i.e. for dates of 19-01....
    My first try was this:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog
      where timestamp like '19-%'
    Result:
    ORA-00904: "TIMESTAMP": invalid identifier
    My next try was this:
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog
    where 1 like '19%'
    Result: 0 rows!
    If I change this to
    ... where 1 like '%'
    I get all rows.
    What is wrong with my selects ???
    Firstly, why not store timestamps as timestamps?
    Anyway, Your first select refers to the alias 'timestamp' which is only accessible in an outer query, not from within the where clause.
    Try
    Select * from (
    select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS')  as timestamp from txlog
    where timestamp like '19-%';
    But timestamp is not a good choice for an alias, as it is a keyword.
    Your second select is obvious - the number 1 will never be like '19%', but it will work
    in the third select: as 1 is indeed like '%' (anything).

Maybe you are looking for

  • Mail: smart mailbox contents disappears/search doesn't work & fix is only temporary

    Since installing Mavericks (including the Mail update), the contents of my Smart Mailboxes disappears (the Mailboxes themselves are listed, there's just no content) and my ability to get results from Search within Mail disappears.  I have done a lot

  • Footnotes in Tables?!

    I am an academic and need to use footnotes not only in the body of my documents, but also in tables. I just started using iWork to avoid Office, but I cannot seem to be able to insert footnotes into tables in Pages. Is it really not possible? Say it

  • Notes feature not working properly

    Sinec I've had this iPod, the notes feature on it has been a little wonky. When there are no notes, the Instructions file appears and is read fine. When I start putting small plain text files into the iPod's notes folder, the notes feature would read

  • Installing iWork on Mac OS X Server

    I've installed my copy of iWork '06 on Mac OS X Server because I need to be able to read some Pages files on the development box. It installed fine (no errors) but when I try to launch Pages I get weird behaviour from the App. It's screens won't rend

  • Creation of sub-types

    Hi Guy's, Please explain me how to create the Sub-types in ABAP-HR. Thanks, Sai.