SQL & PL/SQL :: Conversion Of Milliseconds / Seconds To HH:MM:SS Format
Feb 13, 2012
I ran this query :
SELECT el.date_time_stamp AS occurance_time,
esl.ack_time_stamp AS response_time,
esl.res_time_stamp AS resolved_time,
NVL ( (esl.ack_time_stamp - el.date_time_stamp), 0)
AS time_taken_to_acknowledge,
NVL ( (esl.res_time_stamp - el.date_time_stamp),0 )
[code].....
View 4 Replies
ADVERTISEMENT
Oct 8, 2012
select to_char(SYSDATE,'MMDDYYYYHHMISS') from dual;
Ouput:
10082012010338
It is giving me correct output, but i want to display even the Fraction of seconds, how can i?
I have tried this..but not working..
select to_char(SYSDATE,'MMDDYYYYHHMISSFF') from dual;
Output: Error.
View 4 Replies
View Related
Feb 13, 2013
I have column and loading time stamp like below.
RECORDTIMESTAMP TIMESTAMP DEFAULT to_timestamp(to_char(sysdate, 'DD-Mon-YYYY HH24:MI:SS')||'.0', 'DD-Mon-YYYY HH24:MI:SS.FF1') NOT NULL ENABLE
But RECORDTIMESTAMP data looks like '4/8/2009 5:48:00.000000 PM' I would like to supress 3 zeros in milli seconds section.( 3 more zero in milli seconds section)
View 10 Replies
View Related
Nov 9, 2011
I have a date column in a table, I need to fetch records from 27:11:11 00:00:10 to 30:11:11 00:00:10 (DD:MM:YY HH:MI:SS). i.e between seconds/min/hrs.
expecting Something like this,
SELECT * FROM TABLENAME WHERE MODEDATE BETWEEN
TO_CHAR('27/11/11 00:00:10','DD-MN-YY HH24:MI:SS') AND
TO_CHAR('30/11/11 01:10:10','DD-MN-YY HH24:MI:SS')
View 6 Replies
View Related
Feb 11, 2011
What is the exact usage of the SUBSECONDS in Timestamp data type.
Especially it has range upto 9 decimal places?
View 4 Replies
View Related
Oct 23, 2012
I have a date field which is passed as in parameter defaulted to sydate With the passed date as input I need to run an eod for every 15 mins by calculating
v_sdate := TRUNC ( in_sdate
- (MOD (TO_CHAR (in_sdate, 'MI'), 15) * 60)
/ (24 * 60 * 60),
'MI'
);
v_edate := TRUNC (in_sdate, 'MI');
Using the above v_sdate and v_edate I am calculating the start date and end date and compare these in my final select query.Now in case of rerun of old date, I am calculating start date as : v_sdate := TRUNC (in_sdate, 'MI') - 15 / 1440;
But in the above calculation, I am not considering seconds, but I need to consider those also, because say I ran the eod at 23-oct-2012 12:23:13 then my start date in case of re run should start from 12:23:14 secs , how can I achieve that?
View 3 Replies
View Related
Oct 23, 2013
SQL> SELECT MAX (upd_time), MIN (upd_time), COUNT (serial)
FROM (SELECT * FROM trans
UNION ALL
SELECT * FROM trans_archive);
MAX(UPD_T MIN(UPD_T COUNT(SERIAL)
--------- --------- -------------
23-OCT-13 01-JAN-11 5289261
I need to calculate seconds between MAX (upd_time) and MIN (upd_time) and then calculate trans/sec. Number of trans COUNT (serial).
SQL> desc trans;
Name Null? Type
----------------------------------------- -------- ----------------------------
SERIAL NOT NULL NUMBER(11)
UPD_TIME NOT NULL DATE
MESSAGE NOT NULL VARCHAR2(255 CHAR)
ENTITY_TABLE NOT NULL VARCHAR2(32 CHAR)
ACTION NOT NULL VARCHAR2(12 CHAR)
[code]....
trans_archive the same DDL.
my first try to get intervall between max and min date in secons:
SQL> SELECT EXTRACT (DAY FROM (MAX (UPD_TIME) - MIN (UPD_TIME))) * 24 * 60 * 60
+ EXTRACT (HOUR FROM (MAX (UPD_TIME) - MIN (UPD_TIME))) * 60 * 60
+ EXTRACT (MINUTE FROM (MAX (UPD_TIME) - MIN (UPD_TIME))) * 60
+ EXTRACT (SECOND FROM (MAX (UPD_TIME) - MIN (UPD_TIME)))
DELTA
FROM (SELECT * FROM TRANS
UNION ALL
SELECT * FROM TRANS_ARCHIVE);
SELECT EXTRACT (DAY FROM (MAX (UPD_TIME) - MIN (UPD_TIME))) * 24 * 60 * 60
*
ERROR at line 1:
ORA-30076: invalid extract field for extract source
View 18 Replies
View Related
Jan 2, 2013
I have to create the following table. The fields Trend_Date, Price and Trend are already given. I have to calculate the field permanently and to insert the value in this permanent table.
Fields:
The field price belong to the value of a product during the trade.
The field trade_date belongs to the moment of the trade.
The field trend belongs to the future behavior of the the price. Here, the price of the present moment is compared to the following price (possible characteristics: 'UP', 'DOWN', 'STABLE').
The field permanently belongs to the time (in seconds) how long the value of the field Trend_Date (depending on the price) is still true.
For example:
Row 1: The trend in row 1 is 'UP' and it has a price of '11'. Until row 3 this remains true (the price is greater or equal to 11). In this case, the difference between row 1 and row 3 are 9801 (rounded) seconds.
Row 2: The trend in row 2 is 'DOWN' and it has a price of '12'. This remains true till to the end (the price is never greater than 12) In this case, the difference between row 2 and row 11 are 97346 (rounded) seconds. To calculate the 97346 seconds the field has to consider that between row 2 and row 11 are two days. There will be no trade between 18:00 and 07:00 o'clock. This belongs to 7 hours for each days, in seconds (2*46800) 93600.
-> 190945-93600 = 97346s
Row 6: The trend in row 6 is 'UP' and it has a price of '5'. This remains true till to the end (the price is never smaller than 5) In this case, the difference between row 6 and row 11 are 65729 (rounded) seconds. To calculate the 65729 seconds the field has to consider that between row 65729 and row 11 are one days. There will be no trade between 18:00 and 07:00 o'clock. This belongs to 7 hours for each days, in seconds (1*46800) 46800.
-> 112528-46800 = 65729s
Row 9: The trend in row 9 is 'STABLE' and it has a price of '8'. Until row 10 this remains true (the price is equal to 8 ). In this case, the difference between row 9 and row 10 is 14418 (rounded) seconds.
Row 11: Is empty because there are no values to compare.
Example Table
TRADE_DATE --PRICE --TREND --permanently
02.01.13 11:21:42,720000000--11--UP--9801
02.01.13 12:44:03,236000000--12--DOWN--97346
02.01.13 14:05:03,845000000--11--DOWN--92485
[Code]....
View 16 Replies
View Related
Mar 1, 2012
Our database was generating archivelog(50MB) every 30seconds! I think this is not normal because what I did is open our database, I was the only one who is connected, I'm not running anything, but our database is still generating archivelogs!
Our redo logs: 6groups 3members.
This are the things I saw on our alert logs:
- advanced to log sequence
- cannot allocate new log, sequence
- checkpoint not complete
- private strand flush not complete
What I did is change the log mode of our database to noarchivelog then open the database, then returned it to archivelog mode then that fixed the problem. But the thing is after 6hours its abnormal behavior goes back again.
View 3 Replies
View Related
Nov 5, 2010
I am able to run this query in Sql Prompt.
DEFINE Today = TO_DATE('03.12.2004:10:34:24','DD.MM.YYYY:HH24:MI:SS')
SELECT TO_CHAR(hiredate,'DD.MM.YYYY:HH24:MI:SS') "Hiredate",
TO_CHAR(&Today,'DD.MM.YYYY:HH24:MI:SS') "Today",
trunc(86400*(&Today-hiredate))-60*(trunc((86400*(&&Today-hiredate))/60)) "Sec",
[Code]...
It gives proper / desired results. I want to use it on my Form, how can it be done?
View 3 Replies
View Related
Apr 11, 2013
I'm using Apex 4.2.1 against Oracle 11gR2 and mod_plsql.create a date picker item that allows users to select seconds as well as hours and minutes.
I have searched this Forum and see that others have asked this question. The answers have all been "No". However, I've seen no such question since version 4.1 has been released, and so, am hoping there now is a way to do this.
I have adjusted the Date Format field to be "DD-Mon-YYYY HH24:MI:SS", both under the date picker item itself as well as under the "Global" parameters section of my application. All to no avail. The date picker shows only hours and minutes for the time portion.
View 2 Replies
View Related
Oct 18, 2012
I have two varchar variable which has value like this
v_outpunch1:='17:50:00'
and v_Shifttime:='18:00:00'
this both time i am subtracting here and storing in another varchar variable which is like this.
v_EarlyLeaverstimeformat := LPAD((extract(hour from TO_TIMESTAMP (v_ShiftTime,'HH24:mi:ss')) - extract(hour from TO_TIMESTAMP (v_OutPunch1,'HH24:mi:ss'))), 2, '0')||':'|| LPAD((extract(minute from TO_TIMESTAMP (v_ShiftTime,'HH24:mi:ss')) - extract(minute from TO_TIMESTAMP (v_OutPunch1,'HH24:mi:ss'))), 2, '0')||':'|| LPAD((extract(second from TO_TIMESTAMP (v_ShiftTime,'HH24:mi:ss')) - extract(second from TO_TIMESTAMP (v_OutPunch1,'HH24:mi:ss'))), 2, '0');
it's not subtracting value correctly.
View 3 Replies
View Related
May 7, 2013
I have written a stand alone (Java SE 1.6) JMS client program to consume AQ's messages via Oracle JMS API (aqapi.jar). The queue is a multiple consumer queue, and i just created one subscriber on it. My JMS client program receives messages asynchronously by setting the MessageListener using the setMessageListener method.
Watching the work of the program, I found significant delays in receiving messages that are up to several seconds. When I turned on the diagnostic trace, I found that in the absence of messages listener (AQjmsSimpleScheduler) gradually increases the delay time up to 15 seconds:
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsSimpleScheduler.feedData: Got a non null message, the sleep time is reset to 0
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.run: sleep 0 millisecond.
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 1000
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.run: sleep 1000 millisecond.
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 1000 milliseconds
[code]....
Thus, in the worst case, the delay between placing the message in the queue and receiving it by the JMS client is 15 seconds.
Can I control this latency? For example, I would like to explicitly set the levels of the time delays.
View 1 Replies
View Related
Aug 29, 2008
I have a multimaster advance replication environment and we have less than 10 transaction per day...I want to propagate data as soon as possible like sync if I setup the schedule push to propagate transaction every 5 seconds as below
BEGIN
DBMS_DEFER_SYS.SCHEDULE_PUSH(
destination => 'orc2',
interval => 'SYSDATE + (5/60*60*24)',
next_date => SYSDATE,
parallelism => 1,
delay_seconds => 10);
END;
/
in other hand ,book(I mean Advance Replication) has written that for simulating continuous push we should setup it as below so it will propagate transaction every 1 minute.
My second question is:I know interval >= 'SYSDATE + (1/144)' means every 10 minutes a job will start and delay_seconds => 1200 means each job remain aware for 20 minutes, but I can't understand the logic?why it can simulate 1 minute propagation?
BEGIN
DBMS_DEFER_SYS.SCHEDULE_PUSH(
destination => 'orc2',
interval => 'SYSDATE + (1/144)',
next_date => SYSDATE,
parallelism => 1,
execution_second >= 1500,
delay_seconds => 1200);
END;
My thrid question is :Which of the above setups is a better solution for my environment?
View 4 Replies
View Related
Apr 23, 2012
Some app (wich I can't touch) stores a value that I need to modify with a trigger or even with a view.
Original value: 7B751BF0 (2071272432 in decimal)
Stored value: 4028331387 (F01B757B in hexa)
To make things short, I'm getting 4028331387 and I need to convert it to 2071272432.
View 6 Replies
View Related
Mar 12, 2013
I need to move one of my LMT tablespace to DMT, Can I do it , I know that the DMT's are depreciated since Oracle 9i but still need to know this.I am trying the below mentioned method to achieve the same.
SQL> exec DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_FROM_LOCAL('USERS');But I am facing the below mentioned error:
BEGIN DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_FROM_LOCAL('USERS'); END;
*
ERROR at line 1:
ORA-10616: Operation not allowed on this tablespace
ORA-06512: at "SYS.DBMS_SPACE_ADMIN", line 216
ORA-06512: at line 1
View 10 Replies
View Related
Jan 12, 2012
I have an issue with date conversion. In my table dates are in this formate:
04-DEC-90 10:46:46
I need to convert it in To_date.
SQL> select to_date('04-DEC-90','dd-mon-yy') from dual;
TO_DATE('04-DEC-90','DD-MON-YY
------------------------------
04/12/2090
SQL>
But the year shoul be 1990 not 2090.
View 3 Replies
View Related
Jan 4, 2013
I have a table datatype number (12,10) that I am reading out of. I am taking the value from this source table and inserting it into a destination table of datatype number (12,15).
I do not have the ability to alter the tables. How can i convert this number so i can insert. I am currently getting the error "ORA-01438: value larger than specified precision allowed for this column"
I am trying to use the to_number, but it not working. How can i format this number field so i can read it from source where i have number (12,10) and insert it successfully in a higher precision table of number(12,15)
View 1 Replies
View Related
Mar 27, 2012
Again i getting confused with conversion function especially Explicit data type conversions. some cases oracle server automatically converts the data to the required type. This is called IMPLICIT CONVERSION. Explicit conversions are done by using the conversion functions.
Oracle Explicit Data Type Conversions are
1 TO_CHAR
2 TO_DATE
3 TO_NUMBER
View 1 Replies
View Related
Jan 13, 2011
SELECT EMPNO ,ESAL,DEPTNO FROM EMP;
O/P
EMPNO ESAL DEPTNO
101 1000 10
I WANT O/P LIKE THIS
REQUIRED O/P
101
1000
10
View 5 Replies
View Related
Jan 21, 2013
My requirement is to converts row to Column information and sum of column in Weight kg in below manner Data in columns are not of same nature they can keep on changing
Item Supplier Consumer Package DWP_NO DWP_ED Quality_code Pakaging Material WEIght kg
80026020 13984
90225217 21385 1 1 3 Not Applicable 22-paper .001
90218863 16578 1 1 1 Not Applicable 04-low density polyethylene (0.002+.002+.002)=.008
90218349 14507 1 1 1 Not Applicable 05-polypropylene,22-paper (.02+.05) =.07
40221108 21519 3,2,1 1 2 IKEA-CB-60 22-paper (.32+0.3+0.45)=1.07
find table structure
CREATE TABLE TEST_ROW_TO_COL
(
ITEM_CODE VARCHAR2(10 CHAR),
SUPPLIER_CODE VARCHAR2(10 CHAR),
"Consumer Package" NUMBER(2),
[code]...
ans insert statement of sample data
--SQL Statement which produced this data:
-- select * from Test_row_to_col where
item_code in ('80026020','90225217','90218863','90218349','40221108')
[code]...
I am using Oracle 11g
View 1 Replies
View Related
Aug 29, 2013
I have one query in SQL server. I want to convert that query to Oracle. Well i am not that good with writing queries in Oracle. Following is the query in SQL server.
DECLARE @StartYear AS INT = 2010;
DECLARE @EndYear AS INT = 2014;
WITH
years
AS (SELECT YYYY = @StartYear
UNION ALL
SELECT yyyy + 1
FROM years
WHERE yyyy < @EndYear)
[code].......
Which Gives output in following format.
id_datedateYearMonthNumberMonthDayOfMonthDayOfWeekNumberDayOfWeekWorkingDay
201001011/1/201020101January16Friday1
201001021/2/201020101January27Saturday0
201001031/3/201020101January31Sunday0
201001041/4/201020101January42Monday1
201001051/5/201020101January53Tuesday1
View 3 Replies
View Related
May 31, 2011
My company uses Remedy which stores date/time as an integer. I use the following formula to convert it to a readable date:
TO_CHAR(TO_DATE('01/01/1970', 'MM/DD/YYYY HH:MI:SS AM')+ ((createdate - 4*3600)/(60*60*24)),'MM/DD/YYYY HH:MI:SS AM') as Create_Date
I have to use the "4*3600" in order to get the date to show up correctly, but even then the date sometimes comes up wrong. If the date occurs in the morning, then the date shows up as the previous day. I am sure this is probably due to the offset I am adding in the above formula. If I don't add the 4 hour offset, then the date shows up 4 hours off.
View 3 Replies
View Related
Aug 11, 2010
I have coluum value like 00000000399. i need to convert the float like i mentioned
00000000399 should be loaded as 3.99
00000001197 should be loaded as 11.97
00000000003 should be loaded as 0.03
wat option i try to change the value
View 1 Replies
View Related
Nov 6, 2011
is there any licensed version tool available to convert objects from sql server to oracle especially procedures? I have tried with open source tools but that tool didn't convert properly.
View 7 Replies
View Related
Feb 1, 2007
This is my query:
DELETE FROM GR_GUEST WHERE GUEST_NAME='Ambassador Jack Binns bring Patrick Clawson' AND RESERVATION_ID_FK=21635
It gives an ORA-01460 which is "unimplemented or unreasonable conversion requested"Removing the " AND RESERVATION..." gives the same error.
The problem is that GUEST_NAME is a VARCHAR (150) and RESERVATION_ID_FK is an INT so I don't see where any conversion is coming in.I had changed the name a little bit as it used to a (, ) and a : in the GUEST_NAME. I thought that might be causing the issue so I removed them with a REPLACE through an UPDATE query. However, the record still needs to be deleted.
It should be a simple query as it happens on this table all the time, so I don't know why this one is different.
View 3 Replies
View Related
Mar 5, 2008
1075329297.572
This is unix time where 1075329297 is seconds 572 is milliseconds.
first il store this time in oracle database.when i am retrieving it i want this date into yyyy-dd-mm format. Is it possible to do it in oracle.(using convert function) or is there some other way?
View 8 Replies
View Related
Feb 7, 2013
converting a string to date, my string looks like '01022013' '04022013', I tried to_date('01022013', 'dd-mm-yyyy') but couldn't work.
View 6 Replies
View Related
May 14, 2011
I have 2 tables.The column in table A is number and Column in table B is a varchar2 datatype.I have to use the Column of table B as a filter to column of Table A.Below is the example.
create table A(Col1 number);
Inert into A values(1);
Inert into A values(2);
Inert into A values(3);
Inert into A values(4);
Create table B(Col1 Varchar2(100));
Insert into b value ('1,2,3');
Select * from A where col1 in (select col1 from b)
Error: Invalid Number
Is there a way to convert the varchar to number.The varchar field have multiple characters (numbers) seperated by commas.
View 7 Replies
View Related
Dec 19, 2010
I have a problem i need to convert a blob column contains pic file to long row
i had many tries but no one succeeded
-----------------------------------
Source table | destination table
id number | id number
img blob | img long raw
------------------------------------
1 - INSERT INTO destination table SELECT id , img FROM Source table WHERE ROWNUM < 2
i have this error ORA-22835 Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 146092, maximum: 2000)
2 - INSERT INTO destination table SELECT id , dbms_lob.SUBSTR(img,0,2000) FROM Source table WHERE ROWNUM < 2
now errors but the lengh is 0 (i have no file )
What can i Do
View 7 Replies
View Related