Tricky query call on dates

Hello,
I have table such that:
SQL> desc sample_table;
Name Null? Type
USER VARCHAR2(30)
TIMESTAMP DATE
ACTION VARCHAR2(100)
In the table I have values like this:
USER TIMESTAMP ACTION
FRED 5/8/2002 8:47:52 AM OPEN
FRED 5/8/2002 8:50:33 AM CLOSE
JOHN 5/8/2002 8:53:57 AM OPEN
ANN 5/8/2002 8:54:17 AM OPEN
JOHN 5/8/2002 8:55:02 AM CLOSE
ANN 5/8/2002 8:58:43 AM CLOSE
ETC....
I am displaying this information in FORMS 6i.
So I have defined the USER field as a character field.
The TIMESTAMP is a date field and I have a format mask = 'DD-MON-YYYY HH24:MI:SS'
The ACTION is another character field.
I also have and 'ON-ERROR' trigger on the TIMESTAMP field to format the date correctly. IE: if they enter 5/08/2002 it will automaticly return as 08-MAY-2002. The format mask will make it 08-MAY-2002 00:00:00
I wanted to execute a query on the timestamp field. Now if I just enter a date like 08-MAY-2002 I will get no returns. I understand this as it would try to match up the TIMESTAMP field with 08-MAY-2002 00:00:00, which there is none.
I tried to create a block query for 'KEY_EXEQY' such that:
DECLARE
where_cl VARCHAR2 (5000);
date_c1 VARCHAR2 (25);
BEGIN
date_c1 := '''' || TO_CHAR (:sample_table.TIMESTAMP, 'DD-MON-YYYY') || '''';
IF :sample_table.TIMESTAMP IS NOT NULL THEN
where_cl := get_block_property ('sample_table', default_where);
IF where_cl IS NULL THEN
where_cl := 'TRUNC(TIMESTAMP) = ' || date_c1;
ELSE
where_cl := where_cl || ' AND TRUNC(TIMESTAMP) = ' || date_c1;
END IF;
set_block_property ('sample_table', default_where, where_cl);
END IF;
execute_query;
set_block_property ('sample_table', default_where, '');
END;
But when I tried to execute the query but entering 08-MAY-2002 in the timestamp field I recieved an error saying 'Query cause no record to be retrieved.'
I have tired to remove the 'ON-ERROR' trigger on the TIMESTAMP field but it did not change anything.
Since the database time field has the HH:MI:SS how can you query on that field (and have it return the values for that specified date)? How can you also allow it to accept other values for the query (IE: On the form press F7 and then for USER type FRED and for TIMESTAMP enter 08-MAY-2002 then press F8 to query it (should return all records where user is FRED and the TRUNC(TIMESTAMP) = '08-MAY-2002')) and return the desired results.
Any have a solution or idea?

Yes, I also tried a similar piece of code for Pre-Query.
I also recieved an email suggesting:
Present is = date_c1 := '''' || TO_CHAR (:sample_table.TIMESTAMP,
'DD-MON-YYYY') || '''';
Try for = date_c1 := '''' || TO_CHAR (:sample_table.TIMESTAMP,
'DD-MON-YYYY') || '''' || %
I would tend to think this would work but when I attempted it I would still recieved the same error notice.
For some reason it does not like me replacing the where clause. If I force the where clause in KEY_EXEQRY or the PRE-QUERY it works (IE: set_block_property ('sample_table', default_where, 'trunc(timestamp) = '||''''||'08-MAY-2002'||'''') ) Stange how it can work in once case but when I try to use a variable it just blows up. I wonder if has anything to do with using the :sample_table.TIMESTAMP field as a source for the variable?

Similar Messages

  • How to run recordset SQL query in FORM DATA event

    How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?

    Hi Slamet,
    When you receive a form data event you have a class containing inside it a ObjectKeys xml info regarding the object added/modified,...
    With the objects keys you can then use the DI API method called GetByKeys to obtain the DI Object.
    There is some information about it in the SDK Help file, mainly in the "FormDataEvent" class definition:
    <i>The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.</i>
    Pay attention you don't have this information in the Before=True event of the Add as it is not yet in the database.
    Hope it helps
    Trinidad.

  • How to use OData Date filter query to filter data from OData NetWeaver Gateway Service?

    Hello,
    I am trying to use the OData Filter query. to filter data records from the OData Service, using Date range for filters.
    Please check the below URL for the SAP's sample OData Service, with filter option.
    Service Query URL :
    https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/SalesOrderCollection?$filter=CreatedAt eq DateTime
    It gives out following error :->
    <message xml:lang="en">'$filter ' is not a valid system query option</message>
    Please let me know, if there is any mistake in the Query or is there anything that needs to be done on the
    Backend  Service.
    Thanks & Regards,
    Suraj Kumar

    Hi Jitendra,
    Once again, thank you for your help.
    I am able to filter the records using a date range.
    I am sharing the information, just in case anyone out there might need it.
    The OData Filter Query for Date Range (i.e. with Two date values) will return the results only if the OData Back-end Service is modified to accommodate such filter requests.
    This has to be done in ABAP.
    Please refer the following links which talks more about the Back-end ABAP Service being modified to ensure that the service returns records of data, as per the date range filter query
    http://scn.sap.com/thread/3170195
    http://scn.sap.com/blogs/lindsay.stanger/2012/12/29/gateway-odata-calls-convert-ivfilterstring-to-itfilterselectoptions
    http://scn.sap.com/thread/3173146
    Hope these links are helpful for those looking for OData Date Range filter query.
    Do let me know.
    Regards,
    Suraj Kumar.

  • Querying uncommitted session data in SQL Developer debugger

    I'm trying to analyze a large PL/SQL program that performs table creation, data insertion, and conditional updates to temporary tables. Is there a way to query the uncommitted data in the session in which the PL/SQL is running while stopped at a breakpoint? I see that watches make variables available for inspection, but I'd like to query data in the temp tables using a select statement to see what is there while the debugger is stopped at a breakpoint.
    This is using SQL Developer 1.2 on MS Windows XP against an Oracle 10g database.

    Well, no. You'd have to change your code to include these calls and fill variables you can monitor with the debugger. A lot of work in development, impossible for production...
    This would make a great request for the SQL Developer Exchange though: like the VB/Access Immediate window, a worksheet linked to the debugger session. You'll have my vote if you add it.
    K.

  • Anomaly when query timeout in Data buffer

    Hello experts
    I'm using MII12.2 and query buffered (allow buffering flag) on a database with several tables locks.
    When I get a query timeout (LastErrorMessage of the query is "Response timed out, request terminated"), the query is not queued in the buffer.
    Just if I send the query to the buffer setting a wrong used id in the dataserver, then the manager works properly (when I restore the used id, the query completes its logic when the lock is released)
    If anybody wants to replicate the enviroment, the query for table lock in SQL Server is
         BEGIN TRANSACTION
         SELECT * FROM [your table name] WITH (TABLOCKX, HOLDLOCK);
         WAITFOR DELAY '00:10:00'
         ROLLBACK TRANSACTION
    You have to run it in SQL Manager, not in MII
    Sequence:
    - Create in MII a generic query with SELECT * FROM [your table name], and enable "allow buffering"
    - Call it in a transaction (if you want, with exception handler)
    - Run the lock query in SQL Server
    - Run the transaction (while the table is locked by SQL Server query) and wait transaction/query error
    - Check data buffer: the MII query is not buffered
    Is it normal?
    Is there any patch?
    Thanks
    Regards
    Fabio

    Hi Fabio,
    I think the query does not gets buffered because no communication error happened.
    MII would buffer an external call if there is a communication error.
    But in your case the communication happened fine and the DB did not gave the response and thus time out happened. One more scenario of this type is if we write a query with syntax error. Here also the communication will happen with the DB but the DB will give the error thus MII will not buffer the query.
    Regards,
    Rohit Negi.

  • Query displaying from date & to date selected from calendar

    Hello every1,
    I just want to create a query which will display from date and to date which i need to select it from the calendar.
    Can any1 help me out for it.

    HELLO,
    ACTUALLY I HAVE A FIELD CALLED DUE DATE IN MY UDT WHERE I HAVE ENETERED  SOME MY DUE DATES. NOW WHEN IAM CREATING A QUERY FOR DUE DATE AS FOLLOW:
    SELECT * FROM DBO.[@LC_OV_H]  T0 WHERE T0.DUEDATE>='[%0]' AND T0.DUEDATE<='[%1]'
    IT IS GIVEN ME A LIST OF THE DUE DATES WHICH I HAVE ENTERED BUT HERE I WANT A CALENDER TO BE DISPLAYED DURING SELECTION.........
    Edited by: MEGHSHILPK on Jul 17, 2010 10:07 AM

  • Auto-expire from query based on date

    I have some records in my MySQL db that contain dates for upcoming events.. I need a way to query upcoming events and expire them from the query once the date passes without necessarily deleting them from the database. (I'm publishing the next 5 upcoming events to the homepage via 'LIMIT 5').
    Is there an easy way to do this within a MySQL db query? This section of the site (both insert record, display, current query, etc) is all created with ADDT.
    Please let me know!
    Thanks!

    Hi Nathan,
    I reckon you´d just need to display those events which come later than what MySQL calls "CURDATE()"
    (aka "current date") -- so a query like...
    SELECT * FROM tablename WHERE CURDATE() > 'datefield'
    ...should filter the past dates. Works ??
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Query between two date columns ?

    Oracle 11g R2
    I'm trying too create a query between two date columns. I have a view that consists of many columns. There are two columns in question called valid_to and valid_from
    Part Number     Valid_from        valid_to
    100                    01/01/2000       01/01/9999
    200                    01/01/2000       01/01/9999
    300                    01/01/2000       01/01/9999
    etc
    If I want to only see rows between with a date range of 01/01/2000 and 01/01/2013 how can I put this as SQL ?
    Thanks in advance

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    See the forum FAQ: https://forums.oracle.com/message/9362002
    If you want to find rows that have that exact range, then you can do  something like
    SELECT  *
    FROM    table_x
    WHERE   valid_from  = DATE '2000-01-01
    AND     valid_to    = DATE '2013-01-01'
    If you want to find rows where any or all or the range on the row overlaps any or all of the 200-2013 target range, then
    SELECT  *
    FROM    table_x
    WHERE   valid_from  <= DATE '2013-01-02
    AND     valid_to    >= DATE '2000-01-01'
    If you want rows that are enritely within the target range, it's something else.
    If you want rows that entirely enclose the target range, it's something else again.

  • Dashboard to BEx query call run time very slow (7-8 mins)

    Hi Guys,
    I am currently working on a project where BEx query is being consumed using BICS. The functional team has built a BEx which is being cached in Webi by the BO developer and then that cashed Webi is being used in Dashboard. We have many hierarchies (Fund Center, Profit Center, GL Account etc.) used in the dashboard.
    BEx query > WEBi (Cached) > Dashboard
    Clicking the main level in hierarchy in dashboard the data comes back in 2-3 secs as the data is cached in Webi
    ISSUE: In Dashboard based on where user is on the Fund Center hierarchy there is a button called “Summary Report” on the dashboard which calls the BEx query and that second call takes roughly about 7-8 minutes. How could we reduce the run time of the second query?
    The secondary query uses the same data set as the first one but as the data is cached in Webi and it uses Web services to pass data to dashboard, so any call back from dashboard to the cached webi the hierarchy information is lost  and thus the secondary query call to BEx query.
    Would it be possible to recommend any solution where we could bring the run time of the secondary call to less than a minute?
    Thanks,
    Keys

    First update to current frontend patch. many correction are included.
    Further check these notes: (relavant only if Analyzer is culprit)
    1160093: REPAIR MODE - Prog error/performance problems when using large workbooks
    1289127: REPAIR MODE - BExAnalyzer: performance issue applying styles in Excel 2007
    1293255: REPAIR MODE - BExAnalyzer: crash when repairing workbook with Excel 2007
    1150242+1094799: ANA_USE_SIDGRID - Improving performance/memory in the BEx Analyzer
    1179647: ANA_USE_TABLE - Performance: Network load in BEx Analyzer
    1260213: ANA_USE_OPTIMIZE_STG - Performance problems during workbook opening in Excel 2007
    1287179: ANA_SINGLEDPREFRESH - Single Data Provider Refresh
    1286653: Performance issues while displaying hierarchy (especially in Excel 2007)
    1352375: ANA_USE_SIDGRIDWBUF / ANA_USE_SIDGRIDMASS Performance improvements in a WAN (roundtrip reductions)
    1373214: Workbook compression
    1392745: ANA_CACHE_WORKBOOK - Workbook caching

  • Getting data in a query on last date of all previous months

    Dear Experts,
    I need your help with a query.
    I am trying to create a query which when run should pick the number of Open Sales Order on the last date of all the previous months from the start of company.
    I could create the query for fetching the required data on last day of the previous month, say today is 25th June 2014, so my query only fetches data for May 31st 2014 but I need data for all previous month, May 31st 2014, April 30th 2014, March 31st 2014 & so on.
    Please advise how to achieve this is SQL query.
    Thanks & regards,
    Nitin

    Hi,
    Try this:
    Select *
    from(
    SELECT T0.[DocNum] as #,t0.cardcode as C, t0.docdate
    FROM ORDR T0
    WHERE T0.[DocStatus] = 'o' and T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-1,0)),10) OR T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-2,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-3,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-4,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-5,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-6,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-7,0)),10)
    group by t0.cardcode,docdate,T0.[DocNum]) S
    pivot
    (count(#) for c in([cvt01],[cvt02],[cvt03],[cvt04],[cvt05],[cvt06],[cvt07],[cvt08],[cvt12])) P
    Note: Replace Cvt01,02...with your customer code.
    Thanks & Regards,
    Nagarajan

  • POWER QUERY Get External Data From File From Folder (Excel 2013)

    Hi,
    Beginner's question :
    What could be the use of the query on a folder : we just get a list of files with their path. What can we do with that?
    Thanks

    Hi,
    Do you want to combine data from multiple Excel Files in the same folder path into one table? If I understand correct, we can add a custom column to import the data.
    After we getting a list of files with their path, the Query Editor window will activate to show you a table containing a record for each file in the chosen directory. These will provide our function with the needed FilePath and FileName parameters. 
    Function sample: File name([Folder path],[Field name]
    For more detailed steps, please see the article:
    http://datapigtechnologies.com/blog/index.php/using-power-query-to-combine-data-from-multiple-excel-files-into-one-table/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Data driven subscription query returns no data

    We have a data driven subscription on SSRS 2008 R2. The columns in the query are tied to one or more parameters of the report. When we run the subscription and if the query does not return any rows, I was hoping that the subscription will not start; however,
    instead, to my surprise, I got error stating..."Parameter XYZ value can't be null". How to avoid this error and keep subscription from running in this situation? 
    Example: I have a report that required employeeID as a parameter. I have a query (step 3: data driven subscription) that fetches employee ID based on some criteria. If there is no row returned by the query; It throws error on report stating "Parameter
    EmployeeID can't be null."
    Nehal Jain

    Hello Nehal -
    Try adding a UNION ALL to your parameter dataset query like
    UNION ALL SELECT NULL AS EmployeeID , ..
    Just check accordingly. I ll revert again based on this , got a priority now.
    Happy to help! Thanks. Regards and good Wishes, Deepak. http://deepaksqlmsbusinessintelligence.blogspot.com/

  • Web Analysis Error -- Error while executing query and retrieving data

    Regarding Web Analysis:
    We have a number of reports that we created. yesterday they were all working fine. today we try to open them and most are generating an error.
    The error is:
    Error while executing query and retrieving data.; nested exception is:
    com.hyperion.ap.APException: [1033] Native:
    1013033[Thu Oct 22 09:08:17
    2009]server name/application name/database name/user name/Error91013033)
    ReportWriter exit abnormally
    Does anyone have any insight into what is going on?
    My version information is:
    Hyperion System 9 BI+ Analytic Administration Services 9.3.0.1.1 Build 2
    Web Analysis 9.3.0.0.0.286
    Thanks in advance for your help.
    DaveW

    Hi,
    And also click on check option by opening the query in Query designer,as Mr . Arun suggested.
    And if you get any error in checking, see the long message(detail).
    With rgds,
    Anil Kumar Sharma .P

  • I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add

    I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add APN. Now when i switch to safari its showing you are not subscribed for cellular data. But I am able to use data on other phone.
    Will you please help me in this regard?
    Another issue, since i bought my new iphone there is dust inside back main camera.
    Your advises are highly appreciated.

    Hey Shaiju isac,
    I'd take a look at the following article, it'll guide you though steps to you troubleshoot cellular data issues on your iPhone:
    iPhone: Troubleshooting a cellular data connection
    http://support.apple.com/kb/ts3780
    Cheers,
    David

  • XML Publisher report stuck at Calling XDO Data Engine...

    Hi !
    I am upgrading a custom report from 11i to R12 , the report works fine in 11i but when moved to R12 the report is stuck at "Calling XDO Data Engine..." and then it doesnot parse the Template.
    Below are the logs from the request:
    XDO Data Engine Version No: 5.6.3
    Resp: 51234
    Org ID : 109
    Request ID: 29953138
    All Parameters: p_kombi=:p_orderno=:p_batch_id=521007
    Data Template Code: XX_TEST
    Data Template Application Short Name: XX
    Debug Flag: N
    {p_kombi=, p_batch_id=521007, p_orderno=}
    Calling XDO Data Engine...
    Please suggest what can be the issue?
    I have checked both Data template and RTF template too. They are fine.
    Thanks in advance

    Hi Alex!
    Thanks for your response..
    Yes the concurrent job  keeps on running with this entry in the log file.
    I have tried this option also of just uploading XML data template and getting the XML output but it is also the same.
    There is no change in the XML file in 11i and R12 instance. Is it that some extra setups has to be done in R12?
    The general settings of temp table is there, I have checked that.
    Thanks in advance

Maybe you are looking for