SQL & PL/SQL :: Comparing Schemas - Content (data) Identical
Jan 20, 2011
I have two schemas with 149 tables in each schema, what I need to do is to prove that the content(data) between the two schemas is identical. I know that all the table names between the two schemas are the same, just need to prove that there is no difference in data.
So the query needs to prove that Schema A content = Schema B content
I know I cant do a simple select from Schema A.tab1 minus select Schema B.tab1 but since there are 159 tables, I am not sure if this is an efficient way of doing it.
View 14 Replies
ADVERTISEMENT
Oct 11, 2012
I need to export only the data from schemas or tables, how to do that with Oracle Data Pump? when we use schemas parameter this export all schema, not only the data right?
View 7 Replies
View Related
Sep 23, 2011
I have two databases.
one is "ora" it is a 8i version
2nd is "orcl" it is a 11g version
"Oracle" is the my local database. i wrote following program for comparing the row by row data in both the tables.
Q)Is it BEST practice? If not let me know the best practice to compare data in tables?
Q) If am not using the order by clause its giving me wrong output even though both the data tables has same data. WHY?
DECLARE
v_emptest1 EMP_TEST1%ROWTYPE;
v_emptest2 EMP_TEST1@ora%ROWTYPE;
v_suc_flg NUMBER := 0;
v_cnt1 NUMBER:=0;
[code].......
View 9 Replies
View Related
Mar 16, 2010
I want to do a comparision for the missing rows between two diffrent tables
TBL1 and TBL2 both with the same structure but with diffrent data some data is identical. though my data is huge i wanted to make sure the technique i am using
View 8 Replies
View Related
Mar 16, 2009
I need to compare data of .csv file with the SELECT query result or with any table data.
Is there any possibilities in ORACLE to fulfill this requirement?
View 3 Replies
View Related
Oct 16, 2010
adjusting a query. I have a table which looks like this:
CREATE TABLE PF.PF_ANOMALIES
(
ID VARCHAR2(10 BYTE) NOT NULL,
PLAN_ID VARCHAR2(10 BYTE),
CLIENT_ID VARCHAR2(10 BYTE),
SEDOL_CODE VARCHAR2(7 BYTE),
LTY_ID VARCHAR2(10 BYTE),
[Code]....
I have the following query that will return me the anomalies of client transactions (based on joining other tables for extra info too)
SELECT pc.client_id,
pc.client_name,
NVL(pa.sedol_code, 'N/A'),
DECODE(ps.stock_name, NULL,
DECODE(plt.lty_name, NULL, 'N/A', UPPER(plt.lty_name) || ' LEDGER - ' || pa.orig_price_ccy),
[Code]....
-- Get cash anomalies on top as these will have 'N/A' sedols I have another temp table that also gets populated with anomalies:
CREATE GLOBAL TEMPORARY TABLE PF.PF_ANOMALIES_TMP
(
ID VARCHAR2(10 BYTE) NOT NULL,
FVD_TYPE VARCHAR2(10 BYTE) NOT NULL,
CLIENT_ID VARCHAR2(10 BYTE),
SEDOL_CODE VARCHAR2(7 BYTE),
[Code]..
My problem is that I also want my query to return rows from this tmp table too.
View 17 Replies
View Related
Jul 5, 2010
I have a table:
Name
_____
Smith Street
Smith Street
John Street
Ed Street
Ed Street
Ed Street
and need to assign sequence numbers only when the record (Name) changes, e.g. :
Name Seq
_____ ____
Smith Street 1
Smith Street 1
John Street 2
Ed Street 3
Ed Street 3
Ed Street 3
I have experimented with row_number partition but then i just get the sequence returning to 1 when the name value changes.
If I grouped the records by Name I would like to have unique, sequential numbers: 1, 2, 3 but where there is the same name I would like the sequence to stop and the number to replicate?
View 9 Replies
View Related
May 30, 2013
I need to find the identical rows in the below table based on ID column and update the previous identical record's end_date with latest record's start_date-1.
"ID" "NAME" "START_DATE" "END_DATE"
1 "a" 05-MAR-10 31-DEC-99
1 "B" 30-MAY-12 31-DEC-99
1 "C" 30-MAY-13 31-DEC-99
2 "A" 02-APR-10 31-DEC-99
2 "B" 02-APR-10 31-DEC-99
2 "C" 30-MAY-12 31-DEC-99
3 "C" 04-MAR-10 31-DEC-99
Result should be like below format..
"ID" "NAME" "START_DATE" "END_DATE"
1 "a" 05-MAR-10 29-MAY-12
1 "B" 30-MAY-12 29-MAY-13
1 "C" 30-MAY-13 31-DEC-99
2 "A" 02-APR-10 01-APR-10
2 "B" 02-APR-10 29-MAY-12
2 "C" 30-MAY-12 31-DEC-99
3 "C" 04-MAR-10 31-DEC-99
View 7 Replies
View Related
Dec 27, 2010
We have a 2 database identical ( Say DB1 & DB2). In that, one of the database(DB2) base got corrupted. We cant recover back the database due to hard disk problem. So we did a new installation of database and patched to current level.
Now I want make DB2 up and running. So I though of generating a script from DB1 and run it in DB2 to restore back.
View 3 Replies
View Related
Feb 18, 2013
My production database server is cloned for test environnement . I kept the same name of SID for both environnement but on different hosts.
I got error when try to connect to test database : TNS:protocol adapter error.
Below the the TNSNAMES.ORA files:
----- production host ---
HOFL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = asus-sol)(PORT = 1521))
[Code].....
View 10 Replies
View Related
May 2, 2012
I have a requirement to get the count of those records whose department is not changed since they have joined the organization.
Script:
CREATE TABLE ddumps(orgid NUMBER, orgdate DATE, orgdept VARCHAR2(10))
/
INSERT INTO ddumps VALUES(1,'01-JAN-1999','ORG1')
/
INSERT INTO ddumps VALUES(1,'01-JAN-2000','ORG2')
/
INSERT INTO ddumps VALUES(1,'01-JAN-2001','ORG2')
/
INSERT INTO ddumps VALUES(2,'01-JAN-1999','ORG1')
/
INSERT INTO ddumps VALUES(2,'01-JAN-2000','ORG1')
/
INSERT INTO ddumps VALUES(2,'01-JAN-2001','ORG1')
ORGID ORGDATE ORGDEPT
1 1/1/1999 ORG1
1 1/1/2000 ORG2
1 1/1/2001 ORG2
2 1/1/1999 ORG1
2 1/1/2000 ORG1
2 1/1/2001 ORG1
since the orgid 1 has changed the dept from org1 to org2 I do not want this to be appeared in the final count. Results should only include the orgid 2 since it didn't changed any dept.
View 11 Replies
View Related
Jan 8, 2013
Is there any way to run a select command between 2 different schemas without using DB links ?
View 1 Replies
View Related
Feb 2, 2010
One function returns table metadata in xml form. This works for current schema but not for other schemas. Is it a privilege problem?
my code is..
CREATE OR REPLACE FUNCTION TEST.F_DBEG2
RETURN XMLTYPE
AS
Handle NUMBER;
V_OUTPUT_TOTAL XMLTYPE;
V_CNT NUMBER := 0;
BEGIN
[code]....
but when i select the object of another schema, got output.
SELECT * FROM TEST_NEW.DEPT;
Which privilege i need?
View 9 Replies
View Related
Jun 6, 2012
I'm trying to get the Create-Statements of all tables of several schemas:
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name,'<schmema>')
FROM (SELECT TABLE_NAME, OWNER FROM SYS.ALL_TABLES WHERE owner='<schema>') u
Is there a way to create a loop to handle several schemas listed in a array, for example?
View 10 Replies
View Related
Jul 26, 2007
I have 2 strings that I want to compare for example
string1 = 'ABC~AB/10/1234'
string2 = 'ABC~AB/10/1234~.....'
There could be anything after the 2nd ~ in string 2 is there a easy way of trimming string2 to the first 14 Characters? Or do I have to find the 2nd instance of ~ and then remove everything after (and including) that?
View 2 Replies
View Related
Mar 5, 2008
How to select the transactions out of the database that occurred within 70 seconds of each other. The toll_date field is a TIMESTAMP field.
Problem is, I seem to only get transactions that occurred within 70 minutes of each other. On the timestamp field I break the math down into the seconds in a day and I add 70. I then subtract that value and add that value to the timestamp and I should get anything between those values right?
SELECT Acct_ID, Ln, Tag_Rd, COUNT(*)
FROM (
SELECT T1.Account_ID Acct_ID, T1.Tag_Read Tag_Rd, T1.Revenue_Date Rev_Date, T1.Toll_Date, T1.Lane_ID, T1.Plaza, T1.Lane Ln, T2.Toll_Date, T2.Plaza, T2.Lane
FROM Toll T1
JOIN Toll T2
[code]......
View 6 Replies
View Related
Nov 5, 2011
Recently i have started working on PLSQL coding. I have a requirement. Either error or un-processed record count is 90% of to be processed records then the script has to fail. Currently I am having a situation where error count is 1 and total to be processed is also 1.
in the below
V_ERR is error count
V_UPS is un processed count
V_PROCESSED_COUNT is total to be processed.
I am expecting PASS result but it is giving FAIL.
DECLARE
V_ERR NUMBER:=0;
V_UPS NUMBER:=0;
V_PROCESSED_COUNT NUMBER:=0;
NIN NUMBER;
BEGIN
V_PROCESSED_COUNT:=1;
[Code] .......
View 1 Replies
View Related
Sep 30, 2011
a query or function which can be used to see the content of deep down view.
For Example :- create view fist as select * from second;
create view second as select * from third;
create view third as select * from fourth;
....
So my requirement is like dbms_metadata.get_ddl function to see the content of objects? to see the see the content of deep down view..
View 16 Replies
View Related
Apr 13, 2011
As part of our project, we need to perform table comparisons in two different databases. I am currently looking for various options to accomplish this.
One of them is doing minus operation between these two tables. Also, i have looked at the data compare option in toad utility.
View 1 Replies
View Related
Aug 3, 2011
I am working in form 6i, database 9i. I have datablock on table t1.
table t1: name(varchar2), date(varchar2)
datablock: name(varchar2), date(varchar2)[i have insert date with time stamp]
for date column, i am inserting date with time stamp.While querying data, user just enters only date(no time stamp), i should be able to query data. I tried in data block where condition
WHERE: substr(date,1,11)=nvl(:block.date,substr(date,1,11)
i am not able to retrieve data through date, through name it's working fine.how to retrieve data by only entering date (without time stamp)
View 13 Replies
View Related
Feb 10, 2013
Managed to confuse myself significantly. I essentially want to write a query to determine when two counts are the same using a subquery.
Eg:
R(x,y)
Select count(x)
from R
group by x;
Then I want to run another query to determine which x's have the same count value and output these corresponding x's.
View 6 Replies
View Related
Mar 21, 2013
i executed the below code and found that output should be 5 but it shows 7(always else part). it is not comparing string in case.
declare
check_in_date date;
var_day varchar2(11);
rate_id number;
[code]....
View 3 Replies
View Related
Feb 25, 2013
I want to find difference between the objects(tables(columns,constraints), views, sequences) in two schemas. One schema is staging and one is development . In development lot of changes are made , Is there a script or a opensource tool which will bring out the difference in columns, constraints in each table and sequences , views etc.
View 2 Replies
View Related
Nov 25, 2011
I wondered the possibility of converting a content file in the format ansi to utf-8 directly from Oracle.
View 1 Replies
View Related
Oct 29, 2008
I have a SQL query which joins several large tables (so indexes matter here) from Oracle database. In the where condition I use IS NULL with one of the date field values. Query takes 40 sec to run and if I comment this one line...it takes 1 sec to run. This date field is an index on the table and I learn that --
1. IS NOT NULL in where clause uses an index
2. IS NULL in where clause does not use an index
Is there any work around to make the query faster...other than changing all the NULL date values in the table to some string. In other words can I force it to use the index.
View 16 Replies
View Related
Jul 1, 2013
SF at oracle.com/technetwork/issue-archive/o53plsql-083350.html states that you can compare two database tables (of the same structure) by defining a nested table type (using %ROWTYPE) and two NT variables of that type, and loading the contents of each table into its respective NT variable, before comparing them using the = operator. Having read the Oracle documentation which states that you can only compare NTs for equality if they don't contain record types, I was surprised to read this, but figured I would try it because I must be misunderstanding SF, but it didn't work.
SCOTT@ORCL> create table empcopy3 as select * from emp;
Table created.
declare
type emp_ntt is table of emp%rowtype;
emp_nt1 emp_ntt;
[Code]....
But SF goes on to say he timed the execution of his NT equality method, comparing it with a SQL-only equivalent, and so I must be missing something. My understanding is that using %ROWTYPE declares a record type.
View 3 Replies
View Related
May 27, 2011
I have to compare a string entered in a form with a series of English strings in back-end PL/SQL( using LIKE operator )
But it so happens, the string entered in the form is specific to the language used in the country. for ex. in Dutch, it is entered in Dutch language.
So on comparing, it fails as the PL/SQL compares it with English Strings.
View 4 Replies
View Related
Oct 16, 2012
i am fetching one record based on date but not able to fetch the data.
in my table pdate column is there with date datatype and value is in that is:15-OCT-12 so i am fetching empid based on dates.
select empid from masterprocessdailydata where pdate=to_date('15/OCT/12','dd/MM/yy'); but not getting the empid.
View 11 Replies
View Related
Aug 18, 2011
I am trying to compare 2 char columns using trim to avoid space padding
CREATE TABLE TRIAL_A
(ABC CHAR(6));
INSERT ALL
[Code]....
View 11 Replies
View Related
Aug 6, 2010
I have got a table having column a, b , c, d, e and some values are stored in it. e.g. a, c and e have 'Y' and b and d have 'N' value in it.
How can i count with one query , how many columns have 'Y' and how many have 'N'.
cursor is one solution.
View 2 Replies
View Related