SQL & PL/SQL :: How To Find Overlapping Period

Jun 7, 2012

i want to find the data which has the more then one rates available for the given date. Here below i've posted a test table. how can find the products for which, there multiple dates/overlapping period is available through sql statement.

SQL> CREATE TABLE STO.TEMP
2 (
3 ID NUMBER(8),
4 ITEM_ID NUMBER(8),
5 RATE NUMBER(5,2),
6 FROMDATE DATE,
7 TODATE DATE
8 );

[code]....

View 8 Replies


ADVERTISEMENT

SQL & PL/SQL :: Overlapping Date Period

Jun 28, 2012

CREATE TABLE CONTRACT
(
EQT VARCHAR2(10 BYTE),
SUBTYP VARCHAR2(3 BYTE),
FROM_DT DATE,
TO_DT DATE
);

[Code]....

The data in contract and lease table show like below.

contract

EQT SUBTYPFROM TO
ABCD100000DRY1/1/20121/7/2012
ABCD100000DCH1/7/20121/21/2012
ABCD100000GAZ1/21/2012
lease

EQT CONTRACTFROM TO
ABCD100000LS11/2/20121/10/2012
ABCD100000LS21/10/20121/17/2012
ABCD100000LS31/17/2012

Now required output should be

EQT SUBTYP CONTRACTFROM TO
ABCD100000DRY 1/1/20121/2/2012
ABCD100000DRYLS11/2/20121/7/2012
ABCD100000DCHLS11/7/20121/10/2012
ABCD100000DCHLS21/10/20121/17/2012
ABCD100000DCHLS31/17/20121/21/2012
ABCD100000GAZLS31/21/2012

The period for contracts should be in sequential order and should not overlap and if contract does not exist for that date period, then it should return NULL.

View 9 Replies View Related

Server Administration :: Find Maximum Number Of Concurrent Logins Over A Period Of 1 Month

Nov 18, 2011

Need to find out what the maximum number of concurrent logins are over a period of 1 month. We need to do this as we may need to buy more licences.

View 4 Replies View Related

SQL & PL/SQL :: Combining Overlapping Dates

Aug 15, 2012

I have a table with 4 records with start_date and end_date fields

start_date end_date
1/1/2003 1/4/2005
1/1/2004 5/3/2006
1/1/2007 1/4/2008
1/1/2008 6/3/2009

as you see records 1,2 and records 3,4 have overlapping dates. I need to combine them to get continuous intervals. The result should be:

start_date end_date
1/1/2003 5/3/2006
1/1/2007 6/3/2009

Is it possible to do by SQL query?

View 10 Replies View Related

PL/SQL :: Prevent Overlapping Date

Nov 16, 2013

I use Oracle 11.2.0.3.I have APPOINTMENT table:(ID NUMBER PK , FROM_TIME TIMESTAMP , TILL_TIME TIMESTAMP , NOTE VARCHAR2 (200))I want to prevent end users from making an appointment that overlaps with other appointments. I created this trigger: 

Create or replace TRIGGER  "APPOINTMENT_CK"
BEFORE
  INSERT OR UPDATE ON APPOINTMENT  FOR EACH ROW
BEGIN 
IF
[code]....

But, it looks like I cannot use column name here.

View 11 Replies View Related

Forms :: Date Overlapping Check In 10g

Mar 30, 2013

I have two field date from and date to... i want to enter an employee in date range that range should not be enter again.

View 8 Replies View Related

Application Express :: Multiple Overlapping Series In Charts

Oct 11, 2012

whether the overlapping Multiple series charts are possible in Oracle APEX or not .

I am trying to create two graphs for two data sets , one as marker and another as line , but its giving me issues such as

1) X axis is taking all the points of the first series suppose(
1,5,10,180) itsplotting these first . and its then starting labeling
the x-axis for another one which has values like
(20,50,100,1000,15000)

so my X-axis is now ---> 1,5,10,180, 20,50,100,10000,150000

In case i make my marker chart series as the 2nd sequence , then its drawing all the markers on the right side of the chart .

[URL].........

Workspace:- NR_WORKSPACE
Username:-user1
password:- H123$

whether this thing is achievable in oracle apex or not , is there any work around ?

View 0 Replies View Related

SQL & PL/SQL :: How To Calculate Period Date

Sep 14, 2011

Following is the scenario:

CREATE TABLE EMP_VACATION(
EMP_NO NUMBER(3),
VAC_TYPE NUMBER(1),
START_DATE DATE,
END_DATE DATE,
START_PERIOD_DATE DATE,
END_PERIOD_DATE DATE,
PRIMARY KEY (EMP_NO,VAC_TYPE,START_DATE))
[code]....

--How to calculate START_PERIOD_DATE and END_PERIOD_DATE for every time insert reocrd, like for 4 cases?
--I need to check start_date with last period date for same employee.

And based upon calculate START_PERIOD_DATE and END_PERIOD_DATE,,,,,

View 7 Replies View Related

SQL & PL/SQL :: Cross Tab Group By Period?

Apr 27, 2011

I'm trying to write a cross tab query but which groups by periods.

Test Case: -

CREATE TABLE COMPANIES
(
"ID" NUMBER(9,0),
"CODE" NUMBER(8,0),
"DESCRIPTION" VARCHAR2(40 CHAR),
CONSTRAINT "PK_COMPANIES" PRIMARY KEY ("ID")
);

[Code]..

The cross tab is to have columns 1 - 31 which sum the quantity of the article sold. Represnting days of the month.

In addition the description of the company.

I would then like to end up with 3 entries in the results for each company, but these are for summing the quantity of articles by the following periods: -

Breakfast: 01:00 - 10:00
Lunch: 11:00 - 14:00
Dinner: 17:00 - 22:30

I hope that makes sense?

View 13 Replies View Related

SQL & PL/SQL :: Dividing The Time Period Into Weeks

Dec 14, 2011

I need to divide the given time period into weeks from Monday to Sunday .There should not be overlapping of two months, for a week.Every month should start from First day of that month to next Sunday .Same thing can be done by following PL/SQL block . let me know if there is any simple way by using query instead of block .

declare
pid_from_date date := '01-JAN-11';
pid_to_date date := '31-dec-11';
ln_number number := 0;
ld_from_date date;
ld_to_date date;
begin

[Code]....

View 5 Replies View Related

SQL & PL/SQL :: Count Of Rows For Specific Period?

Aug 12, 2010

I need to get the number of rows based on one condition for certain time period. For example, writing a query for 3(any) hrs , i need to get the output as count of rows as hourly basis. Like these:

Date Time Count
12/08/2010 16:00 234
12/08/2010 17:00 345
12/08/2010 18:00 645

View 12 Replies View Related

User Account Will Be Locked In A Period Of One Day After

Sep 16, 2013

"ALTER PROFILE profile_name LIMITPASSWORD_LOCK_TIME 1"means the user account will be locked in a period of one day after FAILED_LOGIN_ATTEMPTS has gone over limit.How to set PASSWORD_LOCK_TIME less or more than one day (like not full days)?

View 2 Replies View Related

SQL & PL/SQL :: Query To Split Period Into Date Ranges?

Apr 10, 2012

I have TableA which has data like below.

ID NAME CRT_DTE
1 AB 03/05/1992
2 EF 15/04/1995
3 CD 20/08/1995
4 GH 01/01/1999
5 UV 08/07/2001

[code]....

I want a query which splits the total time period (from min crt_dte to max crt_dte) into year ranges.For eg, lets say a range of 5 years then I need to get results like below.

start_dte end_dte
---------- ----------
03/05/1992 03/05/1997
03/05/1997 03/05/2002
03/05/2002 03/05/2007
03/05/2007 09/03/2012

how to write this query.

View 6 Replies View Related

Enterprise Manager :: OEM 12c - Compare Period ADDM Non-functional

Apr 17, 2013

In my production environment, I have a mostly working Oracle 12c Cloud Control environment, managing several database instances. On all of the databases, I am unable to use the Compare period ADDM feature ( Instance > Performance > AWR > Compare Period ADDM).

When I select that menu option, I see the message "To be able to use this feature some PL/SQL packages need to be loaded into the target database's monitoring schema, DBSNMP." I have been searching for further information in the specific packages that need to be loaded per the message, but neither Orafaq, [URL] nor Google seem to have those details.

View 5 Replies View Related

IF EXISTS (Select) - Enter Into Table One Period At A Time?

Apr 21, 2011

I am trying to break down a row of data that has nine periods that I want to enter into a table one period at a time. I am trying to use "IF EXISTS ( SELECT * FROM TABLENAME WHERE FIELD1 IS NOT NULL) THEN" through all nine fields. It keeps returning lines that have a null column as well as not null columns. if there is a better way of doing this. Here is an example of what I am trying to do:

IF EXISTS (SELECT * FROM TABLE_NAME WHERE LAST_DT9 IS NOT NULL) THEN
SELECT NUMBER, 1COL9, 2COL9, 3COL9, FIRST_DT9, LAST_DT9, 4COL9
FROM TABLE_NAME;
ELSE IF EXISTS (SELECT * FROM TABLE_NAME WHERE LAST_DT8 IS NOT NULL) THEN

[code]...

View 1 Replies View Related

SQL & PL/SQL :: Select Columns Of 3 Tables In Such A Way That Period Column Should Be In Group By Function

Aug 16, 2011

i want to select columns of 3 tables in such a way that period column should be in the group by function.

create view allocated_budgets_detail as
select ba.ba_fin_year, ba.ba_start_date, ba.ba_end_date, ba.ba_rev_no,
bh.bh_budget_code,
bd.bd_period,
bb.bb_entered_amount
from budget_header bh, budget_allocation ba, budget_distribution bd, budget_balance bb
where bh.bh_budget_id = ba.ba_budget_id
and ba.ba_line_id = bd.bd_budget_line_id
and ba.ba_line_id = bb.bb_budget_line_id
group by bd.bd_period

View 13 Replies View Related

Server Administration :: Overlapping Days Between 3 Date Ranges To Determine Active / Inactive Days

Sep 2, 2011

I have installed Oracle Database 11g.2 by database configuration assistant on windows XP as and adminstrator on my laptop(no connection to network),but when I want to create database I face this warning: error securing database control ,Datatbase control has been brought up in non-secure mode . to secure the database conntrol execute following command....(error is attached).

View 7 Replies View Related

PL/SQL :: SQL To Find Out Changes?

May 17, 2013

I have a table with 50 columns, lets call it Table_A . There is a identical table called Table_B. The data in Table_B gets flushed every night and data from Table_A is moved to Table_B. A new set of data is inserted into Table_A. Now I need to find out which field value is changed and what is changed . A minus command can give the changed records, but how to get the what was prior value for each changed field . Here is what I am looking for

WITH TABLE_A AS  (  SELECT 1 ID, 'JOHN' NAME,  'SALES' DIV FROM DUAL
UNION
        SELECT 2 ID, 'MARRY' NAME,  'ACCOUNTS' DIV FROM DUAL
UNION
        SELECT 3 ID, 'KIM' NAME,  'SERVICE' DIV FROM DUAL),

[code]...

what i want is something that will spit out this (only one record, because there is only one diff record found in the above query.)

ID,     OLD_ID,     NAME,   OLD_NAME ,  DIV ,       OLD_DIV
--      ------      ----    --------    ---         -------
3           3       KIM       KIM       SERVICE     SALESThe above one is for sample purpose, The actual table has 50 fields, and except the ID field, all other field values might change.

View 10 Replies View Related

SQL & PL/SQL :: How To Find Pk1_value

Mar 28, 2011

i need more important to know about this query,below query in where clause i have one condition like 'pk1_value =New_Deliveries.DELIVERY_ID" but in my New_Deliveries table i don't have pk1_value column,how to find that column.

select MAX(DECODE(fndcatusg.format,'H', st.short_text,NULL,st.short_text, NULL))
FROM fnd_attachment_functions fndattfn,
fnd_doc_category_usages fndcatusg,
fnd_documents_vl fnddoc,
fnd_attached_documents fndattdoc,
fnd_documents_short_text st,
fnd_document_categories_tl fl
[code]....

View 3 Replies View Related

SQL & PL/SQL :: Find Inserted Row

May 30, 2012

i m create a table emp . all user of database have privileged to read and write the emp table. now How can identify that which user have insert row in emp file ?

View 4 Replies View Related

SQL & PL/SQL :: Find Last Day Of Given Month?

Sep 25, 2012

I am facing a problem to find the last day of the month which is stored in a variable. i tried the following query which gave me an appropriate answer

select to_char(last_day(sysdate),'DD-MON-YY')from dual

ans : 30-SEP-2012

But I am having only the month in my hand through which I want to find its last day. I cant use sysdate for my query.

View 2 Replies View Related

SQL & PL/SQL :: Best Way To Find Duplicates?

Feb 14, 2012

I have to load 50 Million records in a table. I also need to ensure that no duplicate records enter. Business demand is that It may send 2 Million records today, 1 Million records tomorrow, 3 million records on the next day and so on...

I have loaded 6 Million records into the table, but onwards speed of loading records (with duplicate check) is decreasing.

View 16 Replies View Related

SQL & PL/SQL :: Find Maximum Value In A Row?

Mar 28, 2012

I need to find the maxmimum value in a row, which consists 4 fields.

Columns: field_1, field_2, field_3, field_4

values : 2 , 4, 5, 1

the output should be field_3 =5

View 2 Replies View Related

SQL & PL/SQL :: Find Out Object Name

Feb 16, 2010

I want to find out the name of objects like procedures,functions which are using a specific column of table.

for example i have a table 'Orafaq' which has column 'Iss_Ide', i want to know which objects like procedures,functions,views are using column "Iss_Ide" of table orafaq

View 3 Replies View Related

PL/SQL :: Find No Of Records?

Apr 27, 2013

How to find out the no.of records in a cursor for loop without using counter variable. can i use %rowcount inside for loop?

declare
  cursor dept_cur
  is
    select deptno,dname,loc
    from dept;

[code]...

View 10 Replies View Related

Find Ddl For Any Indexes?

Oct 9, 2012

on 11g R2 on Win 2008

How to find ddl for any indexes built on MY_VW ?

View 6 Replies View Related

How To Find SessionID Of A Job

Jul 25, 2012

how can I find SessionID of Oracle Job? In Oracle 9i Jobs were running under Sessions with SID = 0. This seems to be not the case under Oracle 11g.

View 10 Replies View Related

How To Find Out The Value Of USER_DUMP_DEST

Apr 10, 2013

As titled.

View 15 Replies View Related

How To Find Table Fragmentation

Jul 22, 2011

A query to find the table fragmentation.

View 1 Replies View Related

How To Find Table For Script

Aug 19, 2010

i have table like TWRCHAIN_WS_SUM. it is regularly updated by another object like procedure, function. how can i find which object is updating the particular table across the database.

View 4 Replies View Related







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