SQL & PL/SQL :: Calculate Time - Machine Has Worked Hourly Wise

Apr 16, 2010

I have a table with a date time column which actually stores the data as and when it is inserted. I need to calculate the time the machine has worked hourly wise. For example the table contains records from 13:00 to 13:15 and 13:45 to 14:00 i should get 30 mins as working time..

View 2 Replies


ADVERTISEMENT

Server Administration :: Archive Log Generation Time Interval Or Size Wise?

Oct 21, 2011

i am using oracle 10g on solaris 10 os.currently archived log is generated by size wise 52 mb.i want to know whar is the best practice for archive log generation . it should be time interval or size wise.

View 1 Replies View Related

SQL & PL/SQL :: How To Calculate Time Difference

Aug 10, 2003

I want to calculate time difference b/w two time clocks, just like we calculate the date difference and answer is in days, In the same way i like to have answer in hrs,min and ss.

View 4 Replies View Related

SQL & PL/SQL :: Calculate Outage Time For Each Day

Jul 8, 2010

We have a table which contains the outage data as below,

TAG CI_NAME OUTAGE_START OUTAGE_END
IM10366 FD0004 06-jul-2010 10:00:00 10-jul-2010 10:00:00

so from the above record, the outage is from 6th - 10th July. So for the given TAG & CI_NAME, we have to calculate the outage for day. So the above record should be split as below

TAG CI_NAME O_START O_END TA_PERIOD OUT_HRS
IM10366 FD0004 06-jul-2010 10-jul-2010 06-jul-2010 14HRS
IM10366 FD0004 06-jul-2010 10-jul-2010 07-jul-2010 24HRS
IM10366 FD0004 06-jul-2010 10-jul-2010 08-jul-2010 24HRS
IM10366 FD0004 06-jul-2010 10-jul-2010 09-jul-2010 24HRS
IM10366 FD0004 06-jul-2010 10-jul-2010 10-jul-2010 10HRS

View 1 Replies View Related

SQL & PL/SQL :: Calculate Time Difference Between 2 Date

Nov 29, 2011

during application migration, i got one table from MS Access, and have situation where two events are splited into 4 columns (start: date1 time1 and stop: dat2 and time2). How to properly calculate duration between these two events, and show it in format: hh:mi ?

CREATE TABLE ACCBTP_DCZASTOJ
(ID NUMBER(11,0),
NASTANAK_KVARA DATE,
VRIJ_NASTKVARA DATE,
VRIJEME_OPRAVKE DATE,
DATUM_OPRAVKE DATE);

[Code]....

View 6 Replies View Related

SQL & PL/SQL :: How To Calculate Time Diff Between LAST_ANALYZED Dates

May 27, 2011

Oracle Version = 8.1.7.4

How to change the SQL below to include a calculated datetime diff between two consecutive dates?

I believe I should be using what SQL gurus will call hierarchichal/analytical queries? Any good website/link to learn hierarchical/analytical queries.

select last_analyzed, monitoring
from dba_tables where owner = 'TEST'

LAST_ANALYZED MON
-------------------- ---
24-MAY-2011 18:25:05 YES
24-MAY-2011 19:15:34 YES
24-MAY-2011 22:21:33 YES
24-MAY-2011 23:10:42 YES
24-MAY-2011 23:51:10 YES
25-MAY-2011 01:43:56 YES
25-MAY-2011 02:39:11 YES
25-MAY-2011 03:10:26 YES
25-MAY-2011 04:15:15 YES
25-MAY-2011 04:23:26 YES
28-MAY-2011 03:58:02 YES
28-MAY-2011 03:58:11 YES
28-MAY-2011 03:58:11 YES
28-MAY-2011 03:58:12 YES
28-MAY-2011 03:58:13 YES
28-MAY-2011 04:00:16 YES
28-MAY-2011 04:04:24 YES
28-MAY-2011 04:04:27 YES
28-MAY-2011 04:04:33 YES
28-MAY-2011 04:04:36 YES

View 2 Replies View Related

Forms :: Calculate Difference Time Between Two Fields

Mar 24, 2011

I have two different date in my payroll software,

1-Shift_date shift date *used to contain shift timings
2-Attendace_datedate *used to contain employee IN timings

As you all know that shift is a setup form, where user input data once in the starting of software so the shift_date can be "01/jan/2011 16:00 pm" but attendance loads daily and attendance field data can be in this form "24/mar/2011 16:15 pm"..Now I want to calculate difference time between these two fields therefore I used this statement

SQL> Select to_char(attendance_date,'HH24:MI') to_char(shift_date,'HH24:MI') from dual;

but it is showing error: ORA-01722: invalid number...I used hours/minutes format mask in my query because you can see there is a difference of dates between these fields and it will be increase in the coming future and I need late hours and minutes.

View 2 Replies View Related

SQL & PL/SQL :: Calculate Difference Between Multiple Dates At Same Time?

Jan 10, 2012

how to calculate the difference between multiple dates at the same time..

Select to_date('10/10/2011','mm/dd/yyyy')
- to_date('09/10/2011','mm/dd/yyyy')
- to_date('08/10/2011','mm/dd/yyyy') from dual;

Giving me an error...

ORA 00932 : inconsisten data types:expected DATE Julkian got DATE..

View 8 Replies View Related

SQL & PL/SQL :: Calculate Materialized View Refresh Time

Dec 11, 2012

i want to find out the last refresh elasped time for materialized view. i do not see last refresh elapsed time in data dictionary. i see only last refresh date in data dictionary.

how to find the last refresh elapsed time for materialized view.

View 3 Replies View Related

Hourly AWR Snapshots Are Not Being Generated

Oct 9, 2012

i just noticed on my 11g database - no AWR snapshots are generated.

View 4 Replies View Related

SQL & PL/SQL :: Generating Hourly Report From Oracle Database

Jun 30, 2011

I am working on SQL Developer 1.5.1, i need to prepare hourly record of the activity on the database, for that i have a sql query that gives me the report as per selected columns on hourly basis.I need to prepare 24 reports a day.

Each time i have to go to the query , change the date as per hours like form 22:06:2011 10:00:00 to 22:06:2011 11:00:00 and get the report and export it in excel.

I want to automate the script so that whenever i run the script , it just asks me the date and runs the script 24 times and fetch me the hourly report of whole day.

the query syntax is something like this

Select
............................
...........................
..........................
from
..........................
........................
........................
where
And.......................
And...................
And......................

And req date between to-date( 22:06:2011 10:00:00) And to-date(22:06:2011 11:00:00)
Order by 7,1,2,3,4,5

Is there any possibility that i can automate the script to automatically change the hour itself and generate a report in excel 24 times?

View 6 Replies View Related

PL/SQL :: Extract Data From Table On Hourly Basis?

Oct 23, 2012

I have a table which have two columns date on hourly basis and response time. I want to pull the previous date's data on hourly basis with the corresponding response time. The data will be loaded to the table every midnight.

eg: Today's date 23/10/2012
I want to pull data from 22/10/12 00 to 22/10/12 23

The below query is pulling the date as required but I am not able to pull the response time.

with a as
(select min(trunc(lhour)) as mindate, max(trunc(lhour)) as maxdate from AVG_HR)
SELECT to_char(maxdate + (level/25), 'dd/mm/yyyy hh24') as dates FROM a CONNECT BY LEVEL <= (1)*24 ;

View 4 Replies View Related

SQL & PL/SQL :: Generate Hourly Based Number Of Orders Placed Report

Oct 11, 2011

I have a table called 'orders' and having date and time of order placed in the field timeplaced. I need to generate a report which is having hourly based number of orders placed . If no order is placed in an hour then it should show 0 for that hour in the result .

create table orders (order_id integer, timeplaced date,last_updated date);
Insert into ORDERS
(ORDER_ID,
TIMEPLACED, LAST_UPDATED)
Values
(1, TO_DATE('10/11/2011 12:53:39', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/11/2011 10:53:39', 'MM/DD/YYYY HH24:MI:SS'));
[code]........

But I need the result for all the 24 hours. Actually row for the hour 1,2,3,4,5,6,8,9,13-23 are not present in the DB

TO_CHAR(TIMEPLACED,'HH')COUNT(*)

00
10
20
30
40
50
60
71
80
90
102
111
122
130
140
150
160
170
180
190
200
210
220
230

View 3 Replies View Related

Database Auto Start With Machine On And Shutdown With Machine Shutdown

Sep 2, 2012

i install oracle 10g on linux on perform the following step but my database is not auto start with the machine

Automatic startup and shutdown oracle on linux Oracle database server provides two scripts to configure automatic database startup and shutdown process.

The scripts are,
$ORACLE_HOME/bin/dbstart
$ORACLE_HOME/bin/dbshut

Now let's look at unix level script. When a unix machine boots it runs scripts beginning with Snnname in /etc/rc3.d.

-Here the number nn indicates the order in which these scripts will be run. The name just indicates the function of the script.

In the same way shutdown scripts are named as Knnname which are run from /etc/rc0.d.

If we want that Oracle is the last program that is automatically started, and it is the first to be shutdown then we will name the startup and shutdown scripts on OS like /etc/rc3.d/S99oracle and /etc/rc0.d/K01oracle respectively.

The database script dbstart and dbora will be called from OS script /etc/rc3.d/S99oracle and /etc/rc0.d/K01oracle respectively.

Note that dbstart and dbshut take each SID, in turn, from the /etc/oratab file and startup or shutdown the database.

Automate Startup/Shutdown of Oracle Database on Linux

Step 01: Be sure that oratab file is correct and complete.

Check for oratab file either in /etc/oratab or in /var/opt/oracle/oratab.

Database entries in the oratab file have the following format:

$ORACLE_SID:$ORACLE_HOME:Y
Here Y indicates that the database can be started up and shutdown using dbstart/dbshut script.

If in my database there is two database named arju and arjudup then my oratab file will contain the entry like,
arju:/var/opt/oracle/product/10.2.0/db_1:Y
arjudup:/var/opt/oracle/product/10.2.0/db_1:Y
where /var/opt/oracle/product/10.2.0/db_1 is the $ORACLE_HOME of my database.

Step 02: Create a script to call dbstart and dbshut. In this example I will create one script that will do both startup and shutdown operation. I will name this script as dbora and will be placed in '/etc/init.d'.

a) Login as root.
b) Change directories to /etc/init.d
c) Create a file called dbora and chmod it to 750.

# touch dbora
# chmod 750 dbora
d)Edit the dbora file and make the contents of it like below.

[Code].....

View 1 Replies View Related

Day Wise Count For A Given Year

Jul 2, 2011

In oracle query can i want find out how many day wise count for a year days (for example how may sundays, mondays, tuesdays, wednesdays ,thursdays,fridays,saturdays) in a given year (we can give the start day of the year and the end day of a year).

example
----------
jan sun-5 mon-4 tue-5 wed-5 thu-5 fri-4 sat-5
feb ------------do---------------------------------
like this for all 12 months at a single query.

View 3 Replies View Related

SQL & PL/SQL :: Row Value Show In Column Wise

Mar 1, 2012

I have a table which have three column.

1) empid
2) date
3) status

I want to show the value empid intime outime.

select in1.empid,in1.atttime,out.atttime from (select empid ,atttime from attend
where status=1 and to_char(atttime,'mmyyyy')='022012' order by empid,atttime desc) in1,
(select empid,atttime from attend where status =0 and to_char(atttime,'mmyyyy')='022012'
order by empid,atttime desc) out
where in1.empid=out.empid and in1.empid='02256'
order by in1.atttime,out.atttime

But this query do .one value relation with all column.means first february in time with all out time.

View 1 Replies View Related

SQL & PL/SQL :: Data In Column-wise?

Jul 22, 2013

For one of our requirement, we are asked to provided data in below manner.

Deptno Deptname emp_name_1 hire_date_1 emp_name_2 hire_date_2
10 Sales Raghu 25-Jan-2007 Abbhilash 29-Mar-2009

If a particular department has 10 employees it should have data upto emp_name_10,if department has only 5 employess it should data upto emp_name_5 and so on.I came up with below approach, in this approach I need to create new table to store the data in row wise.

In my actual requirement 4 tables needs to be joined and 2 of the tables are very large.Is there any other approach without creating a new table, something within pl/sql.

drop table emp_dept;
create table emp_dept(deptno number,dept_name varchar2(100),emp_name varchar2(100),hire_date date,seq_cnt number,total_cnt number);
insert into emp_dept

[code]...

View 21 Replies View Related

SQL & PL/SQL :: Query On Range Wise

Jul 26, 2013

I want output like given below. Using EMp table . if sal is <1000 means count of Emp's who are having lessthan 1000 like that.

Deptno sal sal sal sal
<=1000 <=2000 <=3000 <= 5000

10 2 4
20 2.

View 2 Replies View Related

SQL & PL/SQL :: Day Wise Count In A Month

Jul 1, 2011

I want to get the current month day wise count. I dont want Procedure. I need SQL Query only.For example:

July 2011.
Sunday - 5
Monday - 4
Tuesday - 4
Wednesday- 4
Thursday - 4
Friday - 5
Saturday- 5

View 3 Replies View Related

SQL & PL/SQL :: How To Get Month Wise Data

Sep 11, 2012

I have data something like this.

Employee_id date_loggedin

123 09/10/2012
134 09/03/2012
111 09/02/2012
123 08/27/2012
134 08/01/2012
123 07/06/2012
111 05/11/2012
123 07/04/2012
123 07/03/2012
123 03/15/2012
123 01/11/2012

The desired output for input of employee_id=123 and dates between 01/01/2012 and 09/30/2012

Month login_count
JAN_2012 1
FEB_2012 0
MAR_2012 1
APR_2012 0
MAY_2012 0
JUN_2012 0
JUL_2012 3
AUG_2012 1
SEP_2012 1

View 2 Replies View Related

SQL & PL/SQL :: Days Wise Separation

Nov 2, 2010

i want create a report like this

location sysdate refdate No_of_days SL1(0-90) SL2(91-180) SL3(>180)

So when no. of days between (0-90) data put in SL1
And when no. of days between (91-180) data put in sl2

I want to achieve this only in single query.

View 11 Replies View Related

Capture On 10g Schema Wise

Jul 1, 2013

OS : Windows 2003 DB : 10.2.0.4 I am doing capture and replay first time.I want to take 2 captures at a time. 1st capture for 2 schemas and 2nd capture for other schemas.Is it possible?I have searched on internet but didn't get any clue about it..

View 4 Replies View Related

SQL & PL/SQL :: Get The Data On Order By Wise

Nov 15, 2011

i am getting the data like bellow i need the data with out null values

date col1col2col3col4
16-Nov-1123
17-Nov-1112
18-Nov-11321
19-Nov-1123
20-Nov-11132
16-Nov-112321
17-Nov-11112
18-Nov-11211
19-Nov-11132
20-Nov-1112
16-Nov-1145
17-Nov-11465
18-Nov-112123
19-Nov-11132
20-Nov-1165
16-Nov-11456
17-Nov-11546
18-Nov-114656
19-Nov-11566
20-Nov-11564

need out like below

date col1col2col3col4
16-Nov-1123232145456
17-Nov-1112112465546
18-Nov-1132121121234656
19-Nov-1123132132566
20-Nov-111321265564

View 3 Replies View Related

PL/SQL :: How To Display  India As  I  N  D I A In Row Wise

May 26, 2013

how could i display india as i n d i a in rowize in oracle query

output
-----------
i
n
d
i
a

(i am newbiee to this forum ,i dont know on which category i should post this question is there any general category for orcle questions?)

View 5 Replies View Related

PL/SQL :: Month Wise Break

May 4, 2013

I have a requirement as follows :-

The user will submit the start date and end date. Based on the date parameters, the customized procedure should do some calculations month-wise.

For eg : start date - 01-Dec-2012 to end date - 31-Mar-2013

I want the break up as
Start date End date
01-dec-2012 31-dec-2012
01-jan-2013 31-jan-2013
01-feb-2013 28-feb-2013
01-mar-2013 31-mar-2013

How can i achieve this month-wise break ?

View 6 Replies View Related

SQL & PL/SQL :: Month Wise Days For Between Given Dates?

Apr 28, 2010

I have a table with starting date and ending date.

I want to fetch monthwise days for given two dates

IE starting 25/12/2009 ending 25/03/2010

Result should like below.

Dec-09 7
Jan-10 31
Feb-10 28
Mar-10 25

I have tried this but it is not giving me the result which want..

select to_char(thedate,'mon-yy') mnth,count(to_char(thedate,'mon-yy')) days from
(SELECT TRUNC(to_date('25/12/2009','dd/mm/yyyy'),'Y')+ROWNUM-1 THEDATE
FROM ( SELECT 1 just_a_column
FROM dual
CONNECT BY LEVEL <= 366

[code].....

View 3 Replies View Related

SQL & PL/SQL :: Page Wise Display Of Data?

Nov 11, 2010

Web page that retrives data from SQL database and display it to the user in well formatted manner. Data retrieved depend upon criterias selected by the user. But sometimes data retrieved is very large. I want to display records to the user page wise, i.e. 100 records on first page and next 100 records displayed when user clicks next button. This means only 100 records should be retrieved when user first select search criteria, next 100 records retrived when he clicks next button and so on, as to reduce data transferred from server to client. how to achieve this by using single sql query as soon as possible.

View 10 Replies View Related

SQL & PL/SQL :: Financial Year Wise Grouping?

Feb 20, 2012

I need to query by fiscal year wise.

For example

1-Apr-2010 to 31-Mar-2011

View 11 Replies View Related

Reports & Discoverer :: PDF Group Wise?

Aug 11, 2010

Report have one parameter para name depatwhen i go to generate pdf it will ask me which dept if i pick 10 then they generate one pdf if i pick All Dept then they generate again one pdf i need seperate pdf like 10,20,30,40 generate four pdf files

View 8 Replies View Related

SQL & PL/SQL :: Compute Row Wise Multiplication For Each Unique Value Of ID?

Sep 18, 2012

how can i compute row wise multiplication for each unique value of id. I am trying to get the output as showing id and their respective results after multiplying the corresponding values.

CREATE TABLE mult_tbl(
id NUMBER,
val number
);
insert all
into mult_tbl values (1,2)
into mult_tbl values (1,3)

[code]....

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved