SQL & PL/SQL :: Oracle - Compare End-time With The Start-time?
Jun 7, 2010
. I have this query:
select asl1.agentsessionid, asl1.endtime, asl2.starttime, 127 as agentstatus
from
(
select asl1.agentsessionid as sessionid1, min(asl2.agentsessionid) as sessionid2
from cti.agentsessionlog asl1
[code]...
As you can see from my where statement I want to compare the endtime with the startime. This query returns zero results. Is there a way to write the where statement different so I can have results?
View 6 Replies
ADVERTISEMENT
Jun 16, 2013
I Have three field and first field for START TIME ,Second END TIME & Third DURATION AND Putting START TIME AND END TIME i am getting duration in minutes by using code
""SELECT TO_CHAR
(TRUNC (SYSDATE)
+ (TO_DATE (:T_DONATION_END_TIME, 'HH24MI') - TO_DATE (:T_DONATION_START_TIME, 'HH24MI')),
'HH24MI')
INTO :T_DONATION_DURATION
[code].......
View 5 Replies
View Related
Jan 31, 2013
I have a table which stores apointment start times and appointment end times. For the sake of this thread I will call them appt.start_time and appt.end_time. I then have a check in time and a check out time for the customer. The only thing is they ONLY way to distinguish between a check in time and a check out time is which one has the earlier time and which one has the later time. Obviously the earlier time will be the check and the later time will be the check out.
This is fine, however sometimes they may forget to check a person in or out and I need to determine whether the time should be insert into the check_in column or the check_out column. To do this I was thinking of comparing the time with the appointment start and end time and if it was closer to the appointment start time put it into the check_in column and if its closer to the appointment end time put it into the check_out column. But I was wondering how I would go about doing this.
The time I will want to compare against the appointment start and end time I will store in a variable called v_time and have this as part of my query, im just unsure of what way to write the query so as to check if the time is closer to the start or end time.
View 5 Replies
View Related
Jun 30, 2010
Checkout the following code
CREATE TABLE CHK(dt_request_datetime DATE);
INSERT INTO CHK VALUES(TO_DATE('25-JUN-10 04.12.57 AM',
'DD-MON-YY HH:MI:SS AM'));
COMMIT;
[Code].....
TZ_OFFS TZ_OFFS GMT_TIME
------- -------
-04:00 +00:00 25-JUN-10 04.12.57.000000000 AM
EST_TIME
-----------
25-JUN-10 12.12.57.000000000 AM EST
9 am
----
25-JUN-10 09.00.00.000000000 AM EST
8 pm
-----
25-JUN-10 08.00.00.000000000 PM EST
OUTPUT
---------
30-JUN-11
My doubt here is that even though dt_request_datetime is between 9 am in EST timezone and 8 pm in EST timezone the query output is not according to that.
View 2 Replies
View Related
Dec 4, 2009
is it possible to compare two time values in oracle sql ie there is a column say 'tot' with values 8:29,11:35 etc(8hrs29 mins etc) can i compare this column with 03:00hrs i tried select case tot>=3 then 1 as days end from tablename;
View 3 Replies
View Related
Nov 28, 2012
I'm trying to compare a date and time within a certain range.
If the sysdate date/time range falls within the range of the values within the database tables then show a "Yes", otherwise, show a "No". The date works but the time doesn't seem to work. Maybe you can't use a "between" operator for time?
CREATE TABLE REGISTRATION
(
EARLY_REGISTRATION_START_DATE DATE,
EARLY_REGISTRATION_END_DATE DATE,
EARLY_REGISTRATION_START_TIME DATE,
EARLY_REGISTRATION_END_TIME DATE
[code]....
View 5 Replies
View Related
Feb 6, 2013
I need to go on day start and end time for each day. Any function that will go on start and end time according to sysdate for that day.
View 7 Replies
View Related
Jun 25, 2013
Version: 11.2 I am not an SQL expert. I am trying to subtract the start time and end time and thereby find the difference between these two times. In the below example , the difference between start_time and end_time is around 52 minutes (6:15 PM to 7:07 PM)I tried some stuff to find the difference below. But it didn't work out .
SQL> create table t (start_time date, end_time date); Table created. SQL> desc t Name Null? Type ----------------------------------------------------------------- -------- --------------------- START_TIME DATE END_TIME DATE SQL> insert into t values (to_date('24/JUN/2013 18:15:42', 'DD/MON/YYYY HH24:MI:SS'), to_date('24/JUN/2013 19:07:54','DD/MON/YYYY HH24:MI:SS')); 1 row created. SQL> commit; Commit complete. SQL>SQL>SQL> select * from t; START_TIME END_TIME-------------------- --------------------24 Jun 2013 18:15:42
[Code] .......
View 5 Replies
View Related
Mar 28, 2013
formatting the data.I want to group the below table data based on the Grade column for a header_data with start_time and end_time displayed in range. I was trying with group by, partitions etc but no luck. I use version 10gr2.
create table rel_data_mf (header_data varchar2(10),start_time varchar2(100),end_time varchar2(100),grade varchar2(1));
--table rel_data_mf data as comma separated values
header_data,start_time,end_time,Grade
ENG,2013-03-29 00:00:00-05:00,2013-03-29 01:00:00-05:00,U
ENG,2013-03-29 01:00:00-05:00,2013-03-29 02:00:00-05:00,U
[Code]...
--Required output
header_data,start_time,end_time,Grade
ENG,2013-03-29 00:00:00-05:00,2013-03-29 03:00:00-05:00,U
ENG,2013-03-29 03:00:00-05:00,2013-03-29 07:00:00-05:00,A
ENG,2013-03-29 07:00:00-05:00,2013-03-29 10:00:00-05:00,U
MATH,2013-03-29 00:00:00-05:00,2013-03-29 03:00:00-05:00,U
MATH,2013-03-29 03:00:00-05:00,2013-03-29 07:00:00-05:00,B
MATH,2013-03-29 07:00:00-05:00,2013-03-29 13:00:00-05:00,U
View 6 Replies
View Related
Jun 4, 2012
When I try to extract the date tag value from XML data, the time stored in 20120602153021 format i.e., YYYYMMDD24HHMISS format. The following statement extracts only date as 02-JUN-12 however do not extract the time part.
If I try the same in SQLplus with to_date it works however fails in PL/SQL.
XML data:
<?xml version="1.0"?>
<RECORD>
<REGTIMESTAMP>20120601130010</REGTIMESTAMP>
</RECORD>
PL/SQL Extract:
CURSOR c_xml_record
IS
SELECT extract(value(d), '//ACTIVATIONTS/text()').getStringVal() AS REGTIMESTAMP,
FROM t_xml_data x,
[code].......
View 3 Replies
View Related
Jul 25, 2013
how to set interval time every 4hrs in dbms_jobs but starting time 3.00am.
i am set trunc(sysdate)+4/24. but it will take starting at 12.00,4.00,.....in this way..
View 2 Replies
View Related
Dec 27, 2010
I have one inline view query which shows exec\ fetch : 2 sec\ 19 sec It gives 500 rows as final out put, when i give rownum<100 it shows exec\ fetch : 1 sec\ 000 sec, and i cannot use this rownum< 100 alternative as this is inline subquery of big query.
What does this exec and Fetch time is?
How to improve fetch time, (esp with sub-query) ?
View 2 Replies
View Related
Feb 6, 2011
I am comparing the dates in forms 6i.I need to compare the start and end dates and if the date are getting than an year then i need to get an error message.
View 2 Replies
View Related
Sep 23, 2010
My time zone has the offset of 2 hrs during summer and 1 hr during winter.If I want Oracle to tell me what was offset for particular day for example I want to know the offset for February 01, 2010 and August 01, 2010, is it possible?
View 1 Replies
View Related
Jul 4, 2011
I have an application in which time is show as . But, in the table in Oracle it is showing as 13:00. The application is taking the time from OS. OS time is 18:30 IST. Time in SYSDATE is also showing as 18:30. DBTIMEZONE is '+5:30'. what is the problem in Database and how that can be rectified to show the time as same as OS time.
View 4 Replies
View Related
Sep 28, 2010
I have a query. Am using Oracle 10g forms. I want to set idle time for my Forms, i have modified the parameter FORMS_TIMEOUT and HEARTBEAT.
now its working fine . when the idle time reaches , application gets closed with the message "FRM-92101 ".
My question, i want to customize the message , something like
"Idle session time out, Application is going to be closed"
View 1 Replies
View Related
Jul 15, 2011
I found the data in DB with negative time as below
Quote:
1 SELECT
2 c.time
3 FROM partition c
4 WHERE
5* c.time < to_date('0001-01-01','YYYY-MM-DD')
SQL> /
DEACTIVATION_TIME
------------------------------------------------------------------------
17-JUN-08 04.06.22.893 PM
The data type for c.time is Timestamp.
When I use JDBC to retrieve the data and convert it to mill seconds, and it also shows as negative time. My question is the retrieved time doesn't show the negative date, but obvious it is a BC date and earlier than 0001-01-01.
1. How can we detect/show the date to show correctly for the BC date without checking c.time < to_date('0001-01-01','YYYY-MM-DD')? (I am wondering if there is format configuration to show the time like 17-JUN-08 04.06.22.893 PM BC, or something to show the time is negative )
2.how could we fix it negative time to positive ?
View 6 Replies
View Related
Mar 5, 2013
My SQL Response Time is more ttan 100% and keeps on increasing. How can I fix this? The Application users are complaining that the system is very slow.
View 2 Replies
View Related
Apr 24, 2013
How do you Display Response time in HTML? I want to run a PHP script that displays the oracle response time in an HTML table.
View 1 Replies
View Related
Aug 27, 2009
My company use a sybase database that runs business jobs. Currently we run SQL queries from Perl to gather time information on the jobs. Now we have an application that is using Oracle. The server it is on, doesn't have perl, so I am using a shell script to login to sqlplus and run a query for a job and it's end time. I have accomplished this. However, here is the 2 problems I am having.
1. The query reults are returned in Scientific time, I'm able to convert that to EPOCH time in the SQL syntax, however, it comes back with a 13 digit time, instead of 10. The last 3 digits are zero. How can you remove the last 3 digits in the query or convert the 13 digits to Human Time. Right now when you see the select statement, I am doing a to_char to get it to EPOCH time.
2. How to only show the latest time in the query and not show ALL job end times from it's past runs.
Here is my shell script, and I do realize this maybe a select statement syntax solution to one or both, but the UNIX time stamp is puzzling.
#!/usr/bin/sh
sqlplus -S username/password@JAWSPROD <<eof> myfile
set heading off feedback off verify off
select JAWS_APP.JAWSJOB.JOBNAME, to_char(JAWS_APP.JOBRUN.ENDTIME) from JAWS_APP.JAWSJOB, JAWS_APP.JOBRUN where JAWS_APP.JAWSJOB.JOBID = JAWS_APP.JOBRUN.JOBID and JAWS_APP.JAWSJOB.JOBNAME in ('pa_box_settle');
exit
View 1 Replies
View Related
Jan 24, 2013
My oracle database version is 11.2.0.3.0 where i am having one schema in that schema i am having 3 same tables with same structure same data but with different name.
but problem is in first table when i perform select query it takes 5 sec, in another table it is taking 0 sec and in third table it is taking 10 sec.
View 1 Replies
View Related
Aug 13, 2012
I would like to know how to convert the following:
13-AUG-12 03.30.06.146 PM
to the format:
"MM/DD/YYYY HH:MI:SS AM"...
I believe there is a time zone issue here as well, since the should actually be around 11:30am. I am not sure what time zone is being used.
View 2 Replies
View Related
Jun 23, 2011
is there a way to find-out how many GB completed in x time-frame by RMAN on oracle 11.2.0.2.
View 5 Replies
View Related
Dec 11, 2011
how to get java nanotime equivalent in oracle
View 2 Replies
View Related
Feb 6, 2013
able to utilize "RMAN Restore of Backups as Part of a Database Upgrade [ID 790559.1]" and duplicate an 11.1 PRD DB to another server that only has the 11.2 software. When I attempted this, I got an error since the target DB is a earlier version than the rman client - "RMAN-06429: TARGET database is not compatible with this version of RMAN".
I tried to avoid connecting to the target database & just use the following syntax (duplicate 'prd' DBID 123456789 to 'dev') to let rman know about the backups it would need from NetBackup.
That also got an error - RMAN-01009: syntax error: found "single-quoted-string": expecting one of: "database, for, target, to". I tried other variations, but also got errors.
I may try this from a disk based backup, but have to wait to get a large enough NFS mount to be able to complete this. The following syntax was in the 11.2 rman docs:
DUPLICATE DATABASE 'PROD' dbid 8675309 to 'TEST'
UNTIL TIME "to_date('11/01/2007', 'MM/DD/YYYY')"
BACKUP LOCATION '/backups' NOFILENAMECHECK
PFILE='?/dbs/inittest.ora' db_file_name_convert='prod','test';
Our goal is to not have to install the 11.1 software on our new servers. Also, trying to avoid restoring with the same name & then renaming the DB so that ASM would have multiple directories for the DB.
OS: RHEL 6.3 for target host
OS: RHEL 5.9 for target host
Target DB: 11.1.0.7.12 - PRD
Auxiliary DB: 11.2.0.3.5 - DEV
View 5 Replies
View Related
Oct 2, 2012
We have a Oracle 10g database with RAC and Dataguard. When we look at the AWR report, the wait time shown by Oracle for this database is very high.
Service Time : 15.36%
Wait Time : 84.64%
This would imply Oracle is waiting for resources 85% of the time and only processing SQL queries during 15% of its non-idle time. However when we check the OS (RHEL), the iowait is only about 10% and the CPU is 80% idle. This means that that processing horsepower is available.
As such, the results between the OS and Oracle database (AWR report) seems contradictory. OS says we have CPU/IO capacity, however Oracle says we don't.
View 17 Replies
View Related
May 18, 2011
Am installed oracle 9i database and Oracle Developer Suite 10g.Am unable to run the Form. When I run the Application Local machine,Blank White Screen Appears No Error Message.Am installed
1.database in F: and Developer Suite in E :
2.I.E 6.0 and 1.31.1.28 J Initiator Version
Am started oc4j instance started.. in run time edit preferences both [URL] and [URL] are given
3. in formsweb.cfg i changed baseHTMLjinitiator=basejpi.htm
View 4 Replies
View Related
Nov 16, 2011
I am not able to find any information regarding inserting data with timestamp format without putting the date.
This is what i want to do:
ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='DD-MON-RR HH24:MI TZR';
I create the column data type as timestamp with time zone. This is value i have inserted:
Insert Into TEST Values('05-OCT-2013 01:00 +08:00','05-OCT-2013 23:00 +08:00','SCIENCE);
And now i wish to display it in 'HH24:MI TZR' only after i deduct both of the time. This is the view i have created:
Create View TESTRECRDS As Select (STARTTIME- ENDTIME)*24 As DURATION, Science;
But when i select it display as weird timing because it would default in 'DD-MON-RR HH24:MI TZR' format.
BUT IF i create the view and display as 'HH24:MI TZR', it would gives me error:
Create View TESTRECRDS As Select To_Char(STARTTIME- ENDTIME, 'HH24:MI TZR')*24 As DURATION, Science;
Error would be invalid number. How can i display only 'HH24:MI TZR' after subtracting?
View 3 Replies
View Related
Feb 6, 2013
Is there any oracle dictionary view which captures the queries being run by users on the database and time taken to execute those queries?We need to find out the OS user not the database user since we have to identify the users who are executing long running queries.We require this basically to monitor the long running queries on the database.
View 2 Replies
View Related
Nov 28, 2011
How to check the listener time zone settings/values in Oracle 10g database?
View 5 Replies
View Related