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


ADVERTISEMENT

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 :: Joins - Find Missing Records Between Two Tables?

Mar 7, 2010

I have two tables A with columns a.key, a.location_code, a.status and a.first_name and table B with cols b.key, b.location_code, b.status and b.first_name.

I want to find the missing records between the two tables and as well check whether each column is populated correctly. That is if u take a record with id 1 check if loc_code is same in both the tables and if they are different, insert the key and first record column and second record column into a new table. And similarly if there is no record wiht that particular id in the second table, insert the record.

For missing records in the sense for records which are present in A but not in B, am using

Select a.key_no, a.loc_code, b.loc_code
from A,B
where a.key_no=b.key_no(+)
and b.key_no IS NULL

But the problem is I need to put some constraints on the B table like b.status='Married'and b.loc_code='CA'. When am using this condition in the above query, it's throwing me error saying cannot use outer join operator in and or or.And I could not figure out how to check for the columns being populated correctly between the two tables and at the same time check for missing ones

View 5 Replies View Related

SQL & PL/SQL :: Query To Find Missing Dates Between Two Columns In Given Month?

Sep 26, 2012

I need query to find the missing dates between two columns in given month.

CREATE TABLE emp_shift (
empno NUMBER(4),
fr_date DATE,
TO_DATE DATE,
shift VARCHAR2(1));
CREATE TABLE emp (
empno NUMBER(4)
);

[code].....

Required output is

MISSING_DATES EMPNO
---------------------- ----------
09-SEP-12 TO 11-SEP-12 7499
23-SEP-12 TO 26-SEP-12 7499
01-sep-12 TO 30-SEP-12 7521
01-sep-12 TO 30-SEP-12 7788

View 8 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

ODP.NET :: Cannot Find Oracle Data Source In Entity Data Model Wizard

Dec 19, 2012

I'm trying to add edmx file in my project for first time. I want to choose the oracle provider ODP.net but cannot find Oracle in the data source list. I have oracle 11g installed , odp and odt installed and can access it from the solution as well. I saw the Oracle listed under data source when I tried to connect the solution to the database through server explorer. The solution is connected to Oracle database through ODP.

View 8 Replies View Related

SQL & PL/SQL :: Logic To Find Table Names And Data In Oracle?

Feb 1, 2013

I have a schema DEF and I have a column_name CREATE_DATE.

I wanted to write a procedure which will give me list of tables whose CREATE_DATE data is prior to year 2009.

View 5 Replies View Related

Find Data From Select Statement - Oracle 11g After Changing Connection?

Apr 3, 2013

Yesterday only I have Installed Oracle 11G & created DataBase - JafferDB And from Oracle SQL Developer, I have created a connection called - JafferCon and SID also given..and the role is - SYSDBA And I excute the below statement

insert into MyTable1 Values ('AAA1', 'BBB1', 'CCC1')
insert into MyTable1 Values ('AAA2', 'BBB2', 'CCC2')

Then I checked by Select statement, it has shown the values....No Problem.... But, as a test, I deleted the connection and created a new connection tio the same DataBase with different name and when I checked by Select Statement....., it has not shown the values....?

View 2 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 :: 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 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

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

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 :: 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

Server Utilities :: Export / Import From One Oracle DB To Other - Rows Missing?

May 31, 2011

I am new to Oracle DBA. m facing one problem. i imported and exported my data from one oracle DB to another by using exp/imp.....in both exp/imp log files, its shows the fallowing messages at the end.

"Import terminated successfully with warnings."
"Export terminated successfully with warnings."

but when i count there are some rows missing in some tables...

what could be the cause? is there any other way to cross check whether export/import was successful...

View 2 Replies View Related

Server Administration :: Oracle EE 11gR2 On Windows 7 Pro - Oradmin.exe Missing?

Oct 10, 2012

My problem is when trying to use oradmin.exe. It doesn't exists apparently. I have Database Creation Assistant and Net Creation Assistant, I can open and run sqlplux.exe and run sql commands, but oradmin.exe seems to be missing.

This is a new install of Oracle EE 11gR2 on Windows 7 Pro.

View 2 Replies View Related

Oracle Listener Log Entries Missing And Database Not Allowing Connections

Mar 20, 2013

We have a custom portal application that uses a bunch of application servers. Our connection pool max size is 1100. For the past two days, we had two incidents when the cpus reached the max limit and the db was not allowing connections to come thro' for 10 minute periods. The alert log does not have any entry and the listener log does not have any entry for that 10 minute period.

View 5 Replies View Related

Server Administration :: Oracle And Active Directory Services - Missing Binaries

Mar 8, 2012

What two Active Directory services are stopped when you install Active Directory before Oracle 10g? I know the error message for that and I know why it happened but I just need to know the two services so I can start them again. I think it happened because I installed Active Directory first so when I installed Oracle second it stopped two services and I just need to know them. The error message is:

Active Directory is missing binaries, please restart and try again

View 2 Replies View Related

Reports & Discoverer :: Case Statement Inside Oracle Query - Missing Right Parenthesis

Jun 13, 2013

Can I use CASE statement Inside a Oracle Report Query. I'm using Oracle Reports Builder 10g.

My Report Query looks like this,

select invh_code, invh_number, invh_date, invh_cm_code, im_description
from invoice_head, invoice_det, unit_of_measurement, item_master
where invd_invh_code = invh_code and im_code = invd_item_code
AND
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4)) BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)
else 1
end)
order by invh_number

:p_flag is a parameter that i pass from oracle form and based on that value (:p_flag=1) i need to include this specific condition
else omit that condition.

But the CASE statement is throwing Error

ORA-00907 :Missing Right Paranthesis
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4))
==> BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)

View 6 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

PL/SQL :: Find The Duplicate Data In Tables 11g

Feb 19, 2013

i want to find the duplicate data in my tables i have the below structure

SQL> desc x;
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
FILE_CODE                                          NUMBER(20)
STREAMNUMBER                                       VARCHAR2(50)
SERVICEKEY                                         VARCHAR2(50)
CALLINGPARTYNUMBER                                 VARCHAR2(50)
CALLEDPARTYNUMBER                                  VARCHAR2(50)
CHARGEPARTYINDICATOR                               VARCHAR2(50)

[Code] ......

i found the below query it's right

SELECT * x
WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM x
GROUP by FILE_CODE,..........................,SEQ_NO ); all the column

View 7 Replies View Related

Data Dictionary - Find All References Of A Table?

Sep 14, 2011

I wanna to DROP a table called EMPLOYEES, but when I execute the DROP TABLE EMPLOYEES, I get a ERROR saying that I cant do it because this table do reference to another table(s).

I tried to use the DBA_CONS_COLUMNS and DBA_CONSTRAINTS data tables, but its not enough to find it.

How can I find these references?

View 4 Replies View Related

SQL & PL/SQL :: Find All Data Items In Hierarchy Recursion?

Jan 21, 2003

I need to find all "report to" supervisors in a hierarchical chain. A binary search won't work, as each level may contain > 2 supervisors. Example:

1

2 3 4

5 6 7 8 9

10

10 reports to 9
9 reports to 4
5 and 6 report to 2
7 and 8 report to 3
2, 3 and 4 report to 1

Result for all reporting to 1 would be a table containing 2, 3, 4, 5, 6, 7, 8, 9, 10 (order is unimportant!).

I think I need to use recursion. I can do this in C; need code for PL/SQL??? (I can't get the "tree" to display well!)

View 4 Replies View Related

PL/SQL :: Find Common Data In 2 Columns In Two Different Tables

Oct 22, 2012

query to find out common data from 2 columns in two different tables??

View 6 Replies View Related

SQL & PL/SQL :: Find Maximum Iteration In Table And Change Data

Jul 27, 2011

i have inner query result like

Emp status
----- ----------
ram a
ram a
ram b
ram a

i want write a query to find a maximum occurrence of status and update in status column.

result should be

Emp status
----- ----------
ram a
ram a
ram a
ram a

i tried lot of thing but not to go.

View 2 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 :: Query To Find List Of Tables Contains Particular Data In Schema?

Feb 3, 2012

I want to list the tables in a schema which contains a particular value or data.

View 2 Replies View Related







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