Less than or eual to Date issue in dynamic where clause

Dear All,
I have a requirement to search the leave balance information, here date as a parameter. When ever we pass the date as a parameter it should be display all the leave balance information till the parameter date.
Steps I have followed to achieve this requirement
• Created the VO and query as follows
SELECT trunc(paa.creation_date) creation_date, paa.date_start, paa.date_end,
SYSDATE duty_resumption_date, paa.absence_days leave_deducted,
paa.absence_days leave_added, 'Leave Deucted' detail,
paa.absence_days balance_remaining,
fu.user_id
FROM per_absence_attendances paa, per_all_people_f papf, fnd_user fu
WHERE 1 = 1
AND papf.person_id = paa.person_id
AND papf.person_id = fu.employee_id
AND fu.user_id=fnd_profile.value('USER_ID')
And trunc(paa.creation_date) <= TO_DATE((to_char(trunc(to_date(:1)),'DD-MON-YYYY') ),'DD-MON-YYYY')
•     Created the Advance Search Region
•     In the controller of the region, I have captured the go button logic and setting the dynamic where clause as below
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
OAQueryBean oaquerybean = (OAQueryBean)webBean.findIndexedChildRecursive("QueryRN");
if (pageContext.getParameter(oaquerybean.getGoButtonName()) != null)
OAViewObject oaviewobject = (OAViewObject)am.findViewObject("XXLeaveBalanceVO");
String creationDate = pageContext.getParameter("CreationDate");
oaviewobject.setWhereClauseParam(0,creationDate);
oaviewobject.executeQuery();
•     But this where condition is working equal condition to the parameter but it is not working less than condition.
•     When I am running the VO query in Toad it is working the less than condition.
Please help me out to resolve this issue.
Thanks in Advance,
Sai

Dear Kumar,
I have changed my vo query as you suggested, now the equal condition also not working and I am getting the following error message
JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT trunc(paa.creation_date) creation_date, paa.date_start, paa.date_end,
SYSDATE duty_resumption_date, paa.absence_days leave_deducted,
paa.absence_days leave_added, 'Leave Deucted' detail,
paa.absence_days balance_remaining,
fu.user_id
FROM per_absence_attendances paa, per_all_people_f papf, fnd_user fu
WHERE papf.person_id = paa.person_id
AND papf.person_id = fu.employee_id
AND fu.user_id=fnd_profile.value('USER_ID')
And trunc(to_char(paa.creation_date) ,'dd-MMM-yyyy')<= trunc(to_char(:1, 'dd-MMM-yyyy'))) QRSLT WHERE (( CREATION_DATE = :2 )) ORDER BY CREATION_DATE ASC
     at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
     at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
     at OA.jspService(_OA.java:72)
     at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
     at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
     at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
     at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.sql.SQLException: ORA-01722: invalid number
Thanks,
Sai

Similar Messages

  • Is it possible to import less than ALL of the data from a PDF form developed on LiveCycle?

    Is it possible to import less than ALL of the data from a PDF form developed on LiveCycle?

    Please ask in the LiveCycle Designer forum.

  • HT1657 I rented a movie on Itunes last night and I watched half of it before falling asleep. Today I tried to open the movie and watch the last half but I cannot find it. It has been less than 24 hours since I rented it. Where can I find the movie?

    I rented a movie on Itunes last night and I watched half of it before falling asleep. Today I tried to open the movie and watch the last half but I cannot find it. It has been less than 24 hours since I rented it. Where can I find the movie?

    I found my answer in another Thread and it worked... so for anyone who needs it, here it is:
    https://discussions.apple.com/message/19134562#19134562
    Had the same problem and spoke with Apple Support. They had me reset the System Management Controller:
    Shut down the computer. With the computer off, on the left hand side of the keyboard press shift+control+option along with the power button simultaneously and release. Wait 5-10 seconds and restart the computer.
    This solved my problem and I was immediately able to purchase, download, and play an HD movie from iTunes w/o any error message.

  • MIRO posting date less than MIGO / SES posting date

    Hi,
    In our system , user can make MIRO with respect to a PO and give posting date less than posting date of GRN or Service entry sheet. I want that user can give posting date of MIRO document equal to or greater than posting date of GRN / SES of that PO.  How can i do this?
    Regards
    Kalpesh

    Hi,
    Please write a validation in order to avoid the user keying in the pre posting date at the time of MIRO

  • Date format in a where clause

    Hi Gurus,
    I'd like to filter the data displayed in a report according to the date,we have an agenda for meetings,when I open the meetings report,it should display only the meetings of today,here what I did:
    where meeting_date =
    nvl(to_char(:tday,'dd-mm-yyyy'),to_char(sysdate,'dd-mm-yyyy'))this where clause is put in the query of the region source,
    tday is a date picker to allow the user to change the date if he wants to navigate to other dates (other than today)
    It gives me the error 'ora-01722'
    where I went wrong?
    Putting in mind that the meeting_date column contains meeting time too,what ever the meeting time is,if it is for today it should be displayed.
    Mohammad

    Hi,
    Not sure if this will help but maybe you could try:
    where to_char(meeting_date,'dd-mm-yyyy') =
    nvl(to_char(:tday,'dd-mm-yyyy'),to_char(sysdate,'dd-mm-yyyy'))
    or perhaps this one:
    where to_char(meeting_date,'dd-mm-yyyy') =
    nvl(:tday,to_char(sysdate,'dd-mm-yyyy'))
    Thanks,
    Richard.

  • Data Services Designer Query tranform dynamic where clause or another way

    I have an XML source that has 5 fields.  These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform.  Works well if all 5 fields in the xml have data.  If one (or more) are blank, then it runs the where checking for blank matches and gives no results.  What I want to do is if a field is blank, do not use it in the where clause.  Could this be an outer join setup?  Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...

    I have an XML source that has 5 fields.  These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform.  Works well if all 5 fields in the xml have data.  If one (or more) are blank, then it runs the where checking for blank matches and gives no results.  What I want to do is if a field is blank, do not use it in the where clause.  Could this be an outer join setup?  Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...

  • When formatting a date field in a where clause the template put dot instead of comma

    Hello to Headstart Workers !
    In a query find block the template construct a where clause, in some cases, and i dont know when the template is formatting a date field putting a dot instead of a comma.
    Ex.: to_date('19-01-2001'.'DD-MM-YYYY')
    Anybody knows why or where the template do this.
    Congratulations
    Nelson

    - We created it using the HS utilities.
    - "nls_numeric_character = ,.".
    - it onky happen when the field date is not the first field in the where clause.
    - i can see the problem just after pressing find button, already in the ls_block in last_query.
    - the find_query works normally but cannot edit any line in ls_block.
    Hope that i had helping
    Regards
    Nelson
    null

  • Issue with Dynamic WHERE condition in Cursor in FUNCTION.

    Hi All,
    I am facing an issue with cursor having dynamic WHERE condition in a function.
    Below is the FUNCTION:
    CREATE OR REPLACE FUNCTION EXCEPTION_MERGE(TABLE_NAME IN VARCHAR2, TAB_NAME IN VARCHAR2)
    RETURN VARCHAr2
    IS
    stmt_tabcols VARCHAR2(32767);
    v_columnname VARCHAR2(32767);
    CURSOR C1 IS
    SELECT 'A.'||A.COLUMN_NAME ||' = '|| 'B.'||B.COLUMN_NAME COLUMN_NAME
    FROM
    SELECT COLUMN_ID, COLUMN_NAME
    FROM USER_TAB_COLUMNS
    WHERE TABLE_NAME  = TABLE_NAME
    AND COLUMN_NAME NOT IN ('ERROR_TAB_ID','ERROR_LOAD_DATE')
    ) A,
    SELECT COLUMN_ID, COLUMN_NAME
    FROM USER_TAB_COLUMNS
    WHERE TABLE_NAME = TAB_NAME
    ) B
    WHERE A.COLUMN_ID = B.COLUMN_ID;
    BEGIN
    FOR TABCOL IN C1
    LOOP
        stmt_tabcols := stmt_tabcols ||TABCOL.COLUMN_NAME||',';
    END LOOP;
        stmt_tabcols := RTRIM(stmt_tabcols, ',');
        RETURN stmt_tabcols;
    END;
    SELECT EXCEPTION_MERGE('WC_W_TEST_FS','WC_W_TEST_FS_GBL') FROM DUAL;It throws, below error:
    ORA-06502 : PL/SQL : Numeric or value error : character string buffer too smallIf I REPLACE TABLE_NAME and TAB_NAME with hard coded values , it works fine. Can somebody look at the code and let me know the issue.
    Edited by: ace_friends22 on Sep 9, 2012 1:08 PM

    Etbin neatly demonstrating the value of posting code in a manner which makes it easy to read.
    It's obviously an naming/scoping issue. Faced with a join like this:
    where table_name = table_namethe engine looks for something called table_name in the current scope. It finds it, a column on USER_TAB_COLUMNS and applies it to both sides of the filter. It has no way of knowing that there is also a parameter called TABLE_NAME, because that is outside its current scope. Consequently the query will join every table in your schema regardless of what values you pass, and that's why you blow the buffer.
    Takw etbin's advice and name your parameter with a prefix:
    where table_name = p_table_nameThis isn't a column in USER_TAB_COLUMNS which will force the engine to look in the next scope up, which in your case is the function, where it will find your parameter and so generate a query for the passed values only.
    Cheers, APC
    Edited by: APC on Sep 9, 2012 8:03 AM

  • Using a date variable in a where clause

    Hi,
    I need to run a select query which contains the following
    e.g
    String query = SELECT APP_DATE, APP_TIME, APP_TYPE, a.CUST_NO
    FROM APPOINTMENTS a, PATIENT_DETAILS p
    WHERE APP_DATE = " + appDate + " and p.CUST_NO = a.CUST_NO
    appData is a java.sql.Date format and contain the date i want to find. The error i get is "Operator = doesn't apply to the types <DATE> and <INT>"
    I have also read somewhere that this would return the date at midnight and therefore would not match, how can i fix this. I am using JDataStore for development.
    Thanks
    Rudy

    you want something like this
    SimpleDateFormat df = new SimpleDateFormat ("yyyy-MM-dd");
    String sql = "SELECT * FROM Table WHERE appDate='" + df.format(appDate) + "';";     
    Or if you used prepared statements, you could pass the java.sql.Date to it without the need to convert.

  • Tree issue using a where clause

    Tree created
    select "ID" id,
    "PARENT_ID" pid,
    "TITLE" name,
    "LINK" link,
    null a1,
    null a2
    from apexim.TREE_NAV
    I am attempting to alter this tree this way
    select "ID" id,
    "PARENT_ID" pid,
    "TITLE" name,
    "LINK" link,
    null a1,
    null a2
    from apexim.TREE_NAV
    WHERE INSTR(PAGE_ID_1,:app_page_id) > 0
    This returns rows in PL/SQL however does not return tree values to the page.
    this throw the error
    Warning: Tree root ID "1" not found.
    When I change the where clause to:
    where 1=1
    I get all the enitire tree as i would expect.
    We are creating a report delevery application that will allow people to see specific leaves passed on authority level.
    The Tree_nav table ha the url for the page to display and has the page_id_1 for the portal that launches specific content page.
    So ultimatly I will include the following into the where clause
    (and authority_level <= :p100_auth_level)
    I have tried several things and am at wits end.

    rbackmann wrote:
    And the page_id_1 is a field in the table (SORRY EXAMPLE BAD NAMING CONVENTIONS) that IS VARCHAR
    and houses a comma seperated list of page numbers ie 28,29, 30Okay, I was wrong about the field name :(
    Carefully examine the query, expecially the INSTR line. Get the values in both the column and the bind variable and make sure they are what you think they are.
    The example on the other post might have failed because you were equality comparing the column value to '28' when it might have been a csv with commas unless you changed it (something worth trying).
    On 4th look I may (or may not) have something. PAGE_ID_1 is a VARCHAR2, while the 28 you compared it to was a number. Its a long shot, but maybe SQL is trying to convert the csv field to a number, failing to raise an error message where you can find it, and failing for that reason. Try using '28' on the equality test.
    Edited by: riedelme on May 8, 2009 6:03 AM

  • Less than one day

    Hi all,
    I want date like posting date should be system date -1.
    I am doifn like this.
    select-options : s_budat for rbkp-budat.
    loop at s_budat.
    s_budat-sign = 'I'.
    s_budat-option = 'Eq'.
    s_budat-low = w_date - 1.
    append s_budat.
    endloop.
    from above result I am not getting the less than one day of sys date.
    But every time I want less than oneday of sys date.
    I need to work with Range table only not parameters.
    thanks for your help.
    Ajay reddy

    Hi Ajay,
    Not sure of understanding...but take a look :
    loop at s_budat.
    s_budat-sign = 'I'.
    s_budat-option = 'BT'.
    s_budat-low = sy-datum - 1.
    s_budat-high =sy-datum .
    append s_budat.
    endloop.
    Hope this helps,
    Erwan

  • Goods receipt date should be greater than the P.O. date

    Hi
    Is there any option to control the Goods receipt date should not be lesser than the P.O.Date??
    Eg: P.O. is raised in 10.1.9, User should not do the GRN before 10.1.9. In which way we can control  this???
    Regards
    Ravi

    Dear,
    You have to include User exit in MIGOwhich will trhrow an error at the time when Goods receipt date is greater than the P.O. date.
    Regards
    Utsav

  • Report data showing a date 1 day greater than selection formula end date

    Hi All,
       I have a report that contains the following selection:
    date(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) >= date(minimum({?Date})) and date(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) <= date(maximum({?Date})) and dayofweek(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) in {?DayOfWeek} and
        time(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) >= time({?Start Time}) and
        time(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) < time({?End Time})
    When I view the report, if my date(maximum({?Date}))  is 5/1/2011, the report shows data for 5/2/2011. I can't seem to figure out why my report is generating data for a date that is 1 day greater than my end date.
    Any suggestions would be appreciated.
    Thank you in advance,

    No need to send SQL as dates are not in WHERE clause.
    It someting to do with the way crystal handles datetimes
    If you want to see dates up to an including 6/2/2011 if its a date time crystal will create a where caluse
    Datetimefield <= 6/3/2011 00:00:00
    Looks like when this is converted to date its stayin as 6/3/2011
    Sorry can't think of any solutions, also I live in UK so just about to leave, hopefully some one else may be able to offer a solution.
    Ian

  • Query with = only provides the 'less than' portion of the results

    I have a query that checks dates to be >= start date and <= end date.
    The results are always >= start date and < end date.
    The same where clause in sqlplus works just fine. Is this a bug in BI Publisher?

    Correct, the ipad I was testing with is the ipad air that came out in Oct/Nov 2013 I believe.   Though the iphone 5s is the latest version as well that I was using to test.
    I had 2 expresses connected wirelessly and 2 extremes (both connected via ethernet).   Based on your point about the wirelessly extended I ended up taking one of the Expresses and connecting that via ethernet to extend the network.  When I re-ran the same tests I had the following based on two tests:
    Ipad air:  58.77/38.06   and 55.64/38.35
    Iphone 5s:   37.48/29.12  and 60.08/29.12   (big difference)
    I've done a factory reset a number of times on these devices.  I just tried it again for the one remaining airport express that I'm unable to connect on a regular basis via ethernet.  I need this one connected to the network as I use it for the airplay feature for audio to our sound system.  That thing absolutely does not show up unless I connect it first to ethernet.  

  • Date functions in WHERE clause? HELP

    The following two queries are identical except for how I supply the date values in the where clause, yet the first query using the a custom my_date function runs 30x slower than the one using the TO_DATE() function. Both return DATE types...any reason for the difference?
    SELECT * from outcomes
    WHERE start_time >=fn_my_date('START_MONTH')
    AND start_time < fn_my_date('END_MONTH')+1
    -- This runs 30x faster--
    SELECT * from outcomes
    WHERE start_time >=TO_DATE('08/01/2001','MM/DD/YYYY')
    AND start_time < TO_DATE('08/31/2001','MM/DD/YYYY')+1
    On the flip side, I've also experienced queries running slower using the TO_DATE() function vs the LAST_DAY(sysdate) for equivalenet dates.
    null

    I haven't seen the message coming up when using LENGTH or SUBSTR, but every time I connect to a database or attempt to change my preferences (including the "NLS Parameters: Comp" preference), this appears.
    You are attempting to set the preference you should be to switch this from ANSI to something else, but SQL Developer is ignoring the preference setting (which I think is a bug).
    A way to set the NLS_COMP to something else is to use something like "alter session set nls_comp = BINARY;". Note that changing any preference after that appears to overwrite this and you need to do this for each new connection you start.

Maybe you are looking for