Dynamic LOV (Where Clause Issue)

I have a LOV on an item that I want to be dynimac based on a transaction date field.
When I hard-code the date, it works fine (or use sysdate).
select ft.ftvacct_acct_code || '-' || ft.ftvacct_title || '-' || ft.ftvacct_atyp_code display_value
, ft.FTVACCT_ACCT_CODE return_value
from FTVACCT FT
where ftvacct_data_entry_ind = 'Y'
and ftvacct_status_ind = 'A'
And To_date('20091231','yyyymmdd') Between ft.ftvacct_eff_date And ft.ftvacct_nchg_date
order by 1
When I replace "To_date('20091231','yyyymmdd')" with :p8_trans_date, the item that hold the date value, nothing
is available in the lov?
And :p8_trans_date ft.ftvacct_eff_date And ft.ftvacct_nchg_date

I created an Application Item, but it appears to still not work for me, I probably missing something (I'm no to JS scripting)?
Application Item: F130_LOV_DATE.
On the Transaction Date option have JS call: onblur="javascript: SetLOVDate();"
On Page have JS:
<script type="text/javascript">
function setlovdate()
$x('F130_LOV_DATE').value = $x('P8_TRANS_DATE').value;
</script>
On Item that I want the LOV, Changed the sql to:
And :F130_LOV_DATE Between ft.ftvacct_eff_date And ft.ftvacct_nchg_date
Edited by: SPoulos on Mar 29, 2010 9:49 AM

Similar Messages

  • Need help in clearing string buffer during dynamic VO where clause in oaf

    Hi All,
    I am dynamically setting where clause in OAF using string buffer, but the issue is when i am executing the vo multiple times so the old data in the string buffer it is not clearing .so every time my where clause adding to the query and it is erroring out, please help me how to clear string buffer class in oaf.
    Thnaks

    Hi,
    Could you please share the code segment for reference. Then we can tell the solution.
    Regards,
    Tarun

  • Dynamic XQuery Where clause

    I have the following schema:
    <?xml version="1.0"?>
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="CountryRiskService"
    targetNamespace="CountryRiskService"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    <xs:element name="CountryRiskParameters">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="countryId" type="xs:int" minOccurs="1" maxOccurs="unbounded"/>
    <xs:element name="catA" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    I am passing this into my Logical Data Service, what I want to do is create a dynamic XQuery where clause if the catA field is populated, ignore it if it isn’t, so basically, I want to be able to create a dynamic query based on the parameters requested, so I have the following XQUERY:
    declare function tns:getCountries($countryRiskInput as element(ns7:CountryRiskParameters)) as element(ns0:CountryRiskInfo)* {
    for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
    where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
    where $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA
    I really thought that DSP would be able to handle this on the fly since the element is optional but if I don’t populate it, I get nothing back, the idea is I want to increase the number of elements in my schema so my consumers have the ability to filter the results they want, so above, I don’t want the second where clause if catA isn't specified, any ideas how to accomplish this?

    Simply add the disjunction of the input being empty.
    for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
    where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
    where ( $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA or empty( $countryRiskInput/ns4:catA )
    But suppose you have 27 different elements that you might want to filter on - the xquery gets long and ugly. You might want to looking into using FilterXQuery. Visit http://edocs.bea.com/aldsp/docs25/, search on FilterXQuery, look for the tutorial.
    If your queries get more complicated, you would do well to look into generating ad hoc queries. (edocs as well).

  • Issue with dynamically setting where clause in OAF

    Hi All,
    I have a View object having the query below:
    SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY         
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2 
       AND 'on'=:1
       AND B.TO_SUBINVENTORY_CODE=NVL(:4,B.TO_SUBINVENTORY_CODE)
       AND A.request_number=NVL(:5,A.REQUEST_NUMBER) 
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY      
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id
         AND 'on'=:2
        AND a.ATTRIBUTE2=NVL(:4,a.ATTRIBUTE2)
      and b.wip_entity_name=NVL(:6,b.wip_entity_name)
    I need to pass dynamically a condition to my where clause that i can handle it by defining two bind parameters in the vo query and can pass it but the problem is the bind variable contains a string like 1311,13112,14445 that i need to pass for a field such as B.line_id in the first query and b.wip_entity_id in the second query so when i am trying by passing the string as one value it is working fine but for value separetd by comma it is giving prob.
    so i tried by passing dynamic where clause but it is everytime executing for first clause only how i can pass dynamically both the queries.
    vo.setWhereClause("LINE_ID in "+wherclause);
    please help me out
    Thnaks
    Deb

    Hi Gaurav,
    Thnaks for the reply i tried belwo way u suggested but the query is executing multiple times and i am not getting the correct data as expected.
    public void processPOData (String wherclause)
                 OAViewObject vo = this.getXXDPECONTAINLINESVO1();
                    String query =vo.getQuery();
                    String newwhereclause ="LINE_ID = "+wherclause;
                    StringBuffer stringbuffer = new StringBuffer();  
                stringbuffer.append("SELECT * FROM (");
                stringbuffer.append(query);
                stringbuffer.append(") where ");
                stringbuffer.append(newwhereclause);          
        ViewDefImpl viewdefimpl = getXXDPECONTAINLINESVO1().getViewDefinition();
                viewdefimpl.setQuery(stringbuffer.toString());
                 vo.reset();
                 vo.clearCache();
                vo.executeQuery();
                    System.out.println("where clause:"+wherclause);
    in my log file the query is forming like below:
    SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM ( SELECT * FROM ( SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY ,
            B.TO_SUBINVENTORY_CODE UNLOADINGPNT,
            A.REQUEST_NUMBER RRNUM,
            NULL WORKORDNUM,
            NULL DTRNUM,
            A.description,
            A.FROM_SUBINVENTORY_CODE FROM_SUB,
            A.TO_SUBINVENTORY_CODE  TO_SUB,
            NULL SOURCE       
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2  
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY,
            a.ATTRIBUTE2 UNLOADINGPNT,
            NULL RRNUM,
            b.WIP_ENTITY_NAME WORKORDNUM,
            NULL DTRNUM,
            b.description,
            NULL FROM_SUB,
            NULL TO_SUB,      
            b.source SOURCE
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id ) )) where LINE_ID = 30026) where LINE_ID = 30026) where LINE_ID = 30026
    But in my page i am getting all the data instead of only for line 30026, please help me out

  • [Solved] Named Bind Variables at Runtime - SQL WHERE clause issue

    Hey 'all,
    I've been having this issue today with a Search page using Named Bind Variables at Runtime for the search parameters for the WHERE clause in the view objects SQL.
    I've got everything working except for a clearing method which I've created so that the user can clear the current WHERE clause from the SQL statment and set it as 1=2 (so that it doesn't do a blind query on load).
    The method can clear and set the WHERE clause to 1=2 only when there is already one there.
    Below are the methods: (located in my view object class)
    public void findInvoiceById(Number invoiceId){
        setWhereClause("invoice_id = :P_INVOICE_ID");
        defineNamedWhereClauseParam("P_INVOICE_ID",null,null);
        setNamedWhereClauseParam("P_INVOICE_ID",invoiceId);
        executeQuery();
    public void clearCriteria(){
        setWhereClause("1=2");
        removeNamedWhereClauseParam("P_INVOICE_ID");
        executeQuery();
    }The error which I get is the following - this happens when the button is pressed twice in a row, or when no query has been passed previously.
    1. JBO-29000: Unexpected exception caught: oracle.jbo.NoDefException, msg=JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    2. JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    Any help with this would be greatly appreciated!
    Cheers,

    Hi Bonnie,
    we have it working ok, but still feel that there is room for improvement in the design.
    For us the key factors are:
    Pages based on the same view object that can be queried multiple ways.
    We don't want to put design time bind variables in because it limits the use of the VO
    We don't wan't multiple VO's with different where clauses.
    The page is displaying the same table columns and fields, but the where clause must be dynamic.
    We only want to query on the search field entered (some of our tables are massive)
    TopLink named queries are really what we are after, but we don't want to forgo all the other ADF BC functionality. The only examples of ViewCriteria in the developer guide had literals in the where clause and no bind variables. The View Criteria may still be an option, but it appeared quite complex compaired to directly adding and removing bind variables at runtime.
    a couple of footnotes:
    the following methods are used to clear the runtime variables prior to reusing the VO (thanks to John Stegman for the pointer on the exception handler):
        public void clearBindVariable(String bindVariableName){
            try
                removeNamedWhereClauseParam(bindVariableName);
            catch (NoDefException e)
        public void clearBindVariables(){
            clearBindVariable("P_INVOICE_ID");
            clearBindVariable("P_INVOICE_NUM");
            clearBindVariable("P_SUPPLIER_NAME");
            clearBindVariable("P_INVOICE_DATE_FROM");
            clearBindVariable("P_INVOICE_DATE_TO");
            clearBindVariable("P_SUPPLIER_NUMBER");
        }We are using 1=1 and 1=2 in the where clause to supress blind querying. 1=2 is applied when ever we are not explicitely searching for something. We had a problem with using the refresh condition ${adfFacesContext.postback == true} which I posted about here:
    executeQuery called twice using ${adfFacesContext.postback == true}
    Would still gladly hear other ideas on a better reuse design.
    regards,
    Brenden

  • Adding filter conditions dynamically in WHERE clause -dynamic SQL help

    Here I have a simple condition but very complicated query. Basically, I have to put a filter condition in my where clause. "Location" comes to the stored procedure as parameter. Plus there are other parameters as well.
    If location = "all", I can run the query simply and get the result. But when Location = "CA", which is just a subset of "ALL" then I am having hard time putting one -- AND statement in WHERE clause.
    This query is designed for location = 'ALL'
    open cv for
    'Select col1, col2, col3, Col4
    from t1, t2, t3
    WHERE condition1
    AND condition2
    AND condition3'
    AND location = location_id --- This should only run if location IS NOT ALL
    I have written a dynamic query but it doesn't work for that part. Any ideas will be appreciated. Thanks,

    From what I understood
    If location = 'ALL' then
    fetch all the records
    Else
    add extra filter location_id = <supplied location id>
    End If
    If this is the condition the following logic should solve your issue.
    open cv for
    'Select col1, col2, col3, Col4
    from t1, t2, t3
    WHERE condition1
    AND condition2
    AND condition3'
    AND ((location_id = location_id and location = 'ALL') or (location_id = location))Regards
    Raj

  • How to dynamically build where clause in Linq

    Hello everyone,
    Oracle DB:11gR2
    Oracle Client: 11.2.0.3.0 (ODP.NET)
    Oracle Developer Tools for Visual Studio
    VS 2010 (C#)
    In a Windows Form, we need to query the data based on the values of dropdown listboxes, which user will select.
    Let's say, two combox, one is for Department and one is for Salary
    Department:
    -1 All
    10 Department 1
    20 Department 2
    30 Department 3
    Salary:
    -1 All
    1 < 20000
    2 20000 to 50000
    3 50000 to 100000
    4 > 100000
    Here is C# code to query data:
    using (var myEDMctx = new HREntities())
    var LINQrslt = from emp in myEDMctx.EMPLOYEES
    select emp;
    The default values for both combox should be All.
    How to write the dynamic where clause for this LINQ?
    Thanks in advance!!!

    There is nothing Oracle-specific about dynamic LINQ queries. Dynamic LINQ queries are handled all the same way, no matter which data source you use. Microsoft describes how to use Dynamic LINQ here:
    http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
    http://weblogs.asp.net/davidfowler/archive/2010/08/19/dynamic-linq-part-2-evolution.aspx

  • WHERE Clause issue

    Hi, I have run the following command successfully without the WHERE clause on the last line.  However, when I try to use a parameter, it fails.  Is there anything wrong with it?
    CREATE TABLE #DateList
    Dates DateTime NOT NULL PRIMARY KEY
    DECLARE locDate DateTime;
    DECLARE BEG DateTime;
    DECLARE FIN DateTime;
    DECLARE N DOUBLE PRECISION;
    //-- Sets the 1st date in the table.
    SET BEG=TIMESTAMP '2000-01-01 00:00:00';
    //-- Sets the Last date in the Table.
    SET FIN=TIMESTAMP '2008-12-31 00:00:00';
    //-- Fills all the dates in between...
    SET locDate = BEG;
    WHILE locDate <= FIN DO
      INSERT INTO #DateList
      (Dates)
      SELECT locDate AS Dates FROM #dummy;
      /* This should work, but it looks like Nexus haven't written the code yet to
         actually add dates, the slack dogs. 
      SET locDate=locDate + INTERVAL '1' DAY;
      SET N = CAST(locDate AS DOUBLE PRECISION) + 1;
      SET locDate = CAST(N AS TIMESTAMP);
    END WHILE;
    SELECT *
    FROM #DateList;
    DROP TABLE #DateList;
    SELECT "WeatherDetail"."RainFall", "WeatherStation"."Name", "WeatherDetail"."Date"
    FROM   "WeatherDetail" "WeatherDetail" INNER JOIN "WeatherStation" "WeatherStation" ON "WeatherDetail"."WeatherStationID"="WeatherStation"."WeatherStationID"
    WHERE "WeatherStation"."Name" = {?Station}

    Please remember to give all necessary information, such as the error message. This will help users identify the cause of your issue.

  • Use value from tabular form column in the LOV where clause of another column

    Hi
    Using APEX 4.2 on 11g
    In a tabular form I want to filter the values in a Popup Key LOV based on the value of another column (same row).
    i.e. I want to get the value of one column and use it in the where clause for the Popup LOV on the same row.
    e.g. where COL 2 is a popup LOV
    COL 1
    COL 2
    1
    LOV SQL: SELECT a FROM b WHERE c = <value from COL 1>
    2
    LOV SQL: SELECT a FROM b WHERE c = <value from COL 1>
    3
    LOV SQL: SELECT a FROM b WHERE c = <value from COL 1>
    The value in COL 1 does not change once the row is created. It is a hidden ID field.
    Is this possible?
    Nick

    Anyone have any ideas?
    I thought getting the value from one column and using it in another column would be commonly used functionality... I just can't seem to work it out.

  • Dynamically setting where clause parameter before the page load

    Hi Experts,
    I do have the following requirement.
    I am working on jsf page in ADF10.1.3.3. I have a View Object which displays the results on the screen. Can someone provide me some example where I can dynamically set the where clause parameter to my Query in VO before the Page Load happens(By Overriding the Prepare Model) and display results on screen.
    Thanks

    Hi,
    Thanks for yor advice.
    I need to write the method in Prepare Model method when the page loads and not in AM.
    Here in the page there is no action as such.
    On the Page load we need to directly set the Where Clause on the VO.
    Provide me some examples if any.
    Thanks

  • How to pass LOV Where clause params from Page CO

    Dear Members,
    I have an OAF Page for which I defined a CO.
    I also have an LOV for which I have two parameters in where clause.
    Now my requirement is to pass the two values to the where clause parameters of LOV from the CO of the respective page.
    Can any one please guide me in achieving this requirement.
    Best Regards,
    Arun Reddy

    Hi Arun
    as gyan, suggested try attching a new controller to lov , or extend its existing controller.
    In the page CO
    store the parameter that needs to be passed to lov in pageContext.putSessionValue(paramName,paramValue)
    In the CO of Lov page , in processrequest
    retrive the stored values using pageContext.getSessionValue(paramName)
    Regards
    Ravi

  • Dynamic Query Where Clause

    Hi,
    I have the following query in a SQL Query (Pl/Sql Function Body Returning Sql Query) report:
    DECLARE
    q VARCHAR2(32767); -- query
    w VARCHAR2(4000) ; -- where clause
    we VARCHAR2(1) := 'N'; -- identifies if where clause exists
    BEGIN
    q:= 'SELECT "OSP_ID",' ||
    ' "OSP_NUMBER",'||
    ' "PROPOSAL_TITLE",'||
    ' "PROPOSAL_TYPE",'||
    ' "AGENCY_TYPE_CODE",'||
    ' "AGENCY_TYPE",'||
    ' "AGENCY_CODE",'||
    ' "AGENCY_NAME",'||
    ' "AGENCY_ABBREVIATION",'||
    ' "SPONSOR_CODE",'||
    ' "SPONSOR_NAME",'||
    ' "PI_NAME",'||
    ' "PI_EMP_NUMBER",'||
    ' "PI_PERS_ID" '||
    ' FROM "PROPOSAL_V" ';
    IF :P25_OSP_NUMBER != '-All-'
    THEN
    w := ' OSP_NUMBER = :P25_OSP_NUMBER ';
    we := 'Y';
    END IF;
    IF :P25_PROPOSAL_TYPE != '-1'
    THEN
    IF we = 'Y'
    THEN
    w := w || ' AND PROPOSAL_TYPE = :P25_PROPOSAL_TYPE ';
    ELSE
    w := ' PROPOSAL_TYPE = :P25_PROPOSAL_TYPE ';
    we := 'Y';
    END IF;
    END IF;
    IF we = 'Y'
    THEN q := q || ' WHERE '|| w;
    END IF;
    RETURN q;
    END;
    What I need is to change the ' OSP_NUMBER = :P25_OSP_NUMBER ';
    to ' OSP_NUMBER LIKE '%'||:P25_OSP_NUMBER'%'|| ';
    But I'm getting errors when I do like above.
    Can somebody please help...
    Thanks in advance
    - Pradeep

    First of all, get rid of that silly "where exists" variable, just add a where clause like where 1=1 to the query and keep adding dynamic clauses with AND clause as needed.
    Try
    q := q||'and OSP_NUMBER LIKE ''%'''||:P25_OSP_NUMBER||'''%''';

  • Dynamic query, where clause help

    Hi Folks,
    Using my code below to generate a query.
    When using more than one condition, I'm not sure how to work out where the AND goes.
    Can anyone please help?
    Thankyou
    WHERE
    <cfif stafffilter neq "">
    deviceofficer = #stafffilter#
    </cfif>
    <cfif assetid neq "">
    AND deviceasset = '#assetid#'
    </cfif>
    <cfif isdefined("noasset")>
    AND deviceasset = ''
    </cfif>
      <cfif  isdefined("noserial")>
    AND deviceserial = ''
    </cfif>
    <cfif serial neq "">
    AND deviceserial = '#serial#'
    </cfif>
    <cfif servicearea neq "">
    AND deviceservice = #servicearea#
    </cfif>
    ORDER by locationname

    I do this sort of thing:
    <cfset sWhereAnd = "WHERE">
    <cfif isdefined("colFilter")>
         #sWhereAnd# col = #colFilter#
        <cfset sWhereAnd = "AND">
    </cfif>
    <cfif isdefined("someOtherColFilter")>
         #sWhereAnd# someOtherCol = #someOtherColFilter#
        <cfset sWhereAnd = "AND">
    </cfif>
    [etc]
    (that's pseudocode... I'd never use isDefined() or not use a <cfqueryparam> tag for my parameter values).
    I don't like doing the somewhat popular WHERE 1=1 approach as it can force a full table scan (all rows in the table will match that, and each WHERE filter expression is applied to every row of the table being filtered), unless the DB optimises it out as noise (which is what it is).  To me it's using bad SQL to cut corners.
    To be honest though, I shy away from these generic sort of queries these days.  Most of the genericism never gets used, and more specific requirements are better implemented to meet the precise need.
    Adam

  • Constructing Dynamic Where clause:

    Hi experts ,
    In my real time environment in java code for a select query they they are appending dynamically to where clause and retrieving the data using hybernet .I want to do this in PL/SQ
    1)is it possible ?
    2)How can i do this one
    3)Can you provide the sample document or example for this one .Please help me

    980560 wrote:
    Hi experts ,
    In my real time environment in java code for a select query they they are appending dynamically to where clause and retrieving the data using hybernet .I want to do this in PL/SQ
    1)is it possible ?Yes it is. But it is a HORRIBLE idea and explains, in part, why Hibernate is a piece of smelly +<insert derogatory term here>+ when it comes to performance, and scalability.
    Dynamic SQL is very seldom a good idea. ANY reporting environment deals with IDENTIFIABLE questions that are asked and need to be answered. A so-called ad-hoc reporting environment where any query (no matter how idiotic and illogical) can be constructed is a FAILURE on the part of the business analyst and end-user to establish actual business requirements that need to be met. (and yes, there are a lot of these failures out there that know nothing about what analysing and determining business requirements are about, despite their job titles)
    2)How can i do this one Using DBMS_SQL. Not that difficult programming wise. This in essence is what Apex uses for running web applications that provides report SQLs to execute and contents to be rendered.
    If this SQL query is constructed on behalf of a client, then you need Oracle 11g - as the DBMS_SQL cursor variable that refers to the SQL cursor created, needs to be changed into a pointer (ref cursor) in order to be passed to the client.
    3)Can you provide the sample document or example for this one.See Oracle® Database PL/SQL Packages and Types Reference guide for details and basic examples.

  • About dynamic  where clause

    hi
    on Jdev 11.1.2.3.0
    Imade dynamic search (where clause)
    It woks fine with me
    but I want to be sure from the best way to do that
    the ideia is to run search according to what is the user chose
    on (Hr) schema employees table
    the end user could search according to departmentID only
    or job id only or both of them or display all employees taable data if there are no seletion
    I used
    this.setWhereClause( );
    this.defineNamedWhereClauseParam();
    this.setNamedWhereClauseParam();
    methods in employeesImpl and I revale it to the client interface to display two text boxes and a button
    my full code is
    ================
    public void setwhereClause(String jobid ,String departmentId ) {
    if (jobid==null & departmentId ==null) {
    this.skipNamedWhereClauseParam ("P_DEPARTMENT_ID");
    this.skipNamedWhereClauseParam("P_jobid");
    this.setWhereClause("1=1");
    this.executeQuery();
    if (jobid==null & departmentId !=null) {
    this.setWhereClause("EmployeesEo.DEPARTMENT_ID =:P_DEPARTMENT_ID");
    this.defineNamedWhereClauseParam("P_DEPARTMENT_ID", null, null);
    this.setNamedWhereClauseParam("P_DEPARTMENT_ID",departmentId );
    this.skipNamedWhereClauseParam("P_jobid");
    this.executeQuery();
    if (jobid!=null & departmentId ==null) {
    this.setWhereClause("EmployeesEo.JOB_ID=:P_jobid ");
    this.defineNamedWhereClauseParam("P_jobid", null, null);
    this.setNamedWhereClauseParam("P_jobid",jobid );
    this.skipNamedWhereClauseParam ("P_DEPARTMENT_ID");
    this.executeQuery();
    if (jobid!=null & departmentId !=null)
    this.setWhereClause( "EmployeesEo.JOB_ID=:P_jobid and EmployeesEo.DEPARTMENT_ID =:P_DEPARTMENT_ID " );
    this.defineNamedWhereClauseParam("P_DEPARTMENT_ID", null, null);
    this.setNamedWhereClauseParam("P_DEPARTMENT_ID",departmentId );
    this.defineNamedWhereClauseParam("P_jobid", null, null);
    this.setNamedWhereClauseParam("P_jobid",jobid );
    this.executeQuery();
    ==========================================
    but Iwas geting error when I run the search For the First Time only without selecting any thing
    the error wase about ( attempt to define parameter which is not in the where clause)
    one time for both variable if there are no selection
    anothe for the P_DEPARTMENT_ID when I search for job
    and the oposet for P_jobid when I search for department
    so why this eror came despite of IF Statment existance
    and why when I run search for both parameter job and departemnt
    next time i search for all data or department only or job only
    the error dosnot come again
    Isuccesd to avoide this error by adding P_DEPARTMENT_ID and P_jobid
    as bind varable in the same names for the employeesVo
    note
    (Idont want to use view Criteria for a segnificant reason)
    and becasue Ineed to pass varaible to open a report_
    in the same way user search_
    and Ican't catch bindings for the view criteria_
    my qusetions
    1-Is what i Did is the correct way I mean adding the binde varable visicaly to SQL tab In the EmployeesVO
    2- why is the error of ( attempt to define paramter not iexist in the where clause mainwhile the If Statment condition dosnot succesd)
    3- how to add bindig variable programaticly without adding it phisicaly in the EmployeesVo SQL

    Duplicate to about dynamic  where clause
    User, please don't post the same question multiple times in this forum.
    Timo

Maybe you are looking for