Hop on a max timestamp with selfjoin timestamp

create table t1 as
(id varchar2(15),
status  number(2),
stattime timestamp(6))
INSERT INTO t1 (id, status, stattime) values ('abc', 1', TIMESTAMP '2008-10-08 10.41.05.233000'); 
INSERT INTO t1  (id, status, stattime) values ('zyz', '3', TIMESTAMP '2010-05-01 07.15.09.000000'); 
INSERT INTO t1  (id, status, stattime) values ('zyz','3', TIMESTAMP '2010-05-01 07.15.09.233000'); 
INSERT INTO t1  (id, status, stattime) values ('mnl', '1', TIMESTAMP '2011-06-08 10.41.05.233000'); 
INSERT INTO t1 (id, status, stattime) values ('mnl' ,3', TIMESTAMP '2010-06-08 10.41.05.233000'); 
Trying to get the status of max for the code. with the following sql
SELECT distinct a.status, a.stattime FROM t1 a
                            WHERE a.stattime = (SELECT MAX(B.stattime) FROM t1 B);
Select max works as expected.
 (SELECT MAX(B.stattime) FROM t1 B);
She returned stattime ' 2008 - 10 - 08 10.41.05.233000 am', to 'abc '.
But when use the complete select statement it returns nothing.
Am using oracle 11g.

Any ideas would be appreciated.

Hello

user628919 wrote:
Trying to get the status of max for the code. with the following sql

SELECT distinct a.status, a.stattime FROM t1 a
WHERE a.stattime = (SELECT MAX(B.stattime) FROM t1 B);

So why don't join you add the join on id predicate in the correlated subquery?

Scott@my10g SQL>with t1 as (
  2  select 'abc' id, '1' status, to_TIMESTAMP('2008-10-08 10.41.05.233000') stattime from dual
  3  union all select 'zyz', '3', to_TIMESTAMP('2010-05-01 07.15.09.000000') from dual
  4  union all select 'zyz','3', to_TIMESTAMP('2010-05-01 07.15.09.233000') from dual
  5  union all select 'mnl', '1', to_TIMESTAMP('2011-06-08 10.41.05.233000') from dual
  6  union all select 'mnl' ,'3', to_TIMESTAMP('2010-06-08 10.41.05.233000') from dual
  7  )
  8  SELECT distinct a.status, a.stattime FROM t1 a
  9                              WHERE a.stattime = (SELECT MAX(B.stattime) FROM t1 B where A.id=B.id) ;
Scott@my10g SQL>/

S STATTIME
- -----------------------------------
1 2011-06-08 10.41.05.233000000
3 2010-05-01 07.15.09.233000000
1 2008-10-08 10.41.05.233000000

Tags: Database

Similar Questions

  • Function max coupled with string concat... Please help...

    Dear all,

    I don't have to solve a query which requirements is below:

    Master data in the table looks like this:

    SEQ. NO Last_updated_date PCode

    1 AA February 1, 2008

    1 Ab January 2, 2009

    1 Ac January 3, 2009


    2 AA January 5, 2009

    2 AD December 31, 2008

    2 AF October 31, 2008


    3 AK January 1, 2009

    3 GH January 2, 2009

    3 AA January 3, 2009

    Now I need the output as:

    I need timestamp on each seqence max not (I mean groupby) (I'm really easy to find it), but it should show all pcode concated while displaying the result...

    Okay... the underside is light out put.. :

    for example in for seq 1 number one... Max timestamp is 1 February 2008 with pcode AA... so it should display as

    Seqno Pcode max (timestamp)
    ------- -------------- ----------------------

    1 AAABAC February 1, 2008

    (logical, it's she should select recording max (timestamp) and concat all the all the other pcode (only) to existing pcode eventough their timestamp is not max)

    like this for other groups of the sequence...

    Help, please... is it possible in a sqlquery to include this logic...

    Thanks for help
    ASP.

    Published by: Onenessboy on February 24, 2009 03:00

    Hello

    There is no need to hard code, replace the t table in the sub query with your table.

    Select seq_no,replace(max(pcode),'/','') pcode,min(last_updated_date) timestamp
    
    from 
    
    (Select seq_no,sys_connect_by_path(pcode,'/') pcode ,last_updated_date
    
    from t
    
    connect by prior seq_no = seq_no 
    
     and 
    
    prior last_updated_date > last_updated_date)
    
    group by seq_no
    
    /
    

    Kind regards
    Vinod

  • Choose a value for max, but with restrictions?

    First of all: I'm a noob-SQL...

    I saw, that there is a similar question below a few threads, but it does not.

    I have two tables.

    1 CASE

    2. STATE OF PLAY

    STATUS columns:

    STATUSID CASEID STATUS

    1         1       01

    2         1       02

    3         2       01

    4         3       01

    5         1       03

    6         2       02

    7         4       01

    ...


    Columns of CASES:

    CASEID BEGINDATE

    1 15/03/2014

    2 07/04/2014

    3 21/04/2014

    4 03/05/2014

    ...


    Now, I want to select all the cases that have the maximum status 02

    Not the case who are only in status 01 and also not the case which in addition have the status 03

    With:

    Select caseid, max (status)

    status

    Caseid group;

    I get max-status of all cases

    With:

    Select c.caseid, c.begindate, s.status

    case c, s status

    where c.caseid = s.caseid;

    I get all the information I need, but not selected on the case with max-status

    With:

    Select c.caseid, c.begindate, s.status

    case c, s status

    where c.caseid =)

    Select caseid, max (status)

    status

    Group caseid );

    Does not work, because the subselect statement has many values...

    I have no idea how to make the selection of columns with only maxstatus 01



    Select caseid

    status

    Caseid group

    After max (status) = '02';

  • How to get the Max value with other columns data also.

    Suppose that a query is covered with the data as

    Time of ID
    01 07/12/2014
    02 07/05/2014
    03 16/07/2014
    04 07/07/2014

    I need to get the ID and time to time max.
    that is, should I get
    Time of ID
    03 16/07/2014

    To do this, I wrote a query that gives me necessary data. But I thought that's the best way?
    Is it an effective way to get this data?
    My query that returns the data required is:

    SELECT ID, MAX_DT FROM
    (
    Select 'DUMMY', ID, TIME1, MAX (TIME1) OVER (PARTITION 'DUMMY') AS MAX_DT FROM TAB1
    WHERE ID IN (BLAH BLAH)
    )
    WHERE MAX_DT = (EDT) 1

    Frank mentioned links


    WITH test_data (id, time) LIKE)

    SELECT 01, to_date('2014/07/12','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 02, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 03, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 04, to_date('2014/07/07','yyyy-mm-dd') FROM dual

    )

    SELECT id, time

    go (select id,

    time,

    Max (Time) on latest_time (order by time lines between unbounded preceding and following unbounded)

    of test_data

    )

    where time = latest_time

    ID TIME
    3 16/07/2014
    2 16/07/2014

    Concerning

    Etbin

  • How to extract several Max (amount) with sql

    Hello

    I have this problem,

    I hace this table

    DISPLAY_NAME, MSISDN TRANSACTIONS

    ------------------------- ------------------- ------------

    CM, SA - MERCHANT I 829882904 75

    CM, SA - MERCHANT I 827102931 43

    CM, SA - MERCHANT I 17 824034968

    CM, SA - II MERCHANT 827102931 48

    4 selected lines.

    And I need to get the records corresponding to the highest trasactions by DISPLAY_NAME

    The must Resulet be something like

    DISPLAY_NAME, MSISDN TRANSACTIONS

    ------------------------- ------------------- ------------

    CM, SA - MERCHANT I 829882904 75

    CM, SA - II MERCHANT 827102931 48

    Any ideas?

    TXS so you can help

    Hello

    One way is a Request of Top - N , like this

    WITH got_r_num AS

    (

    SELECT x *- or list columns you want

    Rank () OVER (PARTITION BY display_name

    Operations ORDER BY DESC

    ) AS r_num

    FROM table_x

    -WHERE... - If you need any filtering, put it here

    )

    SELECT *- or the list of all columns except r_num

    OF got_r_num

    WHERE r_num = 1

    ;

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements)
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results in these places.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Picking MAX record with logic!

    Hi Experts,

    I have a situation here. The sample account as follows.

    EMP_SEQ | EMP_NO | EMP_CD | EMP_NAME
    1. 100. P | JOHN
    2. 100. P | BOSCH

    3. 200 | P | CLIFTON

    4. 300. Q | JENNY

    5. 400. P | JOSE
    6. 400. Q | JOEL


    In any case, I need to take the MAX (EMP_SEQ) records when,.

    1 EMP_CD all are P then take record EMP_SEQ MAX.
    2 EMP_CD's just Q then take this record EMP_SEQ.
    3 EMP_CD has both P and Q, then you take the MAX of EMP_SEQ of P-file.

    In this way, my desired output would be going like that.

    EMP_SEQ | EMP_NO | EMP_CD | EMP_NAME
    2. 100. P | BOSCH
    3. 200 | P | CLIFTON
    4. 300. Q | JENNY
    5. 400. P | JOSE

    Can you help me build a SQL to do this?

    Any help would be appreciated.

    Thank you
    K

    Like this

    SQL> with emp
      2  as
      3  (
      4  select 1 emp_seq, 100 emp_no, 'P' emp_cd, 'JOHN' emp_name from dual union all
      5  select 2 emp_seq, 100 emp_no, 'P' emp_cd, 'BOSCH' emp_name from dual union all
      6  select 3 emp_seq, 200 emp_no, 'P' emp_cd, 'CLIFTON' emp_name from dual union all
      7  select 4 emp_seq, 300 emp_no, 'Q' emp_cd, 'JENNY' emp_name from dual union all
      8  select 5 emp_seq, 400 emp_no, 'P' emp_cd, 'JOSE' emp_name from dual union all
      9  select 6 emp_seq, 400 emp_no, 'Q' emp_cd, 'JOEL' emp_name from dual
     10  )
     11  select max(emp_seq) keep(dense_rank last order by emp_cd_flag, emp_seq) emp_seq
     12       , emp_no
     13       , max(emp_cd) keep(dense_rank last order by emp_cd_flag, emp_seq) emp_cd
     14       , max(emp_name) keep(dense_rank last order by emp_cd_flag, emp_seq) emp_name
     15    from (
     16            select e.*, decode(emp_cd, 'P', 1, 'Q', 0) emp_cd_flag
     17              from emp e
     18         )
     19   group
     20      by emp_no
     21  /
    
       EMP_SEQ     EMP_NO E EMP_NAM
    ---------- ---------- - -------
             2        100 P BOSCH
             3        200 P CLIFTON
             4        300 Q JENNY
             5        400 P JOSE
    
  • Get the max value with other areas

    Hi all

    I have a table as below

    Value name
    - - - - - - - - - - - - - - - -
    A1 5
    A3 10
    A2 7
    A2 9
    A1 10

    What I get is the max (Value) and with the consolidation of its name

    Value name
    - - - - - - - - -
    A2 16

    Thank you
    Alex

    Published by: user8606416 on June 1, 2011 10:17

    Published by: user8606416 on June 1, 2011 10:26

    Depends on how you feel on one of the links of:

    SELECT name, value
    FROM (SELECT name, SUM(value)
          FROM table
          GROUP BY name
          ORDER BY 2 DESC)
    WHERE rownum = 1
    
    SELECT name, SUM(value)
    FROM table
    GROUP BY name
    HAVING SUM(value) >= ALL (SELECT SUM(value)
                              FROM table
                              GROUP BY name)
    

    among many other methods. The first takes a single arbitrary registration in the case of a tie, and the second shows all the related records.

    John

  • ORA-06502 when you use MAX (Column) with % TYPE

    Hello

    I tried to limit the problem as much as I can and have managed to isolate a particular scenario. As the structure and sensitive data, I had to come up with a scenario that I tested it and it causes the same problem occurs. The scenario is as follows

    Assuming that I have a table defined as follows

    CREATE TABLE TEST_TABLE (TEST_COLUMN CHAR (8 BYTES));

    and the table has only one record NZ07100S

    We also define a function as

    CREATE OR REPLACE FUNCTION
    FUNCTION GETTESTVALUE
    TEST_TABLE RETURN. TYPE % TEST_COLUMN
    IS
    TEST_VALUE TEST_TABLE. TYPE % TEST_COLUMN;
    BEGIN
    SELECT MAX (TEST_COLUMN) IN TEST_VALUE TEST_TABLE;
    RETURN TEST_VALUE;
    END;



    We ran the following command

    SELECT GETTESTVALUE FROM DUAL;

    and receive an error as follows

    Error report:
    SQL error: ORA-06502: PL/SQL: digital or value error: character string buffer too small
    ORA-06512: at "GETTESTVALUE", line 6
    06502 00000 - "PL/SQL: digital error or the value of %s.


    However, if were to change the function of the following

    CREATE OR REPLACE FUNCTION
    FUNCTION GETTESTVALUE
    TEST_TABLE RETURN. TYPE % TEST_COLUMN
    IS
    TEST_VALUE TEST_TABLE. TYPE % TEST_COLUMN;
    BEGIN
    SELECT TEST_COLUMN IN TEST_VALUE TEST_TABLE;
    RETURN TEST_VALUE;
    END;

    There is no error reported and the value nz07100s is returned.

    Of course, when we changed the function is

    CREATE OR REPLACE FUNCTION
    FUNCTION GETTESTVALUE
    TEST_TABLE RETURN. TYPE % TEST_COLUMN
    IS
    TEST_VALUE TEST_TABLE. TYPE % TEST_COLUMN;
    BEGIN
    SELECT CAST (MAX (TEST_COLUMN) AS CHAR (8)) IN TEST_VALUE TEST_TABLE;
    RETURN TEST_VALUE;
    END;

    No error is reported, and the value is returned

    However, the function in question is in the use of production since 2004. We are currently a few changes to the application and imported the backup of Oracle 10 g Oracle XE. When we try to run the function, the error is thrown.

    I would like to understand if this is a limitation with Oracle XE that causes this problem. It seems to me that the problem is to select the MAX value in the variable that has been set. Executing the query directly from sqlplus does not generate an error, and therefore do not feel there is an error with the SQL code. The only time that we can't get the error is with the INTO statement.

    Is there a way to use the function as it has been defined in production? Why the ORA-06502 error would be thrown? It does not seem to make sense to me. Would appreciate any guidance on this.


    Thanks and greetings

    Jega

    Thank you

    What happens if you do this and rerun the select

    SQL>alter table test_table modify test_column varchar2 (8 byte);
    

    Edit:
    You may need to open a SR with Oracle on this one
    (Really, financial system on XE?)

    Concerning
    Peter

    Published by: Peter on March 4, 2009 12:58 AM

  • FF9 - hide window control buttons in the title bar (min, max, close) with userchrome.css?

    I use FF9. I userscript.css hide app titlebar button and orange, but the buttons control window always visible! I can't find the script working.

    I don't need min-max-closing button and used to hide if possible without extension.

    Here's screenshort:
    http://s018.Radikal.ru/i522/1201/50/f6a6ea445507.jpg

    If you use the full screen mode and you have these buttons on the Navigation bar, then you should use this code.

    #window-controls { display:none!important; }
  • What is the resolution of the max screen with speed Port Replicator Hi (PA3838E-1PRP)

    Hello

    I have a Toshiba Portege R700 - 11 p and I want to buy a duplicator of Port speed Hi (PA3838E-1PRP), but I want to know the maximum screen resolution with ang VGA HDMI on the port replicator.

    Thanks in advance for your answer

    Hello

    The maximum display resolution depends on the laptop (graphics card) and the external display that is connected to the port replicator to Port Hi-Speed.

    The internal graphics INTEL QM57 (incorporated into the Portégé R700) overview card provides this info:
    http://www.Intel.com/products/Notebook/chipsets/QM57/QM57-overview.htm
    + This chipset supports the DisplayPort interface * with a resolution up to 2560 x 1600. +

    Therefore, check the properties of the external monitor.

  • latitude dell max resolution with e-port replicator

    I have the following scenario:

    • Laptop: Dell Latitude E6420 i7 with Intel HD Graphics 3000
    • Monitor: Dell 3007WFP 30' (up to 2560 x 1600 resolution)
    • Docking station: e-port replicator for Dell T308d
    • Adapter: Dell Display Port to DVI - D adapter cable DP/N 023NVR

    Problem: the screen 30 '' Maximum available resolution is 1280 x 800.

    Question:

    Say that I can't get the monitor resolution of 2560 x 1600 with the integrated Intel HD3000 card or the e-port replicator as the laptop has no native DVI - D Dual Link, I should be able to get at least 1920 x 1080 per display port. No difficulty to get the best resolution of 1280 x 800?

    Among the measures taken so far:

    1. The monitor has only a DVI - D Dual Link port so I use a DVI - D Dual link to cable DVI - D Dual Link to connect to the docking station does not work, I read somewhere that the e-port replicator is actually DVI - D Single Link inside so won't work because the monitor needs native DVI - D Dual Link.
    2. Using the same DVI - D Dual Link connection cable double DVI - D, but this time I add a DVI - D Dual link adapter port screen and connect to the port of display in the e-port replicator port, always the same question.
    3. To connect directly to the laptop using DVI - D Dual Link to HDMI Cable, always the same.
    4. Also tried manually add resolutions custom in the Intel like 1920 x 1800 Graphics Control Panel, or by using p 50 Hz frequency refresh, 30 Hz, etc. timing standard CVT or FTE or CVT - RB. When I apply these custom settings, the monitor screen goes black as if it does not support so it changes again in 1280 x 800.
    5. All the drivers are up to date.

    Help will be greatly appreciated! -

    You will need an active displayport to DVI. Here is the link to the purchase page.

    http://Accessories.Dell.com/SNA/ProductDetail.aspx?c=us&l=en&s=Gen&SKU=a7102180

  • U2713HM, max resolution with a laptop without DVI and DisplayPort?

    This is the type of response to a previous post with the same title.  However, the interface of the forum does not seem to allow a response on older posts, even if they remained unanswered and have customers.  Ho-hum. In any case, I discovered that I can drive the U2713HM using a simple HDMI cable to your laptop using the interface of view nVidia Control Panel (page 'Change resolution') property and setting a custom resolution to match the full 2560 x 1440. The trick is to use the Customize button and create a 'custom resolution' for the progressive 32 bits 2560 x 1440, use 'Automatic' and then drop the (Hz) refresh rate up to about 38 to 41 Hz. To find one that works and then keep trying new in 1 Hz increments until it fails. I'm at the wheel of a laptop Toshiba Qosmio, using its output using a refresh of 41 Hz. frequency something higher and display will not 'lock-in' to its native resolution HDMI (available only) the screen (normally connected by Dual link DVI to a desktop machine). So allow me to use the input on the screen switch to switch between my desktop PC and laptop. Works a treat!

    Just thought I would add that:

    This may be possible with a workaround to other problems of option cable - for example, poor quality or cables of big length - where the main problem is one of the supported by the cable or the type of interface bandwidth.  By lowering the refresh rate, you are lowering the bandwidth requirement.  For old CRT screens, it usually resulted in a significant - not so remarkable gradation with LCD/LED technology!  And don't forget that the eye can integrate cini-film at rates as low as 25 Hz!  Affecting the refresh rate of 30 to 48 Hz on a LCD/LED modern is now a viable solution for the problems of bandwidth of cable. Note, however, that all the problems can be addressed by here: for example, I got a cable from DVI single-link for which no stable frequency could be found (the monitor really need Dual - Link DVI - one with a full set of pines).

  • Hi there, hope someone can help me with an Illustrator logo that I drew.

    Hi all, my logo looks great in Illustrator, but when I place it in Indesign it loses one of the elements...  I have a form with a gradient, there another element shaped inside, as well as two words. One word covers the edges so I used the scissors tool to cut the overlap. This is whenever I place this file, that the Word does not place with her! It drives me crazy. I have it together. If I copy / paste from Illustrator into Indesign, the slope becomes black. Please can someone help and tell me what I can hurt?

    You must select one of the letters in Illustrator with the direct Selection tool and then take a screenshot of the letter, the layers panel open and the appearance Panel.

    Also: it seems that you placed an EPS in InDesign. If Yes: don't. EPS is file format of the last century. It can and it will hurt you.

  • date max with multiple joins of tables

    Looking for expert advice on the use of max (date) with multiple joins of tables. Several people have tried (and failed) - HELP Please!

    The goal is to retrieve the most current joined line of NBRJOBS_EFFECTIVE_DATE for each unique NBRJOBS_PIDM. There are several lines by PIDM with various EFFECTIVE_DATEs. The following SQL returns about 1/3 of the files and there are also some multiples.

    The keys are PIDM, POSN and suff

    Select NBRJOBS. NBRJOBS.*,
    NBRBJOB. NBRBJOB.*
    of POSNCTL. Inner join of NBRBJOB NBRBJOB POSNCTL. NBRJOBS NBRJOBS on (NBRBJOB. NBRBJOB_PIDM = NBRJOBS. NBRJOBS_PIDM) and (NBRBJOB. NBRBJOB_POSN = NBRJOBS. NBRJOBS_POSN) and (NBRBJOB. NBRBJOB_SUFF = NBRJOBS. NBRJOBS_SUFF)
    where NBRJOBS. NBRJOBS_SUFF <>'LS '.
    and NBRBJOB. NBRBJOB_CONTRACT_TYPE = 'P '.
    and NBRJOBS. NBRJOBS_EFFECTIVE_DATE =
    (select Max (NBRJOBS1. NBRJOBS_EFFECTIVE_DATE) as 'EffectDate '.
    of POSNCTL. NBRJOBS NBRJOBS1
    where NBRJOBS1. NBRJOBS_PIDM = NBRJOBS. NBRJOBS_PIDM
    and NBRJOBS1. NBRJOBS_POSN = NBRJOBS. NBRJOBS_POSN
    and NBRJOBS1. NBRJOBS_SUFF = NBRJOBS. NBRJOBS_SUFF
    and NBRJOBS1. NBRJOBS_SUFF <>'LS '.
    and NBRJOBS1. NBRJOBS_EFFECTIVE_DATE < = to_date('2011/11/15','yy/mm/dd'))
    order of NBRJOBS. NBRJOBS_PIDM

    Welcome to the forum!

    We don't know what you are trying to do.
    You want all of the columns in the rows where NBRJOBS_EFFECTIVE_DATE is the date limit before a given date (November 15, 2011 in this example) for all rows in the result set with this NBRJOBS_PIDM? If so, here is one way:

    with         GOT_R_NUM     as
    (
         select       NBRJOBS.NBRJOBS.*,
                NBRBJOB.NBRBJOB.*     -- You may have to give aliases, so that every column has a unique name
         ,       rank () over ( partition by  NBRJOBS.NBRJOBS_PIDM
                                   order by      NBRJOBS.NBRJOBS_EFFECTIVE_DATE     desc
                          )             as R_NUM
         from          POSNCTL.NBRBJOB NBRBJOB
         inner join      POSNCTL.NBRJOBS NBRJOBS       on    (NBRBJOB.NBRBJOB_PIDM = NBRJOBS.NBRJOBS_PIDM)
                                            and      (NBRBJOB.NBRBJOB_POSN = NBRJOBS.NBRJOBS_POSN)
                                      and      (NBRBJOB.NBRBJOB_SUFF = NBRJOBS.NBRJOBS_SUFF)
         where       NBRJOBS.NBRJOBS_SUFF             != 'LS'       -- Is this what you meant?
         and        NBRBJOB.NBRBJOB_CONTRACT_TYPE   ='P'
         and       NBRJOBS.NBRJOBS_EFFECTIVE_DATE  <= to_date ('2011/11/15', 'yyyy/mm/dd')
    )
    select       *     -- Or list all columns except R_NUM
    from       GOT_R_NUM
    where       R_NUM          = 1
    order by  NBRJOBS_PIDM
    ;
    

    Normally this site does not display the <>inequality operator; He thinks it's some kind of beacon.
    Whenever you post on this site, use the other inequality operator (equivalent), *! = *.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) for all the tables involved and the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    You will get better results faster if you always include this information whenever you have a problem.

  • [Oracle 8i] How to convert a string (timestamp) in a date?

    I find it difficult to know how to convert a string to a date time stamp (or possibly several).

    The timestamp is 20 positions, character (NOT NULL, CHAR (20))
    in the format: YYYYMMDDHHMMSSUUUUUU
    where Y = year, M = month, D = day, M = Minutes, S = seconds and U = microseconds

    The reason why I want to convert it is so that I can compare a timestamp to each other (that is, I want to be able to find the MIN (timestamp), MAX (timestamp) and make comparisons of inequality).

    Is this possible?

    Thanks in advance for the help on this!

    Hello

    As Damorgan said, if all you want to do is find which is the earlier or later, then you can just compare the strings: they are in a format where it works.

    If you need to do other things, such as compare to today date or see the difference between two of your lines of days, you will need to convert it to date. (He has no reason to convert them to numbers).

    A new TIMESTAMP data type, which manages the fractions of a second, was introduced in Oracle 9.
    Since you use Oracle 8 (depending on your subject line), or it must be
    (1) ignores the microseconds, or
    (2) use a separate column for microseconds.

    Whatever it is, use TO_DATE to convert the first 14 characters in DATE:

    TO_DATE ( SUBSTR (txt, 1, 14)
            , 'YYYYMMDDHH24MISS'
            )
    

    where txt is your column of type CHAR.
    To convert microseconds to a number (between 0 and 999999):

    TO_NUMBER (SUBSTR (txt, 15))
    

Maybe you are looking for

  • TC Wan

    I have a 5th Gen Time Capsule ("TC") (firmware 7.7.7). I would like to extend the network wireless using a TC of Gen (firmware 7.6.7) 4th (TC both have the latest firmware available for them). I want to do it without an Ethernet cable connecting the

  • Windows 7 installed on NB205-N311/W, working just fine

    Right out of the box, Windows 7 works perfectly. Wireless worked, its worked, even my wireless mouse worked without having to add additional drivers. Then, I got Microsoft Update install everything what he thought I needed. Then I installed these pos

  • Bluetooth is available on Satellite A135

    Hello! I want first of all whether this model A135-4527, is Bluetooth compatible, because I initially: System > Device Manager > Bluetooth > Bluetooth RFCOMM. But from a file at the factory office who said that I had to uninstall this thing and insta

  • Problems installing Win XP on Satellite A300-1MT

    I have preinstalled Vista Home, but to switch to XP.The problem is:When I boot from the XP cd, I got a blue screen after a few minutes (white always copy the operating system)How to solve this problem? And we have someone at - he tried Win7 on this l

  • Not able to see the "calls cell phones iPhone" on the iPhone 4S

    Hello I have iPhone 4 (running OS 9.1) s and MacbookPro (running OS Yosemite 10.10.5). Im trying to make calls from my Mac, but while doing this, he throws me error that your devices are on the same network. IM guaranteed that they are in the same ne