Date Query With Restricted Dates

Sorry not really an easy thing to explain:
I have specified in a Query that i Only want values with a date BETWEEN:
01JAN2002 08:00 AND 01SEP2003 08:00
Now in the same query, what is the simplest way to restrict that only the following dates are examined and not all the dates within the above time window:
Say 06/01 - 07/01
The following dates i am looking to analyze will thus be
01JUN2002 08:00 - 01JUL2002 08:00
01JUN2003 08:00 - 01JUL2003 08:00
Thanks

Had a little bit more time to test, today. So in case you couldn't find the complete soultion yourself, here you go. The records with flag='Y' are the ones that fit within your selection criteria (between any 7-OKT 8:00AM and 8-OKT 8:00AM).
drop table testDate;
create table testDate(id number,flag char,yourDate date);
insert into testDate values (1,'Y',to_date('7-OKT-2003 11:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (2,'Y',to_date('8-OKT-2003 7:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (3,'N',to_date('7-OKT-2003 3:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (4,'N',to_date('8-OKT-2003 11:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (5,'Y',to_date('7-OKT-2002 11:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (5,'N',to_date('6-OKT-2002 11:00:00','DD-MON-YYYY HH:MI:SS'));
insert into testDate values (5,'N',to_date('9-OKT-2002 11:00:00','DD-MON-YYYY HH:MI:SS'));
commit;
select id,flag,to_char(yourDate,'DD-MON-YYYY HH:MI:SS') from testDate
where trunc(yourDate,'HH')-trunc(yourDate,'YYYY')
between to_date('7-OKT-2003 08:00:00','DD-MON-YYYY HH:MI:SS')-to_date('01-JAN-2003')
and to_date('8-OKT-2003 08:00:00','DD-MON-YYYY HH:MI:SS')-to_date('01-JAN-2003')
/

Similar Messages

  • Query To update a date column with a date of my interest

    All,
    How to update a column in a table which is in date format with a date of my interest??
    Pls suggest.

    Please detail :
    1. what exactly you are trying to do
    2. what exactly you have done
    Nicolas.

  • Error in viewing data in a data template with multiple data sources

    Hello,
    I have designed a data template with two data sources.One is from DEPARTMENTS table and the other datasource is a xml file.Following is the code for the data template :
    <dataTemplate name="EmployeeListing" dataSourceRef="demo">
    <parameters>
    <parameter name="p_DEPTNO" dataType="character" defaultValue="20"/>
    </parameters>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[SELECT DEPARTMENT_NAME,DEPARTMENT_ID,LOC from DEPARTMENTS]]>
    </sqlStatement>
    <xml name="empxml" expressionPath=".//ROW[DEPARTMENT_NAME =$DEPARTMENT_NAME]">
    <url method="GET" realm="" username="" password="">file:///D:\OraHome_1\xmlp\XMLP\DemoFiles\Employee Salary Report.xml</url>
    </xml>
    /dataQuery>
    </dataTemplate>
    The problem is when i am trying to view the data, only data from SQL Query Q1 is getting displayed and the data from Employee xml is not at all getting displayed.
    Could anyone please let me know what i am missing?
    Thanks
    Nutan
    Edited by: user609971 on Oct 23, 2008 8:06 AM

    This is from Documenation sample....
    Did you see the data structure section, where you say, how you wanted the columns ?
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    <dataTemplate name="Employee Listing" description="List of Employees" v
    ersion="1.0">
    <parameters>- Defines a single parameter for the Department Number
    - with default of 20:
    <parameter name="p_DEPTNO" dataType="character"
    defaultValue="20"/>
    </parameters>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[SELECT DEPTNO,DNAME,LOC from dept
                      order by deptno]]>
    </sqlStatement>
    <xml name="empxml" expressionPath=".//ROW[DEPTNO=$DEPTNO]"> - Defines name
    - and link to DEPTNO in Q1
    <url method="GET" realm="" username="" password="">
    file:///d:/dttest/employee.xml</url> - Defines url for xml data
    </xml>
    </dataQuery>-
    <dataStructure>- The following section specifies the XML hierarchy
    - for the returning data:
    <group name="G_DEPT" source="Q1"
    <element name="DEPT_NUMBER" value="DEPTNO" />
    <element name="DEPT_NAME" value="DNAME"/>
    - This creates a summary total at the department level based
    - on the salaries at the employee level for each department:      
    <element name="DEPTSAL" value="G_EMP.SALARY"
    function="SUM()"/>
              <element name="LOCATION" value="LOC" />
    <group name="G_EMP" source="empxml">
    <element name="EMPLOYEE_NUMBER" value="EMPNO" />
    <element name="NAME" value="ENAME"/>
    <element name="JOB" value="JOB" />
    <element name="MANAGER" value="MGR"/>
    <element name= "HIREDATE" value="HIREDATE"/>
    <element name="SALARY" value="SAL"/>
    </group>     
    </group>
    </dataStructure>
    </dataTemplate>

  • Not able to save date column with custom date format. in OBIEE 11g

    Hi,
    I have migrated one report from OBIEE 10g to 11g. There is a date column with customized date format(i.e. Default format is 'dd-MMM-yyyy' and I have used 'MMM-yyyy').
    But when I use this custom format and try to save the report in 11g its giving this below error.
    ''Catalog object privilege validation failed for user to path /shared/ALM BI/Finacial Results/History Income Statement Detail.
    You do not currently have sufficient privileges to save a report or dashboard page that contains HTML markup.
    This HTML might be present in column headings, table headings, text views, narrative views, the print header,
    or the print footer and must be removed before saving.''
    Please let me know what changes I need to do for this.
    Regards,
    Ambika Nanda.

    Hi ,
    privilage issues...check the security settings once..
    Thanks,
    Ananth

  • Filling bc travel data model with test data

    Hey i read somewhere that there is a app to fill the bc travel data model with test data.I been searching but havent found one in the preview version.Please help me if anyone knows how to get it done.Filling it manually is taking a whole lot of time.

    Go to the ABAP Editor (SE38) and execute the SAPBC_DATA_GENERATOR program. This program generates suitable sample data in the tables of the flight data application.

  • Input ready query with default data

    hi expert
    How do I make input ready query to have a default value when signing in using WAD?
    thanks.

    Hi,
    Use the following document for your query. If found useful do grant me number!
    Revaluating Planning Functions (with Analysis Web Item)
    Use
    You want to build a planning application with which you can enter turnover amounts for certain account numbers and revaluate them using a factor that can be set. If you select a row of the table, only the amount in this row is to be revaluated. If you do not select any rows, all values are to be revaluated. The planning application is to look roughly as follows on execution:
    This example serves in particular to clarify the interaction between a planning function and an Analysis Web item. Special properties here are:
    &#9679;      Variable handling in the planning function
    &#9679;      Row selection in the Analysis Web item
    Prerequisites
    In the planning modeler, you have created an aggregation level that contains the following InfoObjects: unit Currency Key, time characteristics Quarter and Calendar Year, key figure Amount, characteristics Version, Account Number, Cost Center.
    The planning function and the query are to use the same data of this aggregation level.
    Procedure
    Planning Modeler: Creating Planning Functions, Variables, and Filters
           1.      Choose the Planning Functions tab page and create a planning function of the type Revaluate with technical name REVALUATE and description Revaluate for your aggregation level.
           2.      On the To the Parameters tab page, use the input help for the revaluation factor to create the REVAL_FACTOR variable with the Revaluation Factor description. The variable is to be specified in detail as follows: The variable is to be a required variable and is to be input ready; it is to be of type Number, but is not to contain a standard default value.
           3.      Choose the Filter tab page and create a filter with technical name ACCOUNT_FILT and description Revaluation Selection for your aggregation level.
    Select the characteristics one after another and choose the input help icon in the column after Characteristic Restrictions. The dialog box for specifying characteristic restriction appears. Specify the required restrictions (in our example, Version = VERSION 1, Quarter = QUARTER 1, Calendar Year = 2007; Cost Center = 100002, Currency = Euro; for Account Number, all values are taken over), choose Add, and save the selections by clicking OK.
    Choose Show Extended Settings and ensure that the Version characteristic cannot be changed on execution. (It must be possible to change the Amount key figure).
    More information about creating planning functions, variables, and filters: Modeling Planning Scenarios
    BEx Query Designer: Creating Queries
           1.      In the BEx Query Designer, create a query Revaluate (technical name: QUERY_REVALUATION) for your aggregation level.
           2.      Drag and drop the ACCOUNT_FILT filter into the Characteristic Restrictions area for filter values. In doing so, all characteristics are restricted to single values.
    Drag and drop the Account Number characteristic into the area for default values.
           3.      Specify that the Account Number characteristic is in the rows. The values for this come from the master data.
    Specify that the Amount key figure is in the columns. The values for this can be changed; on the Planning tab page, choose the Data Can be Changed Using User Input or Planning Functions option.
           4.      Save your query definition.
    BEx Web Application Designer: Creating Web Templates
           1.      In the BEx Web Application Designer, create a Web template with technical name REVALUATION.
           2.      Create the following data providers:
    &#9675;       DP_PLAN_DATA of the type Query View Data Provider, based on query QUERY_REVALUATION
    &#9675;       DP_FILT_REVALUATION_FUNCTION of the type Filter. The data binding should come from the ACCOUNT_FILT filter.
           3.      Create the following Web items:
    &#9675;       INPUT_FIELD_REVALUATION_FACTOR. Specify 10 as the default value (Internal Display ® Text: 10).
    &#9675;       BUTTON_GROUP_ REVALUATION. Using Internal Display, create pushbutton1 with label Revaluation and, as Action, use the command wizard to assign the following commands (INSTRUCTION):
    Table of Commands
    Command
    Parameters
    Data provider-specific command: SET_SELECTION_STATE BY BINDING (Set Filter Values According to Different Sources)
    &#9679;      Command target: target data provider DP_FILT_REVALUATION_FUNCTION
    &#9679;      Data binding: selection binding using the Account Number (ZD_ACCNT) characteristic, where the value of the Web Item Selection binding type is to come from the ANALYSIS_ITEM_1 Web item, characteristic Account Number (ZD_ACCNT).
    Planning-specific command EXEC_PLANNING_FUNCTION_SIMPLE (Execute Planning Function )
    &#9679;      Data binding: Reference to data providers of type Filter DP_FILT_REVALUATE_FUNCTION, where the value from variable REVAL_FACTOR of connection type Web Item with Manual Input (ITEM_INPUT) is to come from INPUT_FIELD_REVALUATION_FACTOR.
    &#9679;      Command-specific parameter: planning function REVALUATE
    &#9675;       ANALYSIS_ITEM_1. Data provider DP_PLAN_DATA is assigned to the analysis grid as the (source) data provider.
    Choose Behavior ® Row Selection ® Multiple (MULTIPLE).
    In this case, it must be possible to select multiple rows and to execute the revaluation command on all selected rows. It is not therefore possible to give the command along with the row selection; the command must instead be given using pushbuttons.
           4.      Create a CONTAINER_LAYOUT_ITEM_1 (Web Items ® Enhanced ® Container).
    Divide the container into columns, choose the With Tray display option, and enter label Revaluation under Tray Settings.
    Add the following Web items to the container:
    &#9675;       1st row, 1st column: INPUT_FIELD_REVALUATION_FACTOR
    1st row, 2nd column BUTTON_GROUP_ REVALUATION
    &#9675;       2nd row, 1st column (with option Colspan=2, that is, with a merge of columns 1 and 2): ANALYSIS_ITEM_1
    The following figure illustrates the layout of the REVALUATION Web template:
    Execution on the Web
           1.      Execute the Web template on the Web.
           2.      For testing, extend the URL to include parameter &debug=X.
    If you have set this parameter, the selection is shown in the Executing Planning Function section.
           3.      Enter amounts for one or more account numbers, change the revaluation factor if necessary (default value = 10), select the required rows, and choose Revaluation.
    For example, enter amount 100 in the first row, retain revaluation factor 10, and choose Revaluation. The query outputs an amount of 110 in both the selected row as well as in the overall result (as long as you have not entered any other values).
    Regards,
    SUbha

  • Problem with 'restrict data' option in Web Analysis' Analysis Tool

    I feel like i'm in the twilight zone.
    We have made a report in web analysis, withh essbase as a source, and works fine.
    We want to restrict data for customers that generate more than 1,000,000 revenue, for example
    So, we go to Analysis tools, restrict data. The dialog window opens
    We hit 'Select Column...' and nothing happens. No Column is shown, thus being unable to complete the dialog.
    Should we enable something in essbase to allow this? We are newbies, but we think this should be pretty straightforward.
    We have also tried to do that with the Analysis tools administrator, with the same result.
    We are using Web Analysis 9.3.1.
    Any feedback will be appreciated.
    Thank you
    Edited by: hectorsosar on 22/06/2009 02:31 PM

    It got fixed by removing a filter from a dimension, and placing that dimension as a page.
    Thanks,
    Hector

  • Error when executing Query with user date settings = mm/dd/yyyy

    Hi all,
    I created a remote cube with datasource = TCURR table with proper conversion of the date etc.
    The query on top of this remote cube works fine if my user date settings is set to dd.mm.yyyy
    But when a user in USA, with user date settings = mm/dd/yyyy, executes the same query, they get a message
    SYST: Date 31/05/2006 not expected.
    Message no. FGV004
    The input variable on the Query is on 0CALMONTH.
    This message appears immaterial of what calmonth input I give.
    has anyone encountered this error? if yes, what could be the solution please?
    thanks
    Emmanuel

    Hi,
    This is in regard to the user settings maintained in transaction /nsu3.Please follow the below link.
    http://web.mit.edu/sapr3/docs/webdocs/getstarted/gsSETTINGS.html
    You need to change the settings as required.
    Hope this helps.
    Thank you,
    Prem

  • BAM Data Control - Group query with Active Data Service

    Trying to get a group query from a BAM data control to work with Active Data Service in an ADF application (JDeveloper 11.1.1.4.0).
    With a flat query, as the data changes, I can see DataChangeEvents fired, resulting in a data push to the client -
    <BAMDataChangeEventFilter> <log>
    #### DataChangeEvent #### on [DataControl name=CEP_Person_DOB_Flat, binding=data.view_mainPageDef.FlatDOB1.view_pageDefs_FlatDOBViewPageDef_WEB_INF_FlatDOB_xml_FlatDOB.QueryIterator]
    Filter/Collection Id : 1966
    Collection Level : 0
    Event Id : 5
    ==== DataChangeEntry (#1)
    ChangeType : INSERT_AFTER
    KeyPath : [2157, 0]
    InsertKeyPath : [null, 0]
    AttributeNames : [id, _PersonKey, _County, _Surname, _AGE, _DOB, _Country, _FirstName]
    AttributeValues : [2157, 10008/129, Vagzukarbsm, Gnnfzxxyqfgpsijcr, 110, Thu Dec 26 00:00:00 GMT 1901, Ekcqvrkoksr, Vwhm]
    When I try a group query on the same data, currently just trying to group by _DOB for every 10 years to count the number of people, I get no data change events fired, so don't get any data pushed to the client, though the data has been changed if I refresh the page.
    Any ideas ?

    can you include bam and jdev versions and also include exception from logs?

  • Help with filtering a query with a date as string column

    Hello -- I've got a table column that contains dates as
    string/text type (access db). I need to make a query of my table
    that includes only the dates that match today's date (example
    5-13-2008). I need two parts. One is to capture today's date, and
    another to set the filter in the query.
    Here's my base query
    <cfquery name="someQuery" datasource="someDS">
    SELECT col1, col2, dateCol, col4
    FROM someTable
    WHERE dateCol = "today's date"
    </cfquery>
    What's the best way to capture today's date? And then what's
    the best way to set it to a string so I have an object to compare
    with dateCol. I know #now()# will get today's date, however it
    returns date + time. How can I format it as M-D-YYYY? Then, how do
    I convert it to a string so I can evaluate in my query? Any help is
    appreciated!

    quote:
    Originally posted by:
    Dan Bracuk
    Redesign your database and store dates as dates instead of
    strings.
    I would love to do this, however I couldn't figure out how to
    store date and time values AS DATE to my database. My front end is
    Flex with a Coldfusion backend. When a form is filled, I need it to
    send the current time and the current date of submission. Using
    Date(), I can obtain the current date (date + time). However it's
    not easy to separate the [date] and [time] values of the Date()
    result without using a dateformatter with a mask. By doing this,
    I've now taken my date as DATE and converted it to date and time
    both AS STRING. Well after several trial and error tries as well as
    looking for any help online, I just decided to use the
    dateformatter, convert date and time to string and then save each
    to their own columns.
    The other way of doing this is to just have one column that
    holds both the date and time, and use Date() to pass the correct
    data-type to my db. However, when passing Date() to my db, it only
    stores the date but sets the time to 00:00:00. Now if I could find
    a way to get both correct date and time (example 5-13-2008 1:31:xx
    PM), I could just use a dateformatter in my front end to display
    the dates as I want. Again, the problem is I need the TIME value as
    well, and it keeps defaulting to 00:00:00 in access.
    @paross1-- I will try what you've provided just to get this
    thing working, regardless if they are strings in the db instead of
    dates.
    If anyone can solve my default time issue mentioned above,
    that would be great too..

  • How can I send a post query with attached data using Labview?

    Hi,
    I need to send data (a file of 5KB) to a php server.
    In order to do it, I need to send a post request with attached data.
    I'm using Labview 6.1 and I have the Internet Toolkit.
    But I just see the Get Method. Isn't implemented the post method in Labview?
    Thanks for your help
    Best regards

    Hi,
    In order to use the POST request method as opposed to the GET request method I used a VI set up as shown in the attached GIF.
    From the front panel you need to provide values for the 3 inputs. "Bytes to read" is an arbitrarily large number that meets or exceeds the maximum number of bytes you expect as a response from your server. "Address" is just the URL of the server, e.g. "10.90.1.1" or "localhost" or "www.google.com". "Data in" is the actual request you're sending with the data included.
    "Data in" would be in a format similar to everything in the quotes below (important to have 2 carriage returns to finish the request);
    POST /phppage.php HTTP/1.1
    Content-Length: ??
    Host: http://www.mywebserver.com
    Content-Type: application/x-www-form
    -urlencoded
    email=[email protected]&password=mypassword
    For sending your data file you just have to set the requisite MIME-type and then include the file data in place of the form data in the example above.
    Hope this helps,
    Neil
    Attachments:
    LV_TCP_code.gif ‏4 KB

  • How to compare the date value with the date datatype column?

    Hi,
    I am executed a query to get output for the particular date in two different database.
    I got output in one db environment, but in the another environment i didnt get the output.
    APP_DECISION_DATE column contains date datatype
    ex:
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE = TO_DATE('23-JAN-07',
    'DD-MON-YY'); 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060106 SYSTEM
    DATABASE - II
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE=
    TO_DATE('31-JAN-2007','DD-MON-RRRR') and application_id=2007010028552;
    no rows selected
    in the same db i got the output while i used the TO_DATE(APP_DECISION_DATE)
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where TO_DATE(APP_DECISION_DATE)=
    TO_DATE('31-JAN-2007','DD-MON-YYYY') and application_id=2007010028552; 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    is it necessary to use TO_DATE function while i am using the data datatype column in the WHERE CLAUSE?
    Thanks in advance.
    siva

    Sorry & thanks sathish,
    Now i got the result.
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE BETWEEN TO_DATE ('31.01.2007 00:00:00', 'DD.MM.YYYY HH24:MI:SS') AND TO_DATE ('31.01.2007 23:59:59', 'DD.MM.YYYY HH24:MI:SS')
    2 and application_id=2007010028552;
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    ================================
    But one doubt,
    When i created the column with the date datatype how it gets the time value,
    And in one environment db i got the result but in another environment i dont get,
    Shall i want to change any session status of date?

  • Dynamic current date variant with static date

    I have a report that I want to execute with a variant that defaults dynamically to today's current date, but I also want to select based on if that date field is initial too.  In one execution.  So select record if date is either today's date (dynamically calculated) or date is initial.
    Anyone know how I can do that?
    Thanks so much
    Cathy

    hi
    Did you try to force value in the variant in the multiple value with a value equal to space? So it will be like default date as today's date and fixed values as space.
    Force value in the sense we use fixed values in the selection screen.
    If this is not working then do coding in infoset
    Br
    Vijay V

  • Migration of Equipment Master Data together with PRT data

    Hello Experts,
    we need to migrate Equipment Master Data which have activated the view PRT data. Most of the fields in this view are stored in table CRFH. Is there a way to migrate Equipment Master Data together with the PRT data of the Equipment? All the BAPI's I found do not have an import structure for those fields. Is a batch-input the only way?
    Does anybody know a mass change transaction for Equipments?
    Thank you and Regards
    Christian

    Hi Krishna,
    You can use the standard batch input program RFBIDE00 in LSMW to update the customer master data. However, there might be scenarios where you might be required to update the fields which do not get updated by the standard bacth input program. If any of such fields are defined as mandatory, then you wont be able to use this method directly.
    In such cases you will have to either create a recording to poplate the fields which do not get updated by the standard program and use both the recording and the standard batch input program to update the customer master data OR create a recording for customer master create and use the same in LSMW.
    Best regards,
    Harsh

  • Business View data foundation with dynamic data connection hangs

    We are running Business Objects XI 3.0 with Crystal Reports 2008 and Business View Manager 12.0.0.683.  In the Business View Manager tool, when I try to open a data foundation that uses the ACD Dynamic data connection, it hangs with the hourglass icon.  I have left it trying to open for at least an hour before killing the Business View Manager with the Windows Task Manager.  Data foundations using a static connection open fine as do the elements and views based on the data foundation with the dynamic connection.  The static data connections included in the ACD Dynamic connector point back to an Oracle Server.  Any ideas how to get the data foundations to open so I can edit our custom business views?
    Thanks,
    Kathy

    I created some Views to pull the data in from the Oracle side.

Maybe you are looking for

  • IPod Touch Internet Problems

    My iPod Touch connects to my wi-fi but the internet does not work. I've tried forgetting the network and re-entering the password, I've updated all software, I've reset network settings, and I've also restored my ipod touch to factory settings to see

  • Formatting Failed- Device not Supported

    Hi. I'm new to DVDSP and hope this isn't a stupid question. (No hits when I searched for the same problem.) I have a project that started as FCS HD. I sent it to Compressor and created a QT H.264.mov file that is 5.96GB. Built a DVDSP project that en

  • Photoshop 7.0 install error

    Im trying to patch it with 7.0.3 patch and it wouldnt work so i looked for help and I found that I had to re-install it, and I do so but at %50 i get a -115 error and then the installation quits. Please help, Thanks.

  • Internet stopped working all of the sudden

    I have a WRT54G router connected to my iMac and Mac Book, everything was working fine for the past three months, and all of the sudden no Internet either wirelessly or from a port. If I connect my PC directly to the modem I can connect to the Interne

  • Saving iPhone Voicemails to iTunes

    How do you transfer, or save, iPhone (original) voicemails to iTunes?