Create a Dates View

Hi gurus, my first question here.:-)
My DBA gave me a table with only one date column say Table1.Date. Its in the format of Date and say it is = 7/23/2012.
Now i have to create my own Reporting View(which is used for reporting) based on that date column like below:
It should be a column with values in the following format =
2012-07
2012-06
2012-05 etc....upto
2010-01
So i started out my creating like this:
select
to_char(Table1.Date,'yyyy-mm')
from Table1
Union
select SUBSTR(to_char(Table1.Date,'yyyy-mm'), 1,5)||TO_CHAR(SUBSTR(to_char(Table1.Date,'yyyy-mm'), 6, 2)-1)
from
Table1
Union
select SUBSTR(to_char(Table1.Date,'yyyy-mm'), 1,5)||TO_CHAR(SUBSTR(to_char(Table1.Date,'yyyy-mm'), 6, 2)-2)
from
Table1
etc
.and so on till i get 2010-01.
I was wondering, there has to be a better way to do this. Any sugguestions please?
Thanks,
Brawn

Hi,
Welcome to the forum!
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using, e.g. 10.2.0.4.0.
See the forum FAQ {message:id=9360002}
An example of some sample data in your case might be:
CREATE TABLE  table1
(       date_column     DATE
INSERT INTO table1 (date_column) VALUES (TO_DATE ( '7/23/2012', 'MM/DD/YYYY'));
INSERT INTO table1 (date_column) VALUES (TO_DATE ( '7/20/2012', 'MM/DD/YYYY'));
INSERT INTO table1 (date_column) VALUES (TO_DATE ( '7/30/2012', 'MM/DD/YYYY'));
INSERT INTO table1 (date_column) VALUES (TO_DATE ('04/05/2012', 'MM/DD/YYYY'));
COMMIT;Do you want a view that has one row per month, starting with the earliest month in table1, and continuing through the latest month in table1?
If so:
CREATE OR REPLACE VIEW       all_months
AS
SELECT     ADD_MONTHS ( last_month
             , 1 - LEVEL
             )               AS a_month
FROM    (
         SELECT  TRUNC (MIN (date_column), 'MONTH')     AS first_month
         ,         TRUNC (MAX (date_column), 'MONTH')     AS last_month
         FROM    table1
CONNECT BY     LEVEL <= 1 + MONTHS_BETWEEN ( last_month
                                        , first_month
;Given the data I posted above, this query:
SELECT       TO_CHAR (a_month, 'YYYY-MM')     AS formatted_month
FROM       all_months
ORDER BY  a_month
;produces this output:
FORMATTED_MONTH
2012-04
2012-05
2012-06
2012-07Notice that the view contains row for May and June, even though the table doesn't have any data for those months.
Edited by: Frank Kulash on Jul 30, 2012 4:53 PM
Added sample data.

Similar Messages

  • Problem in creating jdbc-data-vew to oracle10g

    I have installed DSEE7.0 and setup the directory proxy server successfully
    my oracle environment:
    ip=202.205.16.93
    sid=nicdbs
    table: CAMPUS.CAMPUS_USER { USERID, NAME, TEL, EMAIL }
    my steps (refer to the administrator guide a reference):
    dpconf create-jdbc-data-source -b nicdbs -B jdbc:oracle:thin://202.205.16.93:1521: -J file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar -S oracle.jdbc.driver.OracleDriver oracleds
    dpconf set-jdbc-data-source-prop oracleds db-vendor:oracle
    dpconf set-jdbc-data-source-prop oracleds db-pwd-file:/etc/oraclepass.txt
    dpconf create-jdbc-data-source-pool oraclepool
    dpconf attach-jdbc-data-source oraclepool oracleds
    dpconf create-jdbc-data-view oracleview oraclepool o=oracle
    dpconf create-jdbc-table user CAMPUS.CAMPUS_USER
    dpconf add-jdbc-attr user uid USERID
    dpconf add-jdbc-attr user cn NAME
    dpconf add-jdbc-attr user telephoneNumber TEL
    dpconf add-jdbc-attr user mail EMAIL
    dpconf create-jdbc-object-class oracleview person user uid
    every thing return succefully
    but when I test the view by
    ldapsearch -b o=oralce -x uid=1422
    it returns:
    ldap_search: DSA is unavailable
    ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
    i cant get any help from this error message.I want some help, Maybe some steps were left.
    thanks in advace.

    thanks but it didn't solve it,
    ldapsearch -b o=oracle uid=1422
    ldap_search: DSA is unavailable
    ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
    i also have tried:
    db-name: (CONNECT_DATA =(SERVICE_NAME = nicdbs))
    db-url: jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 202.205.16.93)(PORT = 1521)))
    but it still didnt work.
    #[root@dsee7 ~]# dpconf get-jdbc-data-source-prop oracleds
    db-name : nicdbs
    db-pwd : {3DES}+j6AoBZNIGx+7st/KDPgSmzVMlDcL6zs
    db-url : jdbc:oracle:thin:@202.205.16.93:1521:
    db-user : campus
    db-vendor : oracle
    description : -
    driver-class : oracle.jdbc.driver.OracleDriver
    driver-url : file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar
    is-enabled : true
    is-read-only : false
    monitoring-inactivity-timeout : 2m
    monitoring-interval : 30s
    monitoring-mode : reactive
    num-connection-incr : 5
    num-connection-init : 5
    num-connection-limit : 30
    #dpconf get-jdbc-data-view-prop oracleview
    Enter "cn=Proxy Manager" password:
    alternate-search-base-dn : ""
    attr-name-mappings : none
    base-dn : o=oracle
    contains-shared-entries : false
    custom-distribution-algorithm : none
    description : -
    distribution-algorithm : none
    dn-join-rule : none
    dn-mapping-attrs : none
    dn-mapping-source-base-dn : none
    excluded-subtrees : -
    filter-join-rule : none
    is-enabled : true
    is-read-only : false
    is-routable : true
    jdbc-attr-date-format : yyyy-MM-dd
    jdbc-attr-time-format : hh:mm:ss
    jdbc-attr-timestamp-format : yyyy-MM-dd hh:mm:ss
    jdbc-data-source-pool : oraclepool
    lexicographic-attrs : all
    lexicographic-lower-bound : none
    lexicographic-upper-bound : none
    non-viewable-attr : none
    non-writable-attr : none
    numeric-attrs : all
    numeric-default-data-view : false
    numeric-lower-bound : none
    numeric-upper-bound : none
    pattern-matching-base-dn-regular-expression : all
    pattern-matching-base-object-search-filter : all
    pattern-matching-dn-regular-expression : all
    pattern-matching-one-level-search-filter : all
    pattern-matching-subtree-search-filter : all
    process-bind : -
    replication-role : master
    viewable-attr : all except non-viewable-attr
    writable-attr : all except non-writable-attr
    Edited by: mickypc1979 on Mar 1, 2010 4:31 PM

  • Filter in data view web part using sharepoint designer 2010

    Hi,
    i have a scenario that there are 4 column Name, shift time, Location, Date. so i have to create a data view web part using designer. 
    further conditions are:
    1.Shift time should be radio button and filter the data accordingly.
    2. Data display only for current date(system date).
    3. Group by Location.
    i have complete all things except how to display data according current date. its showing all dates result.
    So please help me how to give a expression or filter to do this. if you have xslt code then plz let me know.
    Please help ASAP.
    Thanks
    Vivek

    Hi Vivek,
    If i understand it right, you know how to do other bits and want help in displaying data for only current date. on your view you can use filter condition as :
                    column: Date
                    condition : is equal to
                     value:     [Today]
    Let me know if this helps.
    Regards
    P
    Please don't forget to mark an answer if it solves your problem.

  • Data Viewer Shows Most Values as "Missing LineageID"

    I suspect that this happens after a lot of editing of the package and automatic re-mapping of columns by name. It can render the data viewer almost useless. I tried the obvious, deleting and re-creating the data viewer, expecting it to fix the problem, but it didn't.
    Also, on my computer at least, the package no longer pauses at a Data Viewer. The data is shown but the package keeps executing, I assume that there is a property somewhere that changes this behaviour but I don't recall changing it.

    Todd,
    So I found this thread here
    http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/1edbf842-ffd5-45b8-90f0-a5b970c20c77 and in it, it states that if you run the package as an individual package then the dataviewers work as advertised.
    Well, that seems to be the case with me. My dataviewers are in child packages (that are controlled by parent package variables).
    If I run the child package on its own, then the flow stops at the dataviewer as expected and the contents are all dislayed properly.
    If I run the parent package, the problem manifests itself in the child package. This does not matter if it is the only child package being run or if it is one of several.
    Very disappointing. It's a shame these forums don't have another button instead of answered. Such as "problem identified". There's a lot of difference between "answered and workaround/solution identified" and "answered; yes it's a problem and you are SOL
    or USCWAP"!
    Steve

  • DPS 6.3 root data view excluded subtrees in DSCC?

    In dps6.3 using the dscc I see a default data view of "root data view". I created another data view for the base dn of our ldap. However when I look at the root data view I see in "excluded subtrees" the base dn of our ldap. I did not edit "excluded subtrees" in the root data view. How did my base dn get in there? Can it see the suffix of the local directory server? The suffix of the local directory server is the same as the base dn. Everything is working as expected, I was just surprised to see it there.

    One way to think of the Root Data View is as a default bucket. All other data views failing to serve a request, fall back to Root Data View. When you have a "more qualified" data view for a particular base dn, then you want to make sure that other views won't serve the query.
    For example, if you have a data view "global" serving dc=example,dc=com with various containers (like ou=Resources and ou=Groups) and a second data view "people" dedicated to serve ou=People,dc=example,dc=com, you need to make sure to exclude ou=People,dc=example,dc=com from the "global" data view. Feel me?
    There are 3 properties of interest to mix and match in your data views:
    1.base-dn
    2.excluded-subtrees
    3.alternate-search-base-dn
    In general, dsconf will take care of this for you automatically which is what happened in your case.
    You may want to tweak this to achieve particular routing to specific data views.
    hth
    -=arnaud=-

  • Creating a Calendar View using alternative date fields

    I have a Sharepoint 2007 calendar list that includes the standard Start and End Date fields.  I also have "Suggested Start Date" and "Suggested End Date" fields that are utilized by users to recommend the Start and End Dates for
    the event.
    I can create a Calendar view that displays the events according to the Start and End dates.
    I cannot create a Calendar view that displays the events according to the Suggested Start and Suggested End date fields.
    In practice, all items are not displayed on this second calendar view that should be displayed even though you can choose these fields as Time Interval values when establishing the calendar.
    Is there a way to create a Calendar View that will use date fields other than the default Start and End date fields?
    Thanks,
    Chris Mang>> JDA Software Group, Inc.

    Hello,
    It seems problem with time value. Have you included time value in custom datatime column wile creating? What happens when you select "date only" from column settings?
    You can also try below suggestion to include "IncludeTimeValue" parameter in CAMl query by designer:
    http://stackoverflow.com/questions/18362853/how-do-i-filter-by-today-and-time-in-sharepoint-list-view
    OR else create two more calculated column and save date only in those columns then filter by them.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Creating a normal view on semantic data

    Hi there.
    I have a semantic database that I would like to expose through some of our other software. The easiest way would be to create a view of the semantic data and point the software to it.
    When i try
    SELECT x, y FROM TABLE(SEM_MATCH( '(?x rdf:type <http://www.w3.org/2002/07/owl#Class>) (?x rdfs:subClassOf ?y)',
    SEM_Models('NBEDATA'),
    null,
    null,
    null));
    I get the results returned, but trying
    create or replace view dataclasses as SELECT x, y FROM TABLE(SEM_MATCH( '(?x rdf:type <http://www.w3.org/2002/07/owl#Class>) (?x rdfs:subClassOf ?y)',
    SEM_Models('NBEDATA'),
    null,
    null,
    null));
    Throws an ora-00600 internal error.
    ORA-00600: internal error code, arguments: [17046], [0x7FFCF4F7AF8], [0x7FFD260DE98], [1], [], [], [], []
    Can you tell me if a view can be created on semantic data and if so how can I do it.
    Cheers
    Phil

    Could you create a service request for this patch (bug 6688356) for the version and platform you need? (as described by rpitts in an earlier post on this thread). This patch is being created for specific customer requests and if you create a service request it will initiate the process of creating the patch for your version and platform.
    The next major (non-patch) release will not have this issue.
    Melli

  • How to bind data from script created variable to embed element of XML schema (xsd) in "Data View"

    Hi, i have got another problem with livecycle designer scripting.
    I have got script line which is defining of string variable:
    var aaa = "this is my string";
    and i have got embed XML schema like this (it`s only short part of whole file):
    ... xs:element name="bbb" type="xs:string"/ ...
    After saving data to XML i would like to get "this is my string" as a value of my "bbb" XML element.
    To save this data i`m using submit button which is connect with submit.php file on my server.
    How to connect script created variable and embed XML schema element which is present on my "Data View" tab.
    Please help me a bit becouse i don`t know even where to search answer of it...
    Of course i know possibilities to create fake unvisible text field object and bind it with 'bbb' and than put "this.rawValue = aaa" to connect those two variables but i think that is not a good idea to solve it in that way. It`s too primitive

    i solve it, i should write this:
    xfa.datasets.data.bbb.value = aaa;

  • How create animated power view reports using sharepoint list as a data source in sharepoint 2010?

    Hi All,
    I got a client requirement to create reports using SharePoint List as data source. The report should show reflection depends on values changed (I mean animation).
    I have heard about the power view/power pivot which does this kind of animations in reports.
    Can someone please guide me on creating reports which shows animations
    In power view/power pivot using SharePoint List as data source in SharePoint 2010.
    Thanks in advance.
    MercuryMan

    Hi MercuryMan,
    Yes, Power View, a feature of SQL Server 2012 Reporting Services Add-in for Microsoft SharePoint Server 2010 or SharePoint 2013 Enterprise Edition, is an interactive data exploration, visualization, and presentation experience.
    It provides multiple views featuring tiles, slicers, a chart filter, and a number of visualizations, including cards, small multiples, and a bubble chart. So, we can use Power View to do intuitive ad-hoc reporting for business users such as data analysts, business
    decision makers, and information workers.
    Currently, Power View report only supports two types of data models: PowerPivot Worksheet, and data models based on Analysis Services Tabular Model or Multidimensional Cube.
    In your scenario, you can create PowerPivot worksheets using SharePoint List as data source, deploy the PowerPivot worksheet to a SharePoint Library or PowerPivot Gallery, and then generate Power View reports based on the PowerPivot worksheets on the SharePoint
    site.
    To use SharePoint List as data source in Excel PowerPivot, you can refer to the following resource:
    http://blogs.technet.com/b/excel_services__powerpivot_for_sharepoint_support_blog/archive/2013/07/11/excel-services-using-a-sharepoint-list-as-a-data-source.aspx 
    http://technet.microsoft.com/en-us/library/hh230322.aspx 
    To create a Power View report based on PowerPivot model, you can refer to the following links:
    http://technet.microsoft.com/en-us/library/hh231522.aspx 
    http://technet.microsoft.com/en-us/library/hh759325.aspx 
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • Can not view data in Dimension Data Viewer

    Hello Forum,
    Has anyone run into this one yet? with OWB10gr2
    we have created a dimension called store, it has a simple hiearchy"
    store-->category-->primary category-->Busines Unit
    The dimension validates and deploys sucessfully - we have seen the notes to choose Deploy All for configuration instead of the default, reason being that if you don't choose Deploy All you will not be able to view it through the data viewer
    We have mapped the data from our oracle staging table to the dimension and our map has run without error.
    We can see data in the underlying table that supports the dimension, but when we open the dimension with object editor and try to view the loaded data via the dimension data view we get nothing?
    What's up with that?
    thx again
    monalisa

    You're probably running into the same known bug we hit. See the OWB 10gR2 release notes, under "Known Issues / OLAP Catalog". Probably hitting the mentioned OLAP bug 4945008.
    Hope this helps,
    Scott

  • How to create a calender view in webdynpro java EP 7.0

    Hi ,
    I want to create a calender view in webdynpro,
    Requirments are
    1. it should be current month view
    2. Below each day i want to show office in-time and out-time in two cloumns(these values will be coming tru RFCs).
    ie
    1
    10am | 4pm
    Is this possible in webdynpro java EP 7.0 ?
    Please help me
    Thanks
    Kumar

    Hi Kumar,
    If you are using EP7.0, there is no calendar UI element in webdynpro development. There is only date navigator UI element. This is demonstrated in the below article.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c059344a-1930-2d10-6e8a-dcec5f94993e?quicklink=index&overridelayout=true
    Regards,
    Ganesh N

  • Data View Web Part - List of Subsites and Document Libraries under Current Site - Must be able to Package as Site Template in SPDesigner

    Hi Guys,
    On the home page of each sub site I would like to be able to show a list of subsites and Document libraries that are under the current subsite.
    I started investigating a solution using Datasources with SOAP requests sent to the server but it is very difficult to understand how to surface it on the Data View WebPart.
    I have tried with the search results webpart but the problem is that it does not work well when packaged in a Site Template.
    Please advise.
    Thanks and Regards,
    Rhyan

    Ok,
    Here is the problem:
    When creating a mysite from powershell or script, apparently you can ONLY do this from a wfe (or a server running Microsoft SharePoint Foundation Web Application in services on server).
    You CANNOT create mysites from script on your appserver if it is not also a Web Application Server. I confirmed the same is true in my test farm. I guess I was always running most of these scripts on the webserver.
    I searched all over and cannot find this documented anywhere.
    Who do I contact to have Microsoft document this?
    It's Thursday morning, I've been working non stop since Saturday morning so you don't have to :)

  • Creating new Data Source Error - Database connection Failed

    Successfully installed and configured 11.1.1.3.0. Planning and Essbase dev.
    Went to Workspace > Administer > Classing Planning Administration > Manage Data Sources > Create Data Source.
    Entered all info about the application database , etc. Getting error "The database connection failed" (I was able to connect with no problem during the install)
    SQL server 2005 is on the same physical server.
    The diagnostic tool shows database connection passed for planning. A new database was created for the new application.
    The server event viewer shows these errors.
    "Login failed for user 'xxx-hyperion'. The user is not associated with a trusted SQL Server connection."
    Group Policy Error "The client-side extension could not apply computer policy settings for 'Default Domain Policy {xxx}' because it failed with error code '0x80070003 The system cannot find the path specified.' See trace file for more details. "
    The Group Policy client-side extension Group Policy Services failed to execute. Please look for any errors reported earlier by that extension.
    Any help is appreciated.

    Datasource for the application.
    I have created a sql db for this planning application (my datasource). See my first message for more details.
    When you create a new planning application, you need to associate it with a data source. Since this is a new install, I don't have any data sources available yet.
    So, "To create, edit or delete data sources, click Manage Data Source."
    This page lets you validate your connection to the database and essbase server. My essbase server connection validates! The database connection does not validate after I enter all the relevant information.
    SCREEN INFO BELOW
    Fields displayed with an asterisk (*) are mandatory.
    Data Source Name *:
    Data Source Description:
    Select Database Platform
    Microsoft SQL Server
    Application Database
    Server * :
    Port * :
    Database *:
    User *:
    Password *:
    Click "Validate Database Connection"
    ERROR ---> Database connection failed.
    So it does not let me create a data source for my new planning application, so I cannot create a new planning application.
    Thanks in advance.

  • How to create a data load file from Excel !!!

    Hi All,
    I'm new to HFM and would like to load data into an HFM application. As I have an Excel file with all the data. When I'm directly loading the data it throws an error saying "No section has been specified to determine if this is data, description or line item detail". How can I convert this excel file into proper format (.dat) file understandable by HFM ?

    There are several ways to get this data into HFM.
    1) FDM - best option if you have it
    2) Webforms/Data Grids
    3) HsSetValue formulas in Excel
    4) DAT file loads
    5) JVs, etc
    If you wish to use DAT files created via Excel, you will likely want to use Excel VBA macros to create your DAT file to load. We do this on occasion for special projects and it works quite well. What you can do is set up an Excel file with your data inputs to look however you want, then link your POV members and amounts to another tab (we commonly call this the Export tab and it is set up in an HFM-friendly format).
    Create a macro to write a DAT file to a specified location using data from the Export tab. The DAT file will need to be formatted as below. For a specific sample, you can extract data from your HFM app and see the format.
    !Data
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Brush up on Replace, Merge, or Accumulate load options in the HFM Admin and User Guides, then upload your new DAT file.

  • Creating and Binding View Objects dynamically : Oracle Jdeveloper 11g

    Hello,
    We are trying to create and bind view objects dynamically to adf data visualization components.
    The view object is a result of multiple tables.
    We are using Oracle JDeveloper 11g Technical Preview. ( can't upgrade to TP2 or TP3 now).
    We have found this : http://radio.weblogs.com/0118231/stories/2003/07/15/creatingUpdateableMultientityViewObjectDefinitionsDynamically.html on our search for the same.
    The sample application however, is in 10g , hence required migration.
    Also, it was a standalone application with the TestClient.java having a main() method.
    Our requirement is for Web Application; we use Adf+jsf .
    Guidance of any sort is very much appreciated.
    Thanks in advance.
    -Anil Golla

    Hi,
    there also exist a forum for JDeveloper 11: JDeveloper and OC4J 11g Technology Preview
    What you are trying todo is not trivial because you need to not only dynamically create the VO, you would also dynamically need to create the binding meta data for it (assuming you use ADF). Not sure if the API to modify the binding is public, so posting it on the JDeveloper 11 forum bears a glimpse of hope for an answer
    In JDeveloper 10.1.3 you can't do this
    Frank

Maybe you are looking for