SQL & PL/SQL :: Time Interval Group
Mar 28, 2011
IN OUT ROOM
1/20/2011 7:26:00 AM | 3/28/2011 10:34:51 AM | 1
3/23/2011 12:53:00 PM | 3/28/2011 10:34:51 AM | 2
3/14/2011 10:44:00 AM | 3/14/2011 3:05:00 PM | 3
2/24/2011 2:31:00 PM | 2/25/2011 9:02:00 AM | 1
2/22/2011 1:32:00 PM | 2/23/2011 9:56:00 AM | 2
2/22/2011 1:30:00 PM | 2/22/2011 1:32:00 PM | 1
12/9/2010 6:42:00 PM | 12/11/2010 1:38:00 PM | 3
3/8/2011 4:48:00 PM | 3/28/2011 10:34:51 AM | 1
Here I need an out put like below
room 1 2 3 Total
date 7am-12pm 12pm-7pm 7pm-7am 7am-12pm 12pm-7pm 7pm-7am 7am-12pm 12pm-7pm 7pm-7am
01/20/2011 2 3 1 1 3 3 2 4 1
01/21/2011 1 2 2 1 0 0 0 0
...........................................
.......................................
Total
i have to divide into 3 groups and take a count 7am-12pm, 12pm-7pm, 7pm-7am groups
It looks so complicated to me, because IN time and OUT time together how we do it.
suppose one person 6am IN and out 8PM means he will be in 7am-noon , noon to 7pm, 7pm-7am -- 1, 1 1 on 3 interval another scenario is if one person in 2am in the morning it has to be previous days count. Is this possible to do it in query.
View 1 Replies
ADVERTISEMENT
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
Jul 17, 2012
How to set time interval in schedule job i need five minutes interval..
View 5 Replies
View Related
Mar 26, 2011
I'm having trouble using interval data types in a procedure. I need to pass a number of minutes as a parameter, and then use them for arithmetic on a timestamp with time zone. This works no problem:
set serveroutput on
create or replace procedure tstz(mins varchar)
as begin
dbms_output.put_line(systimestamp - interval '10' minute);
end;
[code]...
I've tried a few variations of data type and type casting for the parameter, but I can't make it work.
View 5 Replies
View Related
Apr 27, 2010
how to create a view from table which containes rows from every minutes. In view I want to select only rows at 15 or 30 minutes interval.
eg. my base table has 60 rows for 1 hour. The created view must contain 4 rows on 15 minutes interval basis at the boundary of that interval.
O/P of view should be like this.
Value Time
100 00:00:00
200 00:15:00
300 00:30:00
400 00:45:00
500 01:00:00
View 6 Replies
View Related
Jul 30, 2012
I an using oracle10g in AIX..Can i restrict the shutdown operation within a time intervall....say for eg: "Shutdown immediate" should not be accepted by sqlplus, if it is issued after 10am and before 6:00Pm..
View 2 Replies
View Related
Sep 14, 2011
I have create a mview using a dblink with the refresh difference of every 10min. Suddenly I check the mview refresh date and time it was not getting refreshed automatically at the time interval specified.
drop MATERIALIZED view log on afccv.tbl_voicechat;
drop MATERIALIZED VIEW SMSCHAT.TBL_VOICECHAT_NEW1 ;
CREATE MATERIALIZED VIEW SMSCHAT.TBL_VOICECHAT_NEW1
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
[code]....
I am trying to find out what is the cause of not refreshing and also googled for the same. got some link also either not linked to same problem or not cleared.. Where should i checked regarding the error cause.
View 33 Replies
View Related
Apr 5, 2011
how can we load a Flat file into a Database At Regular Interval Time.
View 2 Replies
View Related
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
Mar 27, 2012
I have been updating data in my database by adding numerous rows and assume the insertion of rows started from 1st date of january month.
I have been entering somehow or the other part of data every day.And now the date is 25th of january.
How can i take a partial backup of my database of the transactions done between 15th of January to 20th of January Month
How to take Backup of a particular date say it be 12th of january month.
How to take backup of first 10 days i.e., 1st-10th of january.
View 7 Replies
View Related
Feb 3, 2011
We have a table with timestamp column and having millions of records.We want to create a materialized view or query, which can give count based
-on some group by columns from table and
-group by on condition (if count > 1000) and
-group by on condition (if timestamp range for that group is > 1hr)
View 4 Replies
View Related
Dec 2, 2008
I have 2 record groups names RG1,RG2 , I attached RG1 record group to LOV1 at design time,I want to change the record group RG1 to RG2 for LOV1 at run time.
View 11 Replies
View Related
Apr 10, 2013
i want to create a lov and record group dynamically at run time. i have the code in when-form-instance..
Declare
v_lov lov;
rg_id recordgroup;
gc_id groupcolumn;
[Code]....
whether i create first a lov and record group at design time or not? if i create a lov and have the recordgroup column then what is the benefit of dynamically lov.?
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
Nov 1, 2013
I'm trying to group sets of data based on time separations between records and then count how many records are in each group.
In the example below, I want to return the count for each group of data, so Group 1=5, Group 2=5 and Group 3=5
SELECT AREA_ID AS "AREA ID",
LOC_ID AS "LOCATION ID",
TEST_DATE AS "DATE",
TEST_TIME AS "TIME"
FROM MON_TEST_MASTER
WHERE AREA_ID =89
AND LOC_ID ='3015'
AND TEST_DATE ='10/19/1994';
[code]....
Group 1 = 8:00:22 to 8:41:22
Group 2 = 11:35:47 to 11:35:47
Group 3 = 15:13:46 to 15:13:46
Keep in mind the times will always change, and sometime go over the one hour mark, but no group will have more then a one hour separation between records.
View 4 Replies
View Related
Jun 23, 2011
I read that rownum is applied after the selection is made and before "order by". So, in order to get the sum of salaries for all employees in all departments with a row number starting from 1, i wrote :
select ROWNUM,department_id,sum(salary) from employees group by department_id
If i remove rownum, it gives the correct output. Why can't rownum be used here ?
View 16 Replies
View Related
May 17, 2011
Refer to the txt file to create table and insert data.
I executed the following query-
SELECT priority, detail, COUNT(1) FROM TEST GROUP BY priority, detail
and got the following result-
PRIORITYDETAIL COUNT(1)
StandardPatch 27
StandardInitial TSS 1
StandardInitial development 10
StandardProduction deployment5
High PriorPatch 1
Now I want that Initial TSS and Initial development should be combined as Initial together and I should get the result as follows:
PRIORITYDETAIL COUNT(1)
StandardPatch 27
StandardInitial 11
StandardProduction deployment5
High PriorPatch 1
View 3 Replies
View Related
Jun 12, 2012
I have a problem, we have some datas in a table for example 7500 rows in a table name called table1 upto 11:am today. but after 11:25 am i have only 5500 rows. in that table.
the table can be accessed by many users here. we dont know when the delete happended in that table. is there any query to find the transaction log of this particular table.
the deletion should be happended between 11:00 am to 11:30 am. but we have retrieved the data using timestamp query. but we need to know when the query issued and by which user the query has been issued.
View 3 Replies
View Related
Oct 13, 2011
I have created a job using DBMS_SCHEDULER and I want it to run every 30 seconds:
begin
dbms_scheduler.create_job(job_name => 'jobu',
job_type => 'PLSQL_BLOCK',
[Code]....
My question is how can I take the value 30 from a configuration table? Let's say I have a query like select value from config_table where property = 'job_interval' that returns the number 30. How can I set this value to be the repeat interval for my job?
View 9 Replies
View Related
Aug 5, 2010
schedule the dbms_job to run every Wednesday in 20min interval. I am using below script but getting error
exec dbms_job.isubmit(44,'ER2.LOAD_CRID2_DATA;',trunc(sysdate),'trunc(SYSDATE,''WEDNESDAY'') + 20/1440),TRUE);
View 5 Replies
View Related
Mar 28, 2013
If a Interval Partitioning can be created on a table for every fortnight ? db version is 11g.
View 3 Replies
View Related
Jan 7, 2013
Interval partitioning I keep getting the below error on a table.A more discerning eye is needed
PARTITION DEC_2012 VALUES LESS THAN (TO_DATE('01-01-2013', 'DD-MM-YYYY')),
*
ERROR at line 26:
ORA-14037: partition bound of partition "DEC_2012" is too high
CREATE TABLE STATISTICS_PART
(
ID_KEY NUMBER(10) NOT NULL,
LUD DATE DEFAULT sysdate,
[code]....
View 5 Replies
View Related
May 28, 2013
I have one page with an interactive report (Page 10) and another with a form to update each entry (Page 20).
The table that these pages refer to have a column called MY_INTERVAL_COL of type INTERVAL DAYS TO SECONDS.
I can successfully display the contents of MY_INTERVAL_COL by extracting DAYS, MINUTES, and SECONDS on Page 10:
TO_CHAR(EXTRACT(DAY FROM MY_INTERVAL_COL)) AS MY_DAYS,
TO_CHAR(EXTRACT(HOUR FROM MY_INTERVAL_COL)) AS MY_HOURS,
TO_CHAR(EXTRACT(MINUTE FROM MY_INTERVAL_COL)) AS MY_MINUTES,
However, the Automated Row Fetch process appears to ignore columns of type INTERVAL DAYS TO SECONDS on Page 20.
:P20_INTERVAL (database column MY_INTERVAL_COL is used)
:P20_DAYS (trying to convert :P20_INTERVAL using TO_CHAR(EXTRACT(DAY...
:P20_HOURS (and so on...)
:P20_MINUTES
Does Automated Row Fetch ignore columns of type INTERVAL DAYS TO SECONDS?
Oracle 11gR2 used. Apex 4.1
View 8 Replies
View Related
Mar 20, 2008
I have a procedure that has a 'INTERVAL YEAR TO MONTH' parameter. What value do I pass to this parameter?
View 1 Replies
View Related
Dec 16, 2010
Other than the obvious to me, where interval partitioning creates partitions as needed. Is there any performance benefit from using interval partitions vs date range partitions.
One draw back for me is that developers do access the partition name in some of their queries, so if I use date range partitioning this will not break their code. I could not find a way to assign a name to a partition when using intervals, is this always system generated or can this be over-ridden.
I am running Oracle 11.1.0.7 soon to be running on 11.2.0.0
View 6 Replies
View Related
Mar 2, 2011
I have this remote database A and database B. DB A has 10 views and DB B has 10 tables. I have to pull out data from views of DB A and load into tables of DB B at regular intervals. How do I do this job?
View 3 Replies
View Related
Dec 12, 2012
We have a table like below.
Create table Item_max
(
CCN varchar2(10),
Run_date date,
Item varchar2(10),
status varchar2(1)
[code].....
Currently we are inserting the cycle data for all Items every day into above table for all the CCN's.Currently there are 100k Items in our DB and gets inserted every day into above table with Different Rundates for all CCN's.
We need the above data for 6months and we would like to purge the data based on the RunDates.
We thought of creating a Partition on CCN and Interval Subpartition on Run_date with Interval of every 1 day but I could get any materials on the net to have List-Interval partitioning in Oracle 11G.
Also List - Range partitioning doesnt work here as the Dynamic partition used(using Maxused) will contain the data for all Run_dates instead of particular rundate.
View 2 Replies
View Related
Sep 19, 2012
I have this requirement to pull the ACTIVE days that a participant holds true in a given month for a specific position he/she holds.The three date ranges here are: LOA dates(leave of absence), XFER dates(TRANSFER in/out of the position),Quality compliance(QUAL start/end dates).So,
INACTIVE DAYS = [(LOA + XFER + WW) - OVERLAPPING DAYS OF (LOA+XFER+QUAL)]
CREATE TABLE PAYEES
(
RUN_PERIOD DATE NOT NULL,
PAYEEID VARCHAR2(20 BYTE) NOT NULL,
LOA_START_DATE DATE,
LOA_END_DATE DATE,
[code]....
I am able to pull out the no of days on a individual basis(count of days for Xfer/LOA/Qual) but I am really not sure as to how should i go about determining the overlapping days between 3 date ranges to determine the ACTIVE/INactive days.
View 4 Replies
View Related
Jul 26, 2011
Let's say I have this table:
create table TEST
(
CF VARCHAR2(16),
START_DATE DATE,
END_DATE DATE
)
with
insert into test (CF, START_DATE, END_DATE)
values ('ME', to_date('01-01-2011', 'dd-mm-yyyy'), to_date('31-12-2010', 'dd-mm-yyyy'));
I need make a select where I get n rows, where n is the number of trimesters that compose the date interval in the table. Each of the returned rows must have as start_date/end_date the boundaries of that trimester.(ALL start dates are the first day of a month, and all end dates are the last day of a month)
In this case I need to get:
ME - 01/01/2010 - 31/03/2010
ME - 01/04/2010 - 30/06/2010
ME - 01/07/2010 - 30/09/2010
ME - 01/10/2010 - 31/12/2010
View 9 Replies
View Related
Jun 8, 2006
When I connect to a Oracle database(remote) using TOAD client, because of the settings of timeout done at the server end(in Oracle), the TOAD session gets time out in 5 minutes.
I want to know how I can increase the timeout interval or if I can keep on pinging the database server so that the TOAD connection does not gets timeout?
PS: When we connect to a unix server using putty, we can keep on pining the server at regular timeout interval by going to Change Settings->Connection->Set KeepAlive
Is there a similar way for TOAD?
View 6 Replies
View Related