Select number of rows changed within an hour

Hi all, i below are samples of my data
name: age : changed_date_time
peter: 13: 2/10/06 13:45:30
james: 14: 2/10/06 13:30:45
justin:17: 2/10/06 14:05:00
john:20: 4/10/06 05:10:31
my desired result is
changed_date_time : number of records
2/10 13hrs : 2
2/10 14hrs : 1
4/10 05hrs : 1
what i wrote wasselect to_char ( changed_date_time , 'dd/mm hh24'),count (*)
from table1
group by changed_date_timeI tried to include a sum function within my query, i was not able to achieve my desired results. Can someone advise?

Change your group by clause
with t as
select 'peter' name,13 age, to_date('2/10/06 13:45:30','dd/mm/yy hh24:MI:SS') changed_date_time from dual
union all
select 'james',14,to_date('2/10/06 13:30:45','dd/mm/yy hh24:MI:SS') from dual
union all
select 'justin',17, to_date('2/10/06 14:05:00','dd/mm/yy hh24:MI:SS') from dual
union all
select 'john',20,to_date('4/10/06 05:10:31','dd/mm/yy hh24:MI:SS') from dual
select to_char(changed_date_time,'DD/MM hh24')||'hrs' ||' : '||count(1) from t
group by to_char(changed_date_time,'DD/MM hh24')

Similar Messages

  • Is it possible to change the number of rows while printing a contact sheet in Iphoto? Please help

    Hi guys, I am struggling to find out how to change the number of rows on a contact sheet on Iphoto , i have selected my photos and i want it to print 6 photos on each page however I am not able to do it.      Please help me out, im a Art student and i need to submit my contact sheets for an assignment  Thanks in advance guys !!!!!

    I don't think you can do that with the Contact Sheet layout.  If you have Pages or a 3rd party image editor that supports layers you can do what you want.  Or try the demo version of OmniGraffle for Mac It will run fully operational for 14 days. 

  • How to listen for cell selection changes within a JTable

    Problem: my table has 8 columns, with 4 of them containing very large text (up to 1000 chars). Solution is to set the initial size these columns so that the 1st 20 chars are visible, and if one of these columns gains focus/selection via mouse-clicking/tabbing/arrow keys, the entire text is shown in a JTextArea below the table.
    I added a ListSelectionListener to the table, but this only informs me when the row selection has changed.
    I added a FocusListener to the table, but this only informs me when the table gains/loses focus, not when it's been changed within.
    I added a TableColumnModelListener to the TableColumnModel, but this only informs me when the column selection has changed.
    I didn't bother with MouseListener as this won't handle change of selection via tabbing.
    The LSL got me half way there, and the TCML got me the other half. Any ideas on how to combine?
    Or is there something obvious that I'm missing?

    Walter Laan wrote:
    Use both and call the same method which updates the text area based on the current selected (or focused == lead selection index) cell.Yeah - that's what I figured. I just didn't know if there was a magic bullet (i.e., a single listener) out there that I was missing.
    While you are at it, also add a table model listener which calls the same method if the selected cell is updated.I'll keep that in mind, but it's not necessary in this particular case. The table cells in question will be uneditable. The text area will have supporting Edit/Save/Cancel buttons.

  • Number of rows inserted is different in bulk insert using select statement

    I am facing a problem in bulk insert using SELECT statement.
    My sql statement is like below.
    strQuery :='INSERT INTO TAB3
    (SELECT t1.c1,t2.c2
    FROM TAB1 t1, TAB2 t2
    WHERE t1.c1 = t2.c1
    AND t1.c3 between 10 and 15 AND)' ....... some other conditions.
    EXECUTE IMMEDIATE strQuery ;
    These SQL statements are inside a procedure. And this procedure is called from C#.
    The number of rows returned by the "SELECT" query is 70.
    On the very first time call of this procedure, the number rows inserted using strQuery is *70*.
    But in the next time call (in the same transaction) of the procedure, the number rows inserted is only *50*.
    And further if we are repeating calling this procedure, it will insert sometimes 70 or 50 etc. It is showing some inconsistency.
    On my initial analysis it is found that, the default optimizer is "ALL_ROWS". When i changed the optimizer mode to "rule", this issue is not coming.
    Anybody faced these kind of issues?
    Can anyone tell what would be the reason of this issue..? any other work around for this...?
    I am using Oracle 10g R2 version.
    Edited by: user13339527 on Jun 29, 2010 3:55 AM
    Edited by: user13339527 on Jun 29, 2010 3:56 AM

    You have very likely concurrent transactions on the database:
    >
    By default, Oracle Database permits concurrently running transactions to modify, add, or delete rows in the same table, and in the same data block. Changes made by one transaction are not seen by another concurrent transaction until the transaction that made the changes commits.
    >
    If you want to make sure that the same query always retrieves the same rows in a given transaction you need to use transaction isolation level serializable instead of read committed which is the default in Oracle.
    Please read http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_sqlproc.htm#ADFNS00204.
    You can try to run your test with:
    set  transaction isolation level  serializable;If the problem is not solved, you need to search possible Oracle bugs on My Oracle Support with keywords
    like:
    wrong results 10.2Edited by: P. Forstmann on 29 juin 2010 13:46

  • Can u find (number of rows) + (SELECT * FROM emp) in 1 query?

    We have a requirement like this: We need to pass a SQL statement as a SYS_REFCURSOR OUT variable from a SP. Problem is, if the SQL returned 0 rows we have to send 1 row with all NULLS to the SYS_REFCURSOR.
    Is there any way to find out the number of rows returned from a SQL without having to put a SELECT COUNT(*) again using the "same" SQL?

    Peter:
    That only works if the cursor actually returns rows. Consider:
    SQL> create table t as
      2  select rownum id, to_char(to_date(rownum, 'J'), 'Jsp') descr
      3  from user_objects
      4  where rownum <= 5;
    Table created.
    SQL> insert into t select * from t;
    5 rows created.
    SQL> commit;
    Commit complete.
    SQL> create function f (p_id in number) return sys_refcursor as
      2     l_cur sys_refcursor;
      3  begin
      4     open l_cur for
      5        select id, descr, count(*) over() cnt
      6        from t
      7        where id = p_id;
      8     return l_cur;
      9  end;
    10  /
    Function created.
    SQL> var cur refcursor
    SQL> exec :cur := f(1);
    PL/SQL procedure successfully completed.
    SQL> print cur
            ID DESCR             CNT
             1 One                 2
             1 One                 2
    SQL> exec :cur := f(42);
    PL/SQL procedure successfully completed.
    SQL> print cur
    no rows selectedSince the OP's requirement (or ""solution" coming from someone who misunderstood the concept of cursors") is that "if the SQL returned 0 rows we have to send 1 row with all NULLS to the SYS_REFCURSOR" the analytic count doesn't help.
    @OP
    The only reliable (for certain definitions of reliable) way would be to consume the first row of the cursor to see if it did in fact return any rows.
    However, if the cursor was initally empty, we then need to generate a new cursor with all NULLS to satisfy the request. Not a big deal, as the new cursor would reflect the state of the database at the time of the initial query, even if a qualifying row was inserted and committed between the first query and the second, but it doesn't work the other way around.
    If I consume the first row and find a record, then I need to re-do the query to get all of the rows. but what happens if another process changes/deletes the qualifying row in between and commits? The second query will have no rows and you will return an empty cursor to the caller.
    Also, counting the rows (which the analytic count will need to do) could have a significant impact on performance since all the qualifying rows need to be read before the first row can be returned.
    John

  • Change time from number format(ie. 3.50 hours) to regular time format( ie.3:30)

    How do you Change time from number format(ie. 3.50 hours) to regular time format( ie.3:30)

    I performed the following function in order to get my report to view the information the way that I wanted to see it:
    put this formula across from the caption âu20ACu0153Display Stringâu20AC within the âu20ACu0153Format Fieldâu20AC window for description.Â
    whileprintingrecords;
    MonthName(tonumber(Mid({CartonHistory.DateTimeStamp},5,2)),true) & Mid({CartonHistory.DateTimeStamp},7,2) & ", " & Mid({CartonHistory.DateTimeStamp},1,4)Â & " " & Mid({CartonHistory.DateTimeStamp},9,2) & ":" & Mid({CartonHistory.DateTimeStamp},11,2) & "." & Mid({CartonHistory.DateTimeStamp},13,2)
    It converts dates from: 20061212102311xx to: Dec12, 2006 10:23.11.

  • How to get number of rows return in SELECT query

    i'm very new in java, i have a question:
    - How to get number of rows return in SELECT query?
    (i use SQL Server 2000 Driver for JDBC and everything are done, i only want to know problems above)
    Thanks.

    make the result set scroll insensitve, do rs.last(), get the row num, and call rs.beforeFirst(), then you can process the result set like you currently do.
             String sql = "select * from testing";
             PreparedStatement ps =
              con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
             ResultSet rs = ps.executeQuery();
             rs.last();
             System.out.println("Row count = " + rs.getRow());
             rs.beforeFirst();~Tim
    NOTE: Ugly, but does the trick.

  • How to change Number of Rows in a Tabular Form report page?

    Hi
    I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
    Thanks,
    Chak
    Edited by: user520137 on Jan 12, 2010 12:04 PM

    Hi
    I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
    Thanks,
    Chak
    Edited by: user520137 on Jan 12, 2010 12:04 PM

  • How to control the number of rows selected from a sybase database table?

    Hi, JDBC guru,
    I'm working on project using Sybase 11.9.x database.We need to process a record in a table,first select it from the table,then do some computing,finally write it to a dbf file, if the above steps succeed,remove the original row in the table.Quite evidently, all these operation should be put into one transaction. But how can I select just a number of rows from the sybase database table?
    Any hints?
    Thank you in advance.
    Regards,
    Jusitne

    Statement stmt...
    stmt.setMaxRows(20);

  • Changing the default number of rows displayed in a interactive report

    Hi,
    I have a sql query based interactive report but i cant change the default number of pages i.e 15.
    is there any way to change the number of rows displayed.
    Thank you,
    rakesh

    Hi,
    That was very useful document that you shared, yes that is correct we can so it this way but there is another way doing it where in if you go to the report attribute section and in that there is Layout and Pagination and under
    that you can fix the number of rows, and over there we can also accept values from page item such as if the page item value changes the number of rows displayed in the report changes dynamically.
    In my report i get only pagination but not a option for layout.
    Any help will be appreciated.
    And also where i can get the links to the similar document that you have shared ?
    TY
    rakesh
    Edited by: rakesh119 on Apr 30, 2013 12:10 PM

  • Is it possible to change the number of rows to be displayed in adf query ?

    Hello,
    is it possible to change the number of rows that are displayed in an adf query similar to an adf form ?
    I need to display approx 5 rows per column instead of displaying all the fields in a single column ? Thanks.

    Thanks , how do you add in the code ,is it something like follows :
    <af:query id="qryId1" headerText="Search" disclosed="true"
                                value="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
                                model="#{bindings.ImplicitViewCriteriaQuery.queryModel}"
                                queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}"
                                queryOperationListener="#{bindings.ImplicitViewCriteriaQuery.processQueryOperation}">
                        <af:inputText value="#{bindings.PrtDesc.inputValue}" label="Desc"
                                      required="#{bindings.PrtDesc.hints.mandatory}"
                                      columns="#{bindings.PrtDesc.hints.displayWidth}"
                                      maximumLength="#{bindings.PrtDesc.hints.precision}"
                                      shortDesc="#{bindings.PrtDesc.hints.tooltip}" id="it3">
                          <f:validator binding="#{bindings.PrtDesc.validator}"/>
                        </af:inputText>
                      <af:column>
                       <af:outputtext/>
                        <af:outputtext/>
                     </af:column>
                      </af:query>

  • How can I limit the number of rows returned by a select stat

    How can I limit the number of rows returned by a select
    statement. I have a query where I return the number of stores
    that are located in a given area.. I only want to return the
    first twenty-five stores. In some instances there may be over
    200 stores in a given location.
    I know is SQL 7 that I can set the pagesize to be 25....
    Anything similiar in Oracle 8i?
    null

    Debbie (guest) wrote:
    : Chad Nale (guest) wrote:
    : : How can I limit the number of rows returned by a select
    : : statement. I have a query where I return the number of
    : stores
    : : that are located in a given area.. I only want to return the
    : : first twenty-five stores. In some instances there may be
    : over
    : : 200 stores in a given location.
    : : I know is SQL 7 that I can set the pagesize to be 25....
    : : Anything similiar in Oracle 8i?
    : If you are in Sql*Plus, you could add the statement
    : WHERE rownum <= 25
    : Used together with an appropriate ORDER BY you
    : could get the first 25 stores.
    Watch out. ROWNUM is run before ORDER BY so this would only
    order the 25 selected
    null

  • Select  a specific  number of rows in query

    How can a specific number of rows be selected in a query? For example, a query retrieves 30,000 records and I want to retrieve the output by groups of 5,000. I want the query to retrieve the first 5,000 records, then the next 5,000 records etc. I tried rownum but that does not work.
    Thanks,
    PANY

    Not AGAIN. Please...........
    Do you know how to Google? Search forum?
    Why do you ask this boring FAQ AGAIN?
    Sybrand Bakker
    Senior Oracle DBA
    Experts: Those who know how to search.

  • Can i get a number of rows in the select list??

    Hello~
    I am studying the "oracle call interface". but i don't know much about oci.
    Anyway i want to know that how can i get a number of rows.
    for example, there is a source code of the number of colums in the select list.
    The following is a list of DB(example)
    /*DB table*/
    ID NAME CODE ID
    1 A 1 A
    2 B 2 B
    /*source*/
    err = OCIAttrGet ((dvoid *) stmhp, (ub4)OCI_HTYPE_STMT, (dvoid*)
    &parmcnt, (ub4 *) 0, (ub4)OCI_ATTR_PARAM_COUNT, errhp);
    /*result*/
    The Column is 4. (ID, NAME, CODE, ID)
    So, i think that the row is 3 (ID, 1, 2) in the DB table.
    Simply, Can i get a number of rows in the select list??
    for example,
    err = OCIAttrGet ((dvoid *) stmhp, (ub4)OCI_HTYPE_STMT, (dvoid*)
    &parmcnt, (ub4 *) 0, (ub4)OCI_ATTR_RAW_COUNT, errhp);
    I'm trying to get the number of row count. but i can't find.
    Please, could you let me know that how can i get the number of row count.
    Thank you.

    Thank you for your reply.
    we are tested the source code by reply.
    The following is the test source code.
    /*source code*/
    strcpy (szStatement, "SELECT * from DB_TABLE");
    OCIStmtPrepare(gpOCIReadStmHandle, gpOCIErrHandle, szStatement,
         strlen(szStatement), OCI_NTV_SYNTAX, OCI_DEFAULT);
    OCIStmtExecute(gpOCISvcHandle, gpOCIReadStmHandle, gpOCIErrHandle,
         0, 0, 0, 0, OCI_DEFAULT);
    /* get a number of rows count , Reply : prajithparan*/
    OCIAttrGet((dvoid *)gpOCIReadStmHandle, OCI_HTYPE_STMT, (dvoid *)&nRowCount, NULL, OCI_ATTR_ROW_COUNT, gpOCIErrHandle))
    But There is a problem of the result value.
    The result value is 0. It's mean that the row count is 0. and then we are using the all of fuction is succeed.(return value)
    I don't know what is problem. Please let me know about the problem and solution.
    Thank you.

  • Report Script - How to get the total on the any number of rows selected

    Hi,<BR>I am using Essase and report script for the reporting purpose. In this i would like to know how to get the sum of all the rows selected. I know we can use the calculate row, but it has to be done with print row to display the newly created row. But i am using alphablox where this print row is not working. Is there any other alternative is there to get the sum of any number of rows, and displaying them??<BR>Please help me.<BR><BR>Regards<BR>R.Prasanna

    Pls check the structure and index.
    EMP_ID NUMBER(9) NOT NULL,
    EMP_CD           NUMBER(3),
    EMP_NO VARCHAR2(250 BYTE) NOT NULL,
    FROM_EFF_DT DATE NOT NULL,
    TO_EFF_DT DATE,
    CREATE INDEX IDX_EMP_NO ON EMP
    (EMP_NO)
    NOLOGGING
    TABLESPACE INDEXES
    PCTFREE 20
    INITRANS 10
    MAXTRANS 255
    STORAGE (
    INITIAL 56K
    NEXT 1784K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    NOPARALLEL;

Maybe you are looking for

  • How to Edit a PDF File in Adobe Reader

    I used to create PDF files from the blog [link removed] But i would like to delete the links in the sidebar and other un wanted content from the PDF file but i cant do it in Adobe Reader. How can i delete it. Is there any option. Do i have to install

  • One apple id on two different ipads at one time?

    for my friend. owns an iPad 3, won an iPad Air. Can one itunes store account, aka apple id be used on both iPads?

  • Adobe AIR Error Message - Application Descriptor

    Upon starting my computer I keep getting an error message for Adobe AIR stating, "Application descriptor could not be found for this application. Try re-installing or contacting the publisher for assistance." I have uninstalled and re-installed Adobe

  • How to get/set value in illustrator preference file using ActionScript 3.0

    Hi all, I want to get/set the flex panel components preference in illustrator preference file using ActionScript 3.0. I tried to achieve this  like -- import com.adobe.illustrator.Preferences; var pref : Prefereneces = new Preferences(); //To set val

  • Taglib URI

    Hi I'm developing portlets with JAVA EE 5, Tomcat 5.5.x and Spring Framework 2.0. JSP + JSTL are used for views. In my jsp pages I have a line <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> which work fine and I can use the core taglib