Query based on every quarter

Hi All,
I have a date table which consists of four fields two which are defined as varchars and two which are defined as numbers. One of the varchar fields holds a period in a mmyyyy format and the second one holds a date in yyyymmdd format.
I need to use this information to get every quarter between two periods e.g 012004 and 032007. Is this possible with the information I have or would i need a new field in the table which holds the quarter relating to each period
Thanks in advance for your help

It's best to hold dates in date fields. To get the quarter from a date you can use the Q format mask, eg
SELECT To_Char(SYSDATE,'YYYY-Q') FROM dual;
so you just need to To_Date() one of your varchar columns and apply that function.
Are the period and date fields ever going to contain data with different months/years? If not then you could store only the date (in a date type) and use trunc to get the month portion when you query the records, eg
SELECT Trunc(SYSDATE,'MM') FROM dual;

Similar Messages

  • Query for getting data for every quarter for financial year

    Hi,
    My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
    For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.

    lakmesri wrote:
    Hi,
    My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
    For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.
    How can you get 8 quarters within a year ? I'b be concerned here.
    lakmesri wrote:
    Hi,
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.
    First, that question is really not clearly asked. Second how could it be urgent ? You even did not tell us your Oracle version, did not show any tables descr, output sample nor any effort on your side to work on.
    Nicolas.

  • Query based on dynamic url paramter

    I am displaying all the results of a simple select statement on one page in an html table. One of these colums displays the unique ID of every row returned from the query. I want to make the ID field an active link, whereupon when the user clicks it, they are taken to seperate page where information for just that row is displayed. I'd imagine you have to pass the ID for that specific row to the next page via the URL, and run another query based on that specific ID to retrieve the information. I just don't know how to have the URL variable equal the ID for each row. All I can find is static examples such as 'www.gotopage.jsp?ID=1234'.

    while displaying the result in html table,
    form the href like this
    String id = resultSet.getString("ID");
    <a href="gotopage.jsp?ID=<%= id%"></a><%=id%>.......
    or post your code and we may be able to point it out.

  • Need function to find 1st friday on every quarter

    Hi,
    need a function or a query to find the 1st friday on every quarter of the current year, any help is appreciated.
    Thank You

    Hi,
    like this ??
    SQL> select dt
      2    from ( select to_date(decode('&quarter', '1', '01-01-2008',
      3                                             '2', '01-04-2008',
      4                                             '3', '01-07-2008',
      5                                             '4', '01-10-2008'), 'dd-mm-yyyy')
      6                  + level - 1 dt
      7             from dual
      8           connect by level <= 7)
      9  where trim(to_char(dt, 'DAY')) = 'FRIDAY';
    Enter value for quarter: 1
    old   2:   from ( select to_date(decode('&quarter', '1', '01-01-2008',
    new   2:   from ( select to_date(decode('1', '1', '01-01-2008',
    DT
    04-JAN-08
    SQL> /
    Enter value for quarter: 2
    old   2:   from ( select to_date(decode('&quarter', '1', '01-01-2008',
    new   2:   from ( select to_date(decode('2', '1', '01-01-2008',
    DT
    04-APR-08
    SQL> /
    Enter value for quarter: 3
    old   2:   from ( select to_date(decode('&quarter', '1', '01-01-2008',
    new   2:   from ( select to_date(decode('3', '1', '01-01-2008',
    DT
    04-JUL-08
    SQL> /
    Enter value for quarter: 4
    old   2:   from ( select to_date(decode('&quarter', '1', '01-01-2008',
    new   2:   from ( select to_date(decode('4', '1', '01-01-2008',
    DT
    03-OCT-08
    SQL> SELECT NEXT_DAY(TRUNC(TO_DATE(SYSDATE,'DD-MON-YYYY'), 'Q')-1,'Friday') FROM dual;
    NEXT_DAY(
    05-OCT-08
    SQL>You may as well pass Year if you want by converting it to a bind variable.
    Regards
    Asif Momen.
    http://momendba.blogspot.com

  • Query based change notifications

    Hi,
    am trying to use the query based notifications, but it seems to switch over to the object based notification for some reason. My environment is Oracle 11.2 ( I believe you need 11.1 or above for query based to work) and I have a select statement which retrieves a column which is of type NUMBER. (Again here my understanding is that only varchar2 and number columns work). I seem to get every change notification on the table and not just my flltered dataset
    As an example I've created a sample table called test_db_notification with a single column of type NUMBER.
    desc test_db_notification
    Name Null Type
    COLUMN1 NUMBER
    Added two entries in there as follows:
    SELECT rowid,column1 FROM test_db_notification;
    ROWID                          COLUMN1
    AAAERnAAKAAEurNAAI                54
    AAAERnAAKAAEurPAAA                63           
    Here's my code to register for notification:
         OracleCommand cmdObj = connObj.CreateCommand();
    cmdObj.CommandText = " SELECT column1 FROM testdb_notification where column1 = 63";
    _dep = new OracleDependency(_cmdObj);
    _dep.QueryBasedNotification = true;
    _dep.OnChange += new OnChangeEventHandler(_dep_OnChange);
    _cmdObj.Notification.IsNotifiedOnce = false;
    _cmdObj.AddRowid = true;
    _cmdObj.ExecuteNonQuery();
    When I register and change the value of column1 where the current value is 54, I get back a notification saying the ROWID for 54 has been updated.
    I was expecting not to receive any notifications since my original query looks only at column1 = 63. Am I missing something here?

    Hi,
    This isnt related to the beta.
    From the CQN docs..
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28424/adfns_cqn.htm#CHDIEJEI
    You must be connected as a non-SYS user in order to create CQN registrations.
    Hope it helps,
    Greg

  • Query based alerts

    Hi All,
    Like every company we have a situation where we buy item a and item b individually but sell as sets or stand alone as the customer requires. A major problem we have in our current system (not SAP B1) is that the min-max would never trip since it would consider the CURRENT / LIVE / OPEN Purchase orders.
    I want to set up a query based alert which tells me to
    1) buy item b every time I buy item a, and the quantity should be at least same or more.
    2) trip min-max keeping in mind that we need as many item b as the quantity of item a + a buffer stock quantity decided by us.
    Any guidance?
    Thanks!!
    Regards,
    YP.

    Hi Augusto,
    We do not have any links set up for the items. Just by our business dealings, we know that item A needs to be sold with item B, but the customer can choose to buy individually also.
    I want to avoid multiple part numbers for same item to cater for different scenarios. Only issue occurs when we are trying to manage the inventory levels and hence the question of query based alert.
    Our customer requires us to reflect "item a" and "item b" as part numbers on invoice, so we refrain from introducing a 3rd part number which will be the sales BOM made by using item a and item b as child parts.
    Hope I have clarified.
    Regards,
    Yash

  • SPWeb.ProcessBatchData - why no support for query-based updating?

    I'm aware how to use SPWeb.ProcessBatchData, but for very large lists (10000+ items) it's still very slow if all you want to do is update every single item to have a particular value in one column, as you still have to walk the whole list to build
    a massive batch query that you then pass to ProcessBatchData, and the updates issued to SQL server are still much more expensive than needed.
    My question is why doesn't ProcessBatchData support query-based updating, where you include a <Where> clause as part of the batch query to indicate which items you want to update?

    Only SharePoint team can answer your question I think, but yes it would be better to have the query option, maybe. However, you can still do what you want but doing a little extra work - get all items IDs using the first SPQuery call (passing ViewFields
    with minimum fields, you many not need all fields, maybe title and ID) then prepare your xml for process batch.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Query based taxonomy from scratch gives NoSuchMethodError...

    I'm trying to create a query based taxonomy following the instuctions specified in the help docs: KM Platform -> Admin Guide -> Content Mgmt -> Taxonomies and Classification -> Creating a QBT -> from scratch. I created an index on a newly created (hence empty) folder in the 'documents' repository. So, essentially, the data source points to that folder. Also, I selected 'TREX Classification' on the 'Service' drop-down while creating the index. I left the crwler profile as blank. Then I went on to create a new 'Query Based Taxonomy'. I was able to create it alright, but as soon as I click on it to add folder and the such, I get this error:
    java.lang.NoSuchMethodError
         at com.sapportals.wcm.repository.manager.taxonomy.TaxonomyNamespaceManager.getDocumentTaxRMRids(TaxonomyNamespaceManager.java:1876)
         at com.sapportals.wcm.repository.manager.taxonomy.TaxonomyNamespaceManager.getTaxonomyClassResources(TaxonomyNamespaceManager.java:1831)
         at com.sapportals.wcm.repository.manager.taxonomy.TaxonomyNamespaceManager.addChildDocuments(TaxonomyNamespaceManager.java:1942)
         at com.sapportals.wcm.repository.manager.taxonomy.TaxonomyNamespaceManager.getChildren(TaxonomyNamespaceManager.java:368)
         at com.sapportals.wcm.repository.CollectionImpl.internalGetChildren(CollectionImpl.java:966)
         at com.sapportals.wcm.repository.CollectionImpl.getChildren(CollectionImpl.java:179)
    Any help in solving this is highly apprecaited.
    We run EP6 SP2.
    I did NOT create a 'crawler profile' for this set up.
    thanks,
    Biju.

    Hi Biju,
    re. your NW'04 SP stack 4 migration intention:
    NW'04 is still in ramp-up (SP stack 4 is the current shipment bundle of it) so at the current point in time, only participating ramp-up customers can use it.
    A migration from EP6.0 SP2 to NW'04 will be possible (but not during the ramp-up phase).
    From a Knowledge Management & Collaboration perspective, we will port most of the NW'04 SP stack 4 functions to EP6.0 SP2 as well. These functions will be shipped as EP6.0 SP2 Patch 5 (planned shipment date beginning of Q4 / 2004) so for mid-term, you can also plan to stay on EP6.0 SP2 if you have no other pressing reasons for going to NW'04 (e.g. enhanced Web AS functions).
    This feature porting from NW -> EP6.0 SP2 is an 'only-once' action, however, and NetWeaver will be the release for new features in the future.
    Regards,
    Joerg

  • BEx query based on virtual cube donu00B4t display a valid List of Value (LOV)

    Hello
    I have a problem with an invalid LOV. The scenario is the following; There´s a BEx query based on a virtual cube. The query has an exit variable on caracteristic that is based on 0CALMONTH.
    At Universe Designer I simply create a connection, a universe based on this query and export.
    At Web Intelligence (also at Live Office), when I try to execute de query, the prompt to fill my exit variable display a list of value that doesn´t match with the values of the caracteristic at the cube.
    Actually, the list at the prompt starts with 01.0000 and finishes with 05.0968.
    In Universe Designer, the option to edit the list of values is not available. But I think that editing the LOV is not the correct way.
    I´ve tried creating a new query based on the DSO that is the source of the virtual cube. In this case, I had a valid list. Unfortunately, I can´t use this DSO.
    Did anyone already have this problem?

    Hi James,
    can you explain what you mean with "input length for that filed" ?
    The field in the table is varchar2(120). I coudn't found options for the List of value.
    Thanks for your response
    Carsten
    null

  • Include Button that executes PL/SQL procedure to SQL query based region

    I would like to add two columns to a SQL query region.
    These columns would not be sourced from the query, but rather would be used to execute a PL/SQL procedure.
    For example, I would like to have a manager approve or deny adding an additional employee to the department.
    There would be one button for APPROVE. And, one button for DENY.
    The PL/SQL procedure would execute to perform the required DML based upon the selected action (either APPROVE or DENY).
    A sample output would look like this:
    <APPROVE>, <DENY>, John Doe, Accountant
    <APPROVE>, <DENY>, Jane Doe, Accountant
    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?
    Thanks!
    -Reid

    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?Conditional page item? You can associate processes with buttons on a page

  • Query based on a date range

    I want to query based on a date range. I wrote the following EJB QL:
    "select object(a) from ActionItems as a where a.dueDate
    between ?1 and ?2"
    But when I deployed the application to Oracle's EJB server, I got the following error:
    Auto-deploying biogen.jar (No previous deployment found)... Invalid type for expression (a.dueDate BETWEEN ?1 AND ?2)
    EJB QL statement : 'select object(a) from ActionItems as a where a.dueDate between ?1 and ?2'
    EJB QL method : public abstract java.util.Collection ActionItemsLocalHome.findByDueDateRange(java.sql.Date,java.sql.Date) throws javax.ejb.FinderException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse EjbQLParser.java:218)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerator.java:704)
    It works fine for a number range, but does not work for a date range.
    Any one has an idea on how to write a correct EJB QL for a query based on date range?
    Thanks.
    Jingzhi

    Re-posted. Please help!

  • How to build a query based on(UNION) 3 vendor InfoObject

    Dear Experts:
    I have a requirement to build one query based on 3 vendor InfoObjct: 0VENDOR + 0VEN_COMPC + 0VEN_PURORG.
    I tried to build a multiprovider upon these 3 infoobjects, but when I Identify(Assign) the key for each InfoObject, supposely there should be 3 InfoObject for me to check (0VENDOR, 0VEN_COMPC and 0VEN_PURORG) so that I can UNION these 3 infoobjects together on vendor number. But since the reference infoobject of these 3 vendor master data is different, I can not check the 3 together.
    Can anybody let me know how to build that query? I only need vendor number show once, and the attributes of 0VEN_COMPC and 0VEN_PURORG can be union to 0vENDOR.
    Any post would be appreciated and thank you all in advance!
    Best Regards!
    Tim

    Hi,
    you can create a link between the vendor objects itself, means link 0vendor with 0ven_compc and 0ven_purorg. This should give you a list of all vendors multiplied with the comp codes multiplied with the purch. org. May be here it is possible to create another link between a attribute (eg. comp_code of 0ven_purorg with comp_code of 0ven_compc). In case it is not possible you need to add this link information somehow. Another option might be to create 2 queries. One on a infoset of 0vendor and 0ven_purorg and another one on 0vendor and 0ven_compc.
    regards
    Siggi

  • RWI 00200 Error while scheduling the Bex Query based Webi report

    Dear All,
    I am facing the below error while scheduling the Bex Query based Webi report.
    Error:RWI 00200
    We are using BO XI 4.0 Sp05.
    Please advise

    Hi,
    I am on BO 4.0 SP05 Patch 6. Webi reports are just showing processing but not giving results. When I try to create new report it is throwing java security error.
    Tried applet patch upgrade(From link : https://websmp207.sap-ag.de/~sapidb/011000358700000902752013E) for webi certificate but didn't help.
    Please suggest what could be done.
    Thanks and Regards,
    Ankit Sharma

  • Error while creating Query based taxonomy.

    Hi,
    I have created an index and trying to build a query based taxonomy though
    Taxonomy Query Builder in content management. Earlier I have created
    another index but after that I have deleted it but still while trying to build a query based
    taxonomy it is giving an error that earlier index doesn't exist and not diaplaying the new
    index and taxonomy that I have created. Taxonomy Trainer is working fine.
    Please suggest to resolve this problem.
    Thanks,
    Deepika

    Hi,
    did u created the taxonomy in the new index are you imported.
    Generally once you delete an index and you try to create an index with the same name wil give error. This may be because of the cache problem.  Try to restart the server. Hope that may help you.
    Raghu

  • Query Based Taxonomy - Dynamic Creation of a Query Problem

    Hi,
    I'm trying to create new category nodes in a taxonomy and to assing them queries. I know how to do this, but I encountered a strange behavior. Here is the situation:
    I have a string property DocumentType. When manualy creating a query, it looks like:
    DocumentType CONTAINS "Some string"
    But when I do the same using code I get:
    DocumentType IS "Some string"
    And as a result of this, the taxanomy is not working properly.
    Here is the code:
         indexService =
         (IIndexService) ResourceFactory
         .getInstance()
         .getServiceFactory()
         .getService(
         IServiceTypesConst.INDEX_SERVICE);
         //        This kind of classification index offers functionality working with query based taxonomies
         qbcIndex = (IQBClassificationIndex) indexService.getIndex(indexId);
         //        Get a query folder - a query folder is a representation of a query based taxonomies category
         queryFolder = qbcIndex.getQueryFolder(RID.getRID(folder));
         //        List of IQueryEntry objects for the query folder
         queryEntryList = queryFolder.getQuery(context);
         //        Cast the IQBClassificationIndex into a ISearchIndex object
         searchIndex = (ISearchIndex) qbcIndex;
         queryEntry = searchIndex.getNewQueryEntry();
         queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);
         queryEntry.setPropertyName(propertyName);
         queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);
         queryEntry.setValue(propertyValue);
         queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);
         queryEntryList.add(queryEntry);
         //        Set the query for the query folder
         queryFolder.setQuery(queryEntryList, context);
         qbcIndex.updateCategoryContents("Document_Types", false, context);
    Can somebody tell me what am I doing wrong please. Isn't it because of IQueryEntry.PROPERTY_OPERATOR_EQUAL? Is there any substring operator?
    Thanks a lot.

    Hi, Robert
      In this moment, I have a problem with Query Based Taxonomy, maybe could you help me. I insert the query in to the taxonomy from code, but when i use the method
      qbcIndex.updateCategoryContents("/taxonomies/borrame5/Prueba2", false, context);
      I got the next exception:
    #1.5#0014C210F3D1002A000001200000565B000431CC93AD5979#1180654627543#System.err#sap.com/irj#System.err#dummy01#10241#####SAPEngine_Application_Thread[impl:3]_17##0#0#Error##Plain###     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)#
    #1.5#0014C210F3D100310000012B0000565B000431CCC47166AB#1180655445698#System.err#sap.com/irj#System.err#dummy01#10241#####SAPEngine_Application_Thread[impl:3]_18##0#0#Error##Plain###com.sapportals.wcm.service.indexmanagement.IndexNotReadyException: Some documents are not included in this update because indexing has not been finished yet.#
    #1.5#0014C210F3D100310000012C0000565B000431CCC4717417#1180655445701#System.err#sap.com/irj#System.err#dummy01#10241#####SAPEngine_Application_Thread[impl:3]_18##0#0#Error##Plain###     at com.sapportals.wcm.service.indexmanagement.retrieval.trex.AbstractTrexIndex.updateCategoryContents(AbstractTrexIndex.java:2493)#
      I have doubt what parameters i need to pass to the method updateCategoryContents,
      Let me give some information:
    taxonomy:
       /taxonomies/borrame5/Prueba2
    repository:
       /documents/Portal_KOF/KM/Pruebas1/Pruebas Versionamiento
    classification and search index:
       borrame5
       I can't classify automatically, when i insert the query from code. When I manually insert the query from the portal, automatic classification run perfectly.
    Thanks
    Greetings
    JARO.

Maybe you are looking for

  • 'Sorry Numbers for iCloud isn't responding' is the message I'm getting when trying to open a spreadsheet.

    I rang Apple support who told me that the file has corrupted and there's no way of getting it back. Has anyone else experienced this? Please let this be a warning to others that are using Numbers beta on iCloud, your files are not safe from corruptio

  • Error: System not configured as Integration Engine

    Hi , I was trying to simulate the following scenario in SAP XI: HTTP--> SAP XI --> (RFC/BAPI)SAP R/3 Let me clear what i did. I have to call a BAPI using RFC adapter in XI to display some information on a request of some Http app. 1. I have Imported

  • Keyfigure not showing up in Web I report

    I have created a BEx query based on a multiprovider on top of a DSO and cube. We have two key figures from the DSO and one from the cube. The BEx report shows all the three key figures, but the web I shows only one keyfigure based on the cube with th

  • Syncing never finishes - stops at last step

    I have iOS8.1.3, iPhone6+, Yosemite 10.10.2 and iTunes 12.1.50 - all current software.  I am trying to do a backup of my iPhone and at the Transferring Purchases stage it stops and says "preparing to copy items" and that's as far as it goes, tho the

  • Can't see file system tree in Workgroup Manager to add share point

    Server 10.4.11: open Workgroup Manager and select the Sharing panel. Clicking the "Share Points" tab displays my current share points as expected. But clicking the "All" tab shows a +completely blank window+: no volumes or folders at all! (The button