Re: [cx-oracle-users] calculate time differences on timestamp column
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2011-07-06 13:49:20
|
Hi, You can simply subtract them. cx_Oracle will return a datetime instance for the timestamp column and you can simply do timestampB - timestampA which will return to you a timedelta instance. You can also subtract them in Oracle and return the result to Python if you prefer that option. Anthony On Wed, Jul 6, 2011 at 6:22 AM, <prz...@po...> wrote: > Hello, > > I have a table with one timestamp column: > ----------------------------------------- -------- ---------------------------- > ID NOT NULL NUMBER(10) > DOC NOT NULL NUMBER(10) > TIME NOT NULL TIMESTAMP(6) > TYPE_OF_OPER NOT NULL VARCHAR2(1) > SIZE NUMBER(10) > DESC VARCHAR2(200) > > When I select from this table (just two columns) > TIME TYPE_OF_OPER > --------------------------------------------------------------------------- - > 11/07/06 13:03:45,826773 D > 11/07/06 13:03:45,848394 E > 11/07/06 13:03:46,978210 F > 11/07/06 13:07:48,053144 A > 11/07/06 13:07:48,072237 B > 11/07/06 13:07:48,444520 C > 11/07/06 13:07:48,504301 D > 11/07/06 13:07:48,532285 E > 11/07/06 13:07:49,504860 F > 11/07/06 13:07:50,554859 A > ... (over 10000 rows) > > Our developer records timestamps in important part of his application: > > code A ... > record timestampt 'A' > code B ... > record timestampt 'B' > code C ... > record timestampt 'C' > code D ... > (there are only 'A'-'F' timestamps). > > What I'd like to achive is to get delta time between 'A' and 'B' (= time of code 'B') > but for all 'A' and 'B' (as an output I get rows of numbers). > How can I calculate this using cx-oracle ? > > > Regards > Przemyslaw Bak (przemol) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------- > Znajdz samochod idealny dla siebie! > Szukaj >> http://linkint.pl/f29e2 > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |