PL/SQL :: Closest Date Missing Data

Jul 19, 2012

My requirement is to find the closest date from col B(a.p_date) to the dates in col A(d.p_date). I got the following which works great:

SELECT
d.p_no_s,
d.p_date,
MIN(a.p_date),
MIN(a.p_date)-d.p_date||' Number of Days' NUM_OF_DAYS

[Code]...

Output:

p_no_s p_date MIN(a.p_date) MIN(a.p_date)-d.p
-------------------- ---------- ---------- -------------------------------------------------------

Z1575560 15/06/2008 29/07/2008 44 Number of Days
Z1575560 15/07/2008 29/07/2008 14 Number of Days
Z1575560 21/11/2008 27/12/2008 36 Number of Days
Z1575560 17/12/2008 27/12/2008 10 Number of Days

Problem:

For 1st and 2nd row,

I am getting 29/07/2008 as a.p_date for both 15/06/2008 and 15/07/2008 which is wrong in my scenario. This is because data is missing in the second table for row 1 (similarly for row 3). So What I want is :

Z1575560 15/06/2008
Z1575560 15/07/2008 29/07/2008 14 Number of Days
Z1575560 21/11/2008
Z1575560 17/12/2008 27/12/2008 10 Number of Days

Say for eg: a person is in city A. He is departing on (15/06/2008 ) and arriving on 29/07/2008 and again departing on 15/07/2008 which is not possible.

It should be departing on (15/06/2008 ) and arriving between 15/06/2008 and 15/07/2008 (missing data hence null is required here) and departing on 15/07/2008 and arriving on 29/07/2008 .

let me know how to achieve this.

View 4 Replies


ADVERTISEMENT

PL/SQL :: Get The Closest Max Date

Jun 27, 2012

I have a table named UFM with columns :

trans_ID,Plz_id,clas,trans_date
31106952318303-     005110-2-     6/24/2012 5:56:07.800000 AM
33706952318401-     005110-     2-     6/24/2012 5:56:23.873000 AM
34806952318304-     005110-     2-     6/24/2012 5:56:25.650000 AM
35406952318442-     005110-     2-     6/24/2012 5:59:20.260000 AM

[Code]...

I have another table named facility with columns:

plz_id, Eff_date
005110-     1/10/2012 10:00:00.000000 PM
005110-     1/11/2012 12:00:00.000000 AM
005110-     1/13/2012 12:00:00.000000 PM
005110-     6/24/2012 6:00:00.000000 AM

I want all and records from UFM joining to facility table, i need columns trans_ID,Plz_id,clas,trans_date,Eff_date in my output.

the output should look like ,

trans_ID,Plz_id,clas,trans_date,Eff_date
31106952318303-     005110- 2-     6/24/2012 5:56:07.800000 AM-1/13/2012 12:00:00.000000 PM
33706952318401-     005110-     2-     6/24/2012 5:56:23.873000 AM-1/13/2012 12:00:00.000000 PM
34806952318304-     005110-     2-     6/24/2012 5:56:25.650000 AM-1/13/2012 12:00:00.000000 PM
35406952318442-     005110-     2-     6/24/2012 5:59:20.260000 AM-1/13/2012 12:00:00.000000 PM

[Code]....

for a transaction that occured on 6/24/2012 after 6:00 AM the eff_date should be 6/24/2012 6:00:00.000000 AM and for a transaction before 6:00 AM on 6/24/2012 the eff_date should be 1/13/2012 12:00:00.000000 PM. and the transactions that occured before 1/13/2012 12:00:00.000000 PM the eff_date should be 1/11/2012 12:00:00.000000 AM and so on.

View 4 Replies View Related

SQL & PL/SQL :: Value For Closest Or Equal Date

Aug 23, 2013

I have two tables e.g. test_bb and test_sub

I would like to select test_sub.price as per the below conditions. If test_bb.value_date, test_bb.vehicle matches to test_sub.value_date,test_sub.vehicle then display test_sub.price

If there is no match then as above find the closest test_sub.value_date which is less than test_bb.value_date and select corresponding test_sub.price for the same vehicle combination.

e.g.

select * from test_sub;
VEHICLE VALUE_DAT PRICE
---------- --------- ----------
10 12-APR-12 2
10 08-JAN-10 4
10 14-APR-14 6
10 06-AUG-47 8
20 24-JAN-14 10
20 20-FEB-06 12
20 18-FEB-04 14
20 28-FEB-06 16
20 22-DEC-07 19
8 rows selected.

select * from test_bb;
VEHICLE VALUE_DAT
---------- ---------
10 12-APR-12
10 10-FEB-10
20 24-JAN-14
20 22-FEB-08

Required output:
VEHICLE PRICE VALUE_DAT
---------- ---------- ---------
10 2 12-APR-12
10 4 08-JAN-10
20 10 24-JAN-14
20 19 22-DEC-07

create table test_bb(vehicle number, value_date date);

begin
insert into test_bb values(10,to_date('12-04-2012','dd-mm-yyyy'));
insert into test_bb values(10,to_date('10-02-2010','dd-mm-yyyy'));
insert into test_bb values(20,to_date('24-01-2014','dd-mm-yyyy'));
insert into test_bb values(20,to_date('22-02-2008','dd-mm-yyyy'));
end;
/

create table test_sub(vehicle number, value_date date,price number);

begin
insert into test_sub values(10,to_date('12-04-2012','dd-mm-yyyy'),2);
insert into test_sub values(10,to_date('08-01-2010','dd-mm-yyyy'),4);
insert into test_sub values(10,to_date('14-04-2014','dd-mm-yyyy'),6);
insert into test_sub values(10,to_date('06-08-1947','dd-mm-yyyy'),8);
insert into test_sub values(20,to_date('24-01-2014','dd-mm-yyyy'),10);
insert into test_sub values(20,to_date('20-02-2006','dd-mm-yyyy'),12);
insert into test_sub values(20,to_date('18-02-2004','dd-mm-yyyy'),14);
insert into test_sub values(20,to_date('28-02-2006','dd-mm-yyyy'),16);
insert into test_sub values(20,to_date('22-DEC-2007','dd-mm-yyyy'),19);
end;
/

I could write as below but I would like to know if there is a better way of doing it.

select bb.vehicle
,sub.price
,bb.value_date
from test_bb bb
,test_sub sub
where bb.vehicle=sub.vehicle
[code].........

View 8 Replies View Related

PL/SQL :: Closest Date From A Group Of Dates

Dec 19, 2012

I need to find the closest Date that matches a Particular Date. The Closest Date from the Group may be less than or greater than the Date I am trying to find.

I have two columns: VISIT_DATE and ACTUAL_DATE. The VISIT_DATE columns has many records with different dates while the ACTUAL_DATE column would only have one record per Student ID.

Here is an example of dates:

Visit Date      Actual Date
==========================
01-APR-09     19-MAR-10
16-NOV-09     19-MAR-10
17-MAR-10     19-MAR-10
21-MAR-10     19-MAR-10
04-APR-11     19-MAR-10
15-JUN-11     19-MAR-10
19-SEP-11     19-MAR-10
24-FEB-12     19-MAR-10

The closest date to 19-MAR-10 are in fact 17-MAR-10 and 21-MAR-10. I would in that case need to pick up both records.

View 4 Replies View Related

SQL & PL/SQL :: How To Find Nearest / Closest String For A Column Data

Jun 1, 2011

Quote: I have a table(table name is names) with column as name(varchar) . I have the following data for name column.

Miss
Mississ
Mississipp

I would like to find a nearest match for Mississippi, that means sql should return row that contains Mississipp( Row #3)

If I try to find nearest match for Mississirr then sql should return row that has column value Mississ (Row#2)
Is this possible ? Here is the code for table creation and data.

create table names (name varchar2(20));

insert into names values('Miss');
insert into names values('Mississ');
insert into names values('Mississipp');
commit;

View 2 Replies View Related

SQL & PL/SQL :: How Does Oracle Fill Missing Date Parts

Oct 10, 2010

What happens when I enter date with missing parts ? for example if there is a field of type Date and I inserted the value To_Date ('12/3/2005', 'dd/mm /yyyy') what will the values of the missing date parts be ? hh and mi and ss .so how does Oracle completes the missing parts of the date.

View 6 Replies View Related

PL/SQL :: Selecting Missing Date Range With Previous Records Value

Jun 8, 2012

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - ProductionSET DEFINE OFF;
[code]....

10 rows selected.I want the output like as follows, all those missing date i need to carry on the last one's number

  NBR_OF_S   NBR_OF_C S_DATE
---------- ---------- ---------
        34         40 01-MAY-12
        27         29 01-APR-12
        27         29 01-MAR-12
        21         23 01-FEB-12
        21         23 01-JAN-12
        21         23 01-DEC-11
[code]....
       
The date value I have created for this sample is monthly, based on the condition the data value I may need to generate weekly also. That's Monthly or weekly either one.

View 9 Replies View Related

SQL & PL/SQL :: Find Missing Date For A Year Excluding Saturday And Sunday

Feb 3, 2011

I given the table name,column name,datatype and sample record in the table. I have given the sample record for 01-jan-2008 to 8-Jan-2008, but in the real thing it will be for 30 years.

My Requirement:

For each class_no (202,203..), I need the missing date excluding weekends (sat, sun), I have provided the sample output below.

Table Name : ABC

Column Name : Class_no Data Type : Number
Column Name : Class_DateData Type : Date

Sample Record in the Table :

Class_noClass_Date
202 1-Jan-08
202 2-Jan-08
202 7-Jan-08
202 8-Jan-08
203 1-Jan-08
203 2-Jan-08
203 3-Jan-08
203 7-Jan-08
203 8-Jan-08

OUTPUT:

Class_noClass_Date
202 3-Jan-08
202 4-Jan-08
203 4-Jan-08

View 5 Replies View Related

SQL & PL/SQL :: Selection Of Next Closest Day

May 5, 2011

I am trying to develop an ongoing interview schedule.

interviews may be held on FRIDAY, SATURDAY, TUESDAY or any other day or Days in a every week selected by the user and also at some specific time.

we need to schedule the closest comming day based on Application date.

for example: today is WEDNESDAY and our schedule interview day is FRIDAY and SUNDAY. If one application is received today we need to schedule interview on FRIDAY because this is the nearest/closest day of WEDNESDAY. and if the application is received on Saturday then of course Sunday will be scheduled.

if Application is received on same day e.g. FRIDAY is scheduled and we receive Application on FRIDAY then comes the concept of time. interview is schedules on FRIDAY 11:30 AM.

if application is received on before 11:30AM, the same day will be scheduled. If application is received after 11:30 AM then of course next closest day will be scheduled.

View 1 Replies View Related

SQL & PL/SQL :: How To Find Next Closest Number In Series

Jan 21, 2012

i have a data something like

010030
110495
210960
311425

[code]...

and user enters the figure like 13025now i would like to find the closest next value to the number entered by user, which is 713285 .how can i get this result, i have search a lot on Internet and i found some analytic functions can work out. but don't know how ..

View 14 Replies View Related

SQL & PL/SQL :: Missing Data

Nov 8, 2012

i ahave a table with below

01-oct-12,ARTACT001,Memory
04-oct-12,ARTACT001,Memory
01-oct-12,ARTACT001,OS
05-oct-12,ARTBRIO,CPU

Required output as below which dates are not available my table

02-oct-12,ARTACT001,Memory
03-oct-12,ARTACT001,Memory
01-oct-12,ARTACT001,OS
02-oct-12,ARTACT001,OS

[Code]...

View 5 Replies View Related

PL/SQL :: Oracle Sql To Find Missing Data?

Aug 10, 2012

Database version

Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for HPUX: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production

I have this query

select dept_id,qc_subtype_id,equip_code,drive_id
from
(select distinct dept_id,
decode(qc_subtype_id,

[code]...

View 3 Replies View Related

SQL & PL/SQL :: UTL_SMTP.DATA / Why Body Of Email Is Missing

Jul 23, 2012

I have a procedure called SANDEEP_INC105657, which calls another procedure called "Send_Prodcontrol_Mail_Pr". This procedure should be sending out an email with the following message:

From: <sandeep.tanjore@xxx.xx.ca>
Subject: Remit Advice Slips Report (TR000336).
To: sandeep.tanjore@xxx.xx.ca
Report TR000336 - Remit Advice Slips.

Total number of records that needs slips printed are: 1

However what's happening is we had a database change from 10g to 11g and ever since this has happened the email is sent with "From", "Subject" and "To" but the body(content of the email : Total number of records that needs slips printed are: 1) is missing.The code in Send_prodcontrol_Mail_pr is as follows:

CREATE OR REPLACE PROCEDURE Send_Prodcontrol_Mail_Pr( v_mailhost IN VARCHAR2,
v_sender IN VARCHAR2,
v_recipient IN VARCHAR2,
v_subject IN VARCHAR2,
v_message1 IN VARCHAR2,
v_message2 IN VARCHAR2,
v_message3 IN VARCHAR2)
[code]....

Any reason why the body of the email is missing? I tried the following:

replaced utl_smtp.data(mail_conn,mesg); with utl_smtp.write_data(mail_conn, utl_tcp.CRLF||mesg);

It sends out the email as required but it repeats the "From" two times with no "TO", and "Subject"... however then embeds the whole "from" "to" and the body in an email.

View 4 Replies View Related

Find Missing Data From Parent Table?

Aug 8, 2013

SELECT c.table_name CHILD_TABLE, p.table_name PARENT_TABLE
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND c.table_name = UPPER('ODS_TSAF_MES_PC');

and output is

child table parent table
ODS_TSAF_MES_PC ODS_TSAF_MES_PCTYP
ODS_TSAF_MES_PC ODS_TSAF_MES_PC
ODS_TSAF_MES_PC ODS_TSAF_MES_PCSTAT

i tried

SELECT A.piecestatus from ods_TSAF_MES_PCSTAT A WHERE NOT EXISTS
(SELECT * FROM ODS_TSAF_MES_PC B WHERE B.piecestatus = A.piecestatus);

and i found one piecestatus values is 'I' but i am not getting where it is related to the table and in which row it is getting affected?

View 6 Replies View Related

SQL & PL/SQL :: Data Cleansing - Avoid Null Or Missing Values?

Jul 20, 2010

As data completeness, data consistency, data integrity are some of features of good quality data. What is best approach and best practice to deal with missing or null values in database? I am facing such type of situation. In a main table, there are several columns have null or missing values.

Get rid of null or missing values. Should I consult source documents from where data was fed into database to achieve maximum data completeness?

View 14 Replies View Related

Data Guard :: Redo Archive Logs Missing

Apr 23, 2013

While Configuring Data Guard for ORacle 10g (10.2.0.4) 64 bits on Windows 2007 Server 64 bits.I got few questions

1. What is the Default mode of Standby Database?

2. Should we Always Start Physical Standby Database to Recover Missing Redo Archive Log?

SQL> startup mount;
ORACLE instance started.

Total System Global Area 591396864 bytes
Fixed Size 2067496 bytes
Variable Size 163578840 bytes
Database Buffers 419430400 bytes
Redo Buffers 6320128 bytes
Database mounted.

SQL> alter database recover managed standby database disconnect from session;
Database altered.

3. When there are missing Redo Log Archives e.g.

----On Standby Database--------

SQL> SELECT RESETLOGS_ID,SEQUENCE#,STATUS,ARCHIVED FROM V$ARCHIVED_LOG
2 ORDER BY RESETLOGS_ID,SEQUENCE#;

RESETLOGS_ID SEQUENCE# S ARC
------------ ---------- - ---
812980008 15 A YES
812980008 16 A YES
812980008 17 A YES
812980008 18 A YES
[code]....

65 rows selected. Log 8, 9, 10, 11, 12, 13, 14, 15 are missing.

How to Apply / Recover These Logs on Standby Database?

View 11 Replies View Related

SQL & PL/SQL :: Required Data For Month To Date And Year To Date?

Apr 30, 2012

I want to get data for month to date. For example, If I pass today or any day date as parameter then i should get data for that month(month of passing date) up to passing(parameter) date. As well as i have to get year to date.For example, If I pass today or any day date as parameter then i should get data for that financial year(year of passing date) up to passing(parameter) date. how to get month to date and year to date data.

View 3 Replies View Related

Server Utilities :: Missing Objects During Data Pump Import

May 18, 2011

I did the datapump export and import from one schema to a new schema in the same database. I had to use different tablespace. I used the following parameters in the parfiles :

export parfile
directory
dumpfile
logfile
parallel

import parfile
directory
dumpfile
logfile
parallel
remap_schema
remap_tablespace

Tell me whether I need to use different parameters than the one I used? Can I use both remap_schema and remap_tablespace at a time?

View 1 Replies View Related

Data Guard :: Standby Database Temp Files Go Missing?

Jun 5, 2013

I performed a switchover test of my Exadata databases last night. Both databases are running 11.2.0.2 (BP7) on top of GI of the same version.I'm using Data Guard Broker to administer the Data Guard configuration.

I have, as you'd expect, the standby_file_management set to AUTO, so any file changes/additions/deletions that are made on Primary should be applied to Standby also.And they have been. Until last night.

When I had switched over to running Primary on the Standby site, I got this error message:

Tue Jun 04 22:27:12 2013
Errors in file /u01/app/oracle/diag/rdbms/exdw1pdg/exdw1pdg1/trace/exdw1pdg1_ora_26630.trc:
ORA-25153: Temporary Tablespace is Empty

I checked and my two temp tablespaces existed, but had no files in them. These files are 200Gb and 448Gb in size, so you'd think you'd notice them going missing. This wasn't by any means the first time we switched over (and, yes, I did create temp files for Standby when I built it and first switched over)

We've switched over to Standby multiple times and even ran a whole day's processing against it and haven't seen this. Ultimately, it wasn't a big deal, because I just created a tempfile for each of the tablespaces and off we went.Nothing in MOS seems to mention something like this. Basically, it looks like the switchover process decided to eat my tempfiles but keep my temp tablespace defintion. Odd.

View 5 Replies View Related

Data Guard :: Manual Standby Database Not In Sync With Missing Archivelogs

Feb 12, 2013

OS: Solaris
DB: Oracle 11.2.0.1 EE
Not Using ASM or RAC

I have a Production database that is in archivelog mode and a Standby DR server. Both servers (Prod, Standby) have exact same structure and db name/version.

We manually scp archive logs and recover them to a manual standby database via SQL Scripts "cron". (I.E. set autorecovery on; recover standby database;)

We recently got out of sync with our log files and have not been applying them to the standby. As part of Prod Maintenance, these log files were deleted and are not available anymore.

I've tried several ways to "rebuild" our standby database. I have tried to Shutdown prod, backup all the db files and scp them to standby, re-create standby controlfile and startup mount and recover standby. Every time I try to apply a new archive log via recover standby, these are the errors:

ORA-00279: change 211077622 generated at 1/27/2012 12:18:42 needed for thread 1
ORA-00289: suggestion : /oradump/arch/PROD/PROD_arch_1_69486_736618850.arc
ORA-00280: change 211077622 for thread 1 is in sequence #69486
ORA-00308: cannot open archived log '/oradump/arch/PROD/PROD_arch_1_69486_736618850.arc'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory

Additional information: 3

ORA-10879: error signaled in parallel recovery slave
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/oradevices/PROD/oraPRODsystem1.dbf'

When I check v$log_history, the new logs have not been applied. I've also tried the "Restore from incremental backup via SCN" method with same results. Is there a way to re-create the standby clean and ensure that the log chain that is currently broken gets fixed or reset? I would eventually like to get DataGuard in here, but that's not the case at the moment.

View 5 Replies View Related

SQL & PL/SQL :: Getting Date Gaps From Data Of Date Field

Sep 24, 2011

I have a date field that should be filled everyday with today's date and I need to get the days that were not entered.

i.e. :

CREATE TABLE TRY_F (DAT DATE);

INSERT ALL
INTO TRY_F VALUES (to_date('01/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('02/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('04/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('05/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('06/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('08/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('10/01/2011','DD/MM/YYYY'))
INTO TRY_F VALUES (to_date('14/01/2011','DD/MM/YYYY'))
SELECT * FROM DUAL;

I need a smart way of getting the dates that were missed in DAT.

View 4 Replies View Related

SQL & PL/SQL :: Table Is Missing In User_segments Data Dictionary Table

May 20, 2012

In my database I found some anomalies like

SQL> select SEGMENT_NAME, SEGMENT_TYPE, BLOCKS, EXTENTS, BYTES/1024
2 from user_segments
3 where SEGMENT_TYPE='TABLE'
4 ORDER BY SEGMENT_NAMe;
[code]....

The countries table is missing in user_segments data dictionary view.But I can queries the countries using select statement.

SQL> SELECT * FROM COUNTRIES;

CO COUNTRY_NAME REGION_ID
-- ---------------------------------------- ----------
AR Argentina 2
AU Australia 3
BE Belgium 1
BR Brazil 2
[code]...

why the country table is missing in user_segments data dictionary table.

View 8 Replies View Related

SQL & PL/SQL :: Display Date Ranges In One Column As Separate Date Periods (start And End Date) In Two?

Jun 1, 2010

I'm trying to work out how to take a table like this:

IDDate
12502-Feb-07
12516-Mar-07
12523-May-07
12524-May-07
12525-May-07
33302-Jan-09
33303-Jan-09
33304-Jan-09
33317-Mar-09

And display the data like this:

IDPeriodPeriod StartPeriod End
125102-Feb-0702-Feb-07
125216-Mar-0716-Mar-07
125323-May-0725-May-07
333102-Jan-0904-Jan-09
333217-Mar-0917-Mar-09

As you can see, it's split the entries into date ranges. If there is a 'lone' date, the 'period start' and the 'period end' are the same date.

View 13 Replies View Related

Forms :: Expiry Date To Automatically Show A Date 15 Years After Initial Date

Apr 12, 2010

I have a two date fields in my form; valid from date and expiry date.

Currently my valid from date has an inital value property of $$date$$ which automaitcally brings up todays date.

I need my expiry date to automatically show a date 15 years after this date?

View 8 Replies View Related

Select Data Based On Date

Apr 27, 2010

I have a script which is used to run a job based on the users choice. For example: I have two table, Files and Requests

User select the files to be executed for each request. This data will be stored in Requests table.

Table 1: Files
files
======
file-1
file-2
file-3
..
..
file-n

Table 2: Requests

request file lup_date
==================================
request-1 file1,file2,file3 04-JAN-2009
request-2 file1,file4,file5 06-JAN-2009
request-3 file6,file2 021-JAN-2009
request-4 file1,file2 04-FEB-2009
request-5 file1,file2 08-JAN-2009
request-6 file1,file2 04-MAR-2009
.......... ........... ................
request-n-1 file6,file2,file4 04-DEC-2009
request-n file6,file3,file4 04-DEC-2009

how to get the output in below format. Count how many times each file is selected in a month.

Output format should be like below..
==============================================
File_Name Jan Feb Mar Apr ---------- Dec
==============================================
file1 2 1 3 0 ---------- 2
file2 1 0 2 1 ---------- 3
file-n 8 2 3 0 ---------- 2

View 2 Replies View Related

SQL & PL/SQL :: How To Get Date From The Timestamp Data Type

Oct 13, 2011

How can i get just date from the timestamp data type.

Suppose i have a column timestamp with has data like "2011-05-16 16:19:22.579764-07" when i select from table i just want the date like 2011-05-16.

View 6 Replies View Related

SQL & PL/SQL :: Get Last Updated Date When Data Modified?

Jun 20, 2011

I have multiple project databases where their tables are similar. I wanted to know just a single date from each project databases is modified/updated. If I run a query like select * from component order by eng_proj_id, chg_date desc then it will return many records sorted by their eng_proj_id and chg_date in their descending but I only need just a single record with last update from each project databases.

View 13 Replies View Related

SQL & PL/SQL :: Count Data Within Date Range?

Nov 15, 2010

I need to know the counts(into buckets) for each event_date for a given event_id.

I have 4 buckets that I'm trying to calculate

1. Past (from Today)
2. Today
3. > Today but within 3 days in the future
4. More than 3 days in the future

WITH event_data AS
(SELECT '1' event_id, SYSDATE - 1 event_date
FROM dual
UNION ALL
SELECT '1' event_id, SYSDATE
FROM dual

[code]....

Sample Output:

EVENT_IDPASTTODAYWITHIN_3_DAY_WINDOWOUTSIDE_3_DAY_WINDOW
1 111 1
2 102 0

View 3 Replies View Related

Data Set - Grouping By ITEM NO And DATE?

Jun 14, 2012

Actually I have a table with the following data:
--------------------------------------------------
DATE ITEM NOFEE TYPEAMOUNT
--------------------------------------------------
1/1/20121234561 $0.50
1/1/20121234562 $0.40
1/1/20121234563 $0.30

[code]...

I would like to have a data set like this: grouping by ITEM NO & DATE
----------------------------------------------------------------------
DATE ITEM NO1 2 3 4
----------------------------------------------------------------------
1/1/2012123456$0.50 $0.40 $0.30 $0.20
2/1/20121234567$0.50 $0.40 $0.30 $0.20
3/1/201212345678$0.00 $0.40 $0.30 $0.20

if you see, from the third column in the result set, each fee type becomes different columns.

View 1 Replies View Related

SQL & PL/SQL :: Data To Be Inserted Into Partition Associated Its Own Date?

Feb 11, 2013

I have table and it will contain huge data, so we have implemented as partitioned table. Every day when we load data into table there will be one partition created by the ETL Process by default with the Date Column(day wise). Now we may receive data for the previous days as well(Date column in table will have the date associated to the Data). No i would like the data should be inserted into partition which assocites to its own date.

View 5 Replies View Related







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