Comparing Table between two dbs DBMS_RECTIFIER_DIFF.DIFFERENCES
We have streams replication between two databases db1 & db2 (table level streams replication).
We would like to compare tables between these databases.
we can use DBMS_RECTIFIER_DIFF.DIFFERENCES to find out differences. However what is value to be passed for REFERENCE_SITE & COMPARISON_SITE parameters?
Is it DBLINK or TNSNAMES entry ?
Its the DBLINK.
Similar Messages
-
How to compare data between two tables?
Hi,
My team is trying to develop a SAP data migration tool (DMT) using ABAP.
One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
Any help would be greatly appreciated, thanks!Hi Kian,
Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
Thanks,
Vinay -
Bridge Table between two fact tables
Hello everybody,
From what I have read on the BI Administration tool help and on this forum, bridge tables are used to define many-to-many relations between dimension sand fact tables. Is it possible to have a bridge table defining a many-to-many relation between two fact tables?
Here is my senario:
1. We have a fact table called fact_Orders describing orders for some products.
2. We have a fact table called fact_Sales describing sales og these products.
3. We have a table describing the transformation from order lines to sales lines which is a many-to-many relation, because it is possible to transform an order in more than two steps.
I was thinking of connecting the two fact tables with a bridge table.
If bridge tables are inappropriate for this case, what could be a better model for my senario?
Thanks for your time.Hi,
Well a conformed dimension is a bridge table between two facts, so not sure why you need anything else. If there is a one to many from D1 to F1 and a one to many from D1 to F2 then effectively there is a many to many join from F1 to F2 through the D1 dimension.
Sounds to me like all you need is an order dimension table, rows in the orders fact table will join to this dimension and so will rows in the sales fact table. You can then do calculations like number of sales per order, total sales revenue per order, # of order items per order etc etc.
Regards,
Matt -
Reg: How to automate updation of tables between two oracle DB Instances
Hi All,
I have a requirement to auto update the tables between two oracle database instances. What are the possible solutions to handle this kind of situations.
Please help me out in identifying the correct solution.
Thanks in advance :)The possible solutions are outlined in the distributed database documentation
They are
a) trigger (6.0 and higher)
b) advanced replication. Creates triggers on every table. Requires every table to have a primary key (8.0 and higher)
c) Streams (Uses logminer, has no impact on table. Requires every table to have a primary key, or supplemental logging will be used. (9.0 and higher)
d) Change Data Capture: superset of Streams (9i and higher).
If you don't require realtime updates you don't need c or d. b is difficult to manage. Using a) the source db can potentially have to wait for the target db to complete it's transaction.
Sybrand Bakker
Senior Oracle DBA -
Compare data between two tables of same schema
Folks,
I have one very intresting query which i would like to share with you all and looking forward for the solution asap.
Scenario
I have two table say TableA and TableB, both having same structre say as below
TableA
Col1 Var(10)
Col2 INT
TableB
Col1 Var(10)
Col2 INT
I want to compare data between these two tables and store compared data into third table, let me expalin the whole scenario.
TableA
ColA ColB
INDIA 1
PAKistan 2
TableB
ColA ColB
INDIA 1
PAK 3
I want result like
Difference
ColA ColB
True 0
False -1
I want to store this difference in thrid table.
i.e. when comparing text, i need TRUE when compare 100% else False, Caption is not considered.
When comparing numeric value, simple sub is requried , TableA-TableB
Note - I dont want to use any external tool to compare the table data, i required sql query to do the same.
Thanks
Amit Srivastava
Amit
Please mark as answer if helpful
http://fascinatingsql.wordpress.com/Whereas the abbreviation of countries that exist in Table2 table are the first three letters of the name of the country*, here's a suggestion:
-- code #1 v2
INSERT into [Difference] (Col1, Col2, ACol1, BCol1)
SELECT case when A.Col1 = B.Col1 then 'true' else 'false' end,
(IsNull(A.Col2, 0) - IsNull(B.Col2, 0)), A.Col1, B.Col1
from TableA as A full outer join
TableB as B on (A.Col1 = B.Col1
or Left(A.Col1, 3) = B.Col1);
Is the COLLATE database case insensitive? If not, the code #1 above will have to be modified, using the upper () function or using COLLATE case insensitive in A.Col1 and B.Col1 columns.
But if the abbreviation of the country follow the
ISO 3166-1 alpha-3 standard, will require a fourth table containing the symbol and name of countries.
-- code #2 v2
;with
TableB_2 as (
SELECT case when Len(Col1) = 3
then (SELECT Country_name from [ISO 3166-1 a3] where Cod = Col1)
else Col1 end as Col1, Col2
from TableB
INSERT into [Difference] (Col1, Col2, ACol1, BCol1)
SELECT case when A.Col1 = B.Col1 then 'true' else 'false' end,
(IsNull(A.Col2, 0) - IsNull(B.Col2, 0)), A.Col1, B.Col1
from TableA as A full outer join
TableB_2 as B on A.Col1 = B.Col1;
Structure and data to test:
use tempdb;
CREATE TABLE TableA (Col1 varchar(10), Col2 int);
CREATE TABLE TableB (Col1 varchar(10), Col2 int);
CREATE TABLE [Difference] (Col1 varchar(10), Col2 int, ACol1 varchar(10), BCol1 varchar(10));
INSERT into TableA values ('INDIA', 1), ('PAKistan', 2), ('China', 12);
INSERT into TableB values ('INDIA', 1), ('PAK', 3), ('Bhutan', 3);
go
CREATE TABLE [ISO 3166-1 a3] (Cod char(3) primary key, [Country_name] varchar(30));
INSERT into [ISO 3166-1 a3] values
('IND', 'India'), ('PAK', 'Pakistan'), ('CHN', 'China'), ('BGD', 'Bangladesh'),
('BTN', 'Bhutan'), ('MMR', 'Myanmar'), ('NPL', 'Nepal');
go
(*) If the short form of the country name using the first three letters of the country name,
false positives can occur. For example,
Mali and Malta or
Angola and Anguilla.
José Diz Belo Horizonte, MG - Brasil -
Compare data between two tables
Hey Experts
I am having two tables both are having same structure.
Both r having 210 columns
I want to compare data between these two tables.
I used follwoing query
select * from t1
MINUS
select * from t2but even if thr is diff in 1columns .. i need to search 210 columns which is the exact columns and data
how can i find the exact columns out of these 210 columns ?SShubhangi wrote:
but even if thr is diff in 1columns .. i need to search 210 columns which is the exact columns and data
how can i find the exact columns out of these 210 columns ?This is not a trivial problem to solve. Consider a much simpler data set. In table 1 (four columns) we have
1 A B C
2 D E F
3 A B Dand in In table 2 (four columns) we have
2 X Y Z
3 A B ENow
select * from table1 minus select * from table2gives
1 A B C
2 D E F
3 A B Dwhereas
select * from table2 minus select * from table1gives
2 X Y Z
3 A B ENow clearly the first row in Table1 (ID=1) doesn't match any row in Table2 but it's only two columns out from the last row in Table2 (ID=3). However, the row in Table1 with ID=3 only doesn't match on one column.
So, how do you represent the output?
Clearly what you want can only be achieved if there are some columns which ought to be the same in both tables i.e. key columns. In which case you can use a full outer join link teh two tables, and case statements to display only the values which don't match:
select t1.id as t1_id
, t2.id as t2_id
, case when t1.col1 != t2.col1 then r1.col1 end as t1_col1
, case when t1.col1 != t2.col1 then r1.col1 end as t2_col1
, case when t1.col2 != t2.col2 then r1.col2 end as t1_col2
, case when t1.col2 != t2.col2 then r1.col2 end as t2_col2
, case when t1.col3 != t2.col3 then r1.col3 end as t1_col2
, case when t1.col3 != t2.col4 then r1.col4 end as t2_col2
from table1 t1
full outer join table2 t2
on t1.id = t2.id;Handling nulls is left as an exercise for the reader :)
I agree that typing all this would be extremely tedious for a table with 210 columns, but that's why Nature gave us the ability to generate SQL statements from teh data dictionary.
Cheers, APC -
Compare tables in two schemas for the table with particular column & value
Hello All,
I have a query to find out the list of table from a given schema to extract all the tables having a search column .
ex :
SELECT OWNER, TABLE_NAME, COLUMN_NAME FROM
ALL_TAB_COLUMNS WHERE OWNER='<SCHEMA_NAME>'
AND COLUMN_NAME='<COLUMN_NAME>'
I want to compare two schemas for the same above query .
Can we wirte a query on this - I am using SQL DEVELOPER , which has menu item - TOOL - database differneces to find the diffenence between two schemas but my requirement is to find the differences in two schemas for all the tables matching for a particular column ( as given in quer).
Appreciate your help.
thanks/Kumar
Edited by: kumar73 on 29 Nov, 2012 1:50 PMHi, Kumar,
This is the SQL and PL/SQL forum. If you have a question about SQL Developer, then the SQL Developer is a better place to post it. Mark this thread as "Answered" before starting another thread for the same question.
If SQL Developer has a tool for doing what you want, don't waste your time trying to devise a SQL solution. The SQL Developer way will probably be simpler, more efficient and more reliable.
If you do need to try a SQL solution, then post some sample data (CREATE TABLE and INSERT statements for a table that resembles all_tab_columns; you can call it my_tab_columns) and the results you want from that data. -
Trigger in a join table between two database
Hi an Happy new year
I have two database, one is dedicated to security and the second for my multitenancy application
In this two databases one have tables USER, USER_JOIN_USER_ROLE and USER_ROLE
the second, USER (where fields are differents), USER_JOIN_USER_ROLE and USER_ROLE
the two join table must be the same and USER_ROLE are the same in the two databases.
I plan to use a trigger to replicate from the application database to the security one, I already use triggers to Replicate USER and set the differents fields.
I'm new in triggers using.
My user replication trigger seems like that
CREATE TRIGGER [dbo].[USER_REPLICATION]
ON [dbo].[DM_USER]
AFTER INSERT
AS
BEGIN
DECLARE @EmployeeId int = (SELECT FKEmployee FROM inserted)
DECLARE @Login nvarchar(50) = (SELECT LoginUser FROM Inserted)
DECLARE @Password nvarchar(50) = (SELECT PasswordUser FROM Inserted)
DECLARE @Tenant int = (SELECT IdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
DECLARE @CompanyId int = (SELECT ExtIdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
DECLARE @LegalEntityId int = (SELECT FKLegalEntity FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @LastName nvarchar(255) = (SELECT LastNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @FirstName nvarchar(255) = (SELECT FirstNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @EMail nvarchar(255) = (SELECT EMail FROM inserted)
SET NOCOUNT ON;
INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER(LoginUser, PasswordUser, FKCompany, TenantId, LegalEntityId, LastName, FirstName, Email)
VALUES (@Login, @Password, @CompanyId, @Tenant, @LegalEntityId, @LastName, @FirstName, @EMail)
UPDATE [TEST_MULTI].[dbo].[DM_USER] SET ExtIdUser = (SELECT IdUser FROM [DM_SECURITY_MASTER].[dbo].[DM_USER]
WHERE LoginUser = @Login
AND PasswordUser = @Password
AND FKCompany = @CompanyId
AND TenantId = @Tenant
AND LegalEntityId = @LegalEntityId
AND LastName = @LastName
AND FirstName = @FirstName
AND EMail = @EMail)
WHERE IdUser = (SELECT IdUser FROM Inserted)
END
but I cannot figure how to use a trigger to update a collection and not find anything on it, any help welcome
I use Windows Identity Foundation in my code and update or insert can set multiple rowsHello and thanks for help.
The trigger i give as example already works fine but Fanny Liu is for sure better than mine and I will try it. Users insertions are not multiple, only one user can be inserted at the same time
My question was most on using triggers to update a collection via a Join table between my user and users roles
I wrote it Yesterday for INSERT
USE [TEST_MULTI]
GO
/****** Object: Trigger [dbo].[USER_ROLE_INSERT_REPLICATION] Script Date: 01/03/2014 10:56:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: 2014/02/01
-- Description: Replication INSERT on MASTER DATABASE
-- =============================================
ALTER TRIGGER [dbo].[USER_ROLE_INSERT_REPLICATION]
ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
AFTER INSERT
AS
DECLARE InsertCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM inserted)
DECLARE @UserId int, @UserRoleId int
OPEN InsertCursor
FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
IF NOT EXISTS(SELECT * FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId
AND FKUserRole = @UserRoleId)
INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE (FKUser, FKUserRole) VALUES (@UserMasterId, @UserRoleId)
FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
END
CLOSE InsertCursor;
DEALLOCATE InsertCursor;
And for DELETE
USE [TEST_MULTI]
GO
/****** Object: Trigger [dbo].[USER_ROLE_DELETE_REPLICATION] Script Date: 01/03/2014 10:57:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: 2014/02/01
-- Description: Replicate DELETE on MASTER DATABASE
-- =============================================
ALTER TRIGGER [dbo].[USER_ROLE_DELETE_REPLICATION]
ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
AFTER DELETE
AS
DECLARE DeleteCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM deleted)
DECLARE @UserId int, @UserRoleId int
OPEN DeleteCursor
FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
DELETE FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId AND FKUserRole = @UserRoleId
FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
END
CLOSE DeleteCursor;
DEALLOCATE DeleteCursor;
It works fine
Thanks for help, I will mark it as answered -
Add new row in table between two rows - OATableBean
Hi,
I have a requirement where I need to add a new row between two rows. Lets say I have a table with 5 rows. I am envisioning having an icon (table switcher) on the row #1, which when clicked will insert/create a new row between rows #1 and #2 like #1.5, something that can be achieved in core forms. In core forms, when we click the add button, it immediately creates a new row before the current row ( and pushes other rows down). Is that possible with OATableBean. Please let me know if you have any ideas.
Thanks,
Ravi.Hi,
I used following code to insert the row in the end
public void createNewRow()
XXEGASRLinesVOImpl vo =getXXEGASRLinesVO1();
Row row1 ;
int i;
Row row[] = vo.getAllRowsInRange();
row1 = vo.createRow(); //vo.createRowSet("10");
vo.insertRowAtRangeIndex(row.length,row1);//.insertRow();
row1.setNewRowState(Row.STATUS_INITIALIZED);
Check if it works for you, you have to modify it to meet your requirement.
Regards,
Reetesh Sharma -
{SOL}Problem in Export/Import a simple table between two diff. characterset
Hi ,
I have created a simple table on SCOTT schema....
SQL> CREATE TABLE TEST(A NUMBER(1) , B VARCHAR2(10));
Table created
SQL> INSERT INTO TEST VALUES(1 , 'TEST_TEST');
1 row inserted
SQL> COMMIT;
Commit complete
SQL> INSERT INTO TEST VALUES(2 , 'ΤΕΣΤ_ΤΕΣΤ'); <------------greek chars
1 row inserted
SQL> COMMIT;
Commit complete
The nls_parameters:
SQL> SELECT * FROM NLS_INSTANCE_PARAMETERS;
PARAMETER VALUE
NLS_LANGUAGE GREEK
NLS_TERRITORY GREECE
NLS_SORT
NLS_DATE_LANGUAGE
NLS_DATE_FORMAT
NLS_CURRENCY
NLS_NUMERIC_CHARACTERS
NLS_ISO_CURRENCY
NLS_CALENDAR
NLS_TIME_FORMAT
NLS_TIMESTAMP_FORMAT
NLS_TIME_TZ_FORMAT
NLS_TIMESTAMP_TZ_FORMAT
NLS_DUAL_CURRENCY
NLS_COMP
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected
SQL> SELECT * FROM NLS_SESSION_PARAMETERS;
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected
and db characterset is EL8MSWIN1253
I export such as(following generally the instuctions found on Note:227332.1-Metalink):
C:\Documents and Settings\s_k>SET ORACLE_SID=EPESY
C:\Documents and Settings\s_k>SET NLS_LANG=GREEK_GREECE.EL8MSWIN1253
C:\Documents and Settings\s_k>C:\oracle\product\10.2.0\database10g\BIN\exp SYSTE
M/passwd@EPESY FILE=C:\TEST.DMP TABLES=(SCOTT.TEST) ROWS=Y LOG=C:\TEST2.TXT
Export: Release 10.2.0.1.0 - Production on ╩Ϋ± ╔ΎΫΊ 22 12:28:58 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
╕ήώΊί ≤²Ίϊί≤ύ ≤ί: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
╟ ίΌάή∙ή▐ ▌ήώΊί ≤ΪΎ ≤ίΪ ≈ά±άΆΪ▐±∙Ί EL8MSWIN1253 Άάώ ≤ΪΎ ≤ίΪ ≈ά±άΆΪ▐±∙Ί NCHAR AL1
6UTF16
╨±ΎίΪΎώΉά≤▀ά ήώά ίΌάή∙ή▐ Ϊ∙Ί Ώ±Ύ≤ϊώΎ±ώ≤Ή▌Ί∙Ί ΏώΊ▄Ά∙Ί Ή▌≤∙ ╙ΫΉέάΪώΆ▐≥ ─ώάϊ±ΎΉ▐≥ .
╧ Ϊ±▌≈∙Ί ≈±▐≤Ϊύ≥ ▄ΈΈάΌί ≤ί SCOTT
. . ίΌάή∙ή▐ ΪΎΫ Ώ▀ΊάΆά TEST 2 ή±άΉΉ▌≥ ίΌ▐≈ϋύ≤
άΊ
╟ ίΌάή∙ή▐ ΪίΈί▀∙≤ί ίΏώΪΫ≈■≥ ≈∙±▀≥ Ώ±ΎίώϊΎΏΎ▀ύ≤ύ.Then , i shutdown this database and i start the other.....
with this nls_parameters
SQL> select * from nls_session_parameters;
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS CHAR
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected
SQL>
SQL> select * from nls_instance_parameters;
PARAMETER VALUE
NLS_LANGUAGE GREEK
NLS_TERRITORY GREECE
NLS_SORT
NLS_DATE_LANGUAGE
NLS_DATE_FORMAT
NLS_CURRENCY
NLS_NUMERIC_CHARACTERS
NLS_ISO_CURRENCY
NLS_CALENDAR
NLS_TIME_FORMAT
NLS_TIMESTAMP_FORMAT
NLS_TIME_TZ_FORMAT
NLS_TIMESTAMP_TZ_FORMAT
NLS_DUAL_CURRENCY
NLS_COMP
NLS_LENGTH_SEMANTICS CHAR
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected
with this db characterset: UTF8
C:\Documents and Settings\s_k>SET NLS_LANG=GREEK_GREECE.EL8MSWIN1253
C:\Documents and Settings\s_k>C:\oracle\product\10.2.0\database10g\BIN\imp syste
m/passwd@info FROMUSER=SCOTT TOUSER=SCOTT FILE=C:\TEST.DMP LOG=C:\TEST0_IMP.TXT
Import: Release 10.2.0.1.0 - Production on ╩Ϋ± ╔ΎΫΊ 22 12:40:16 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
╕ήώΊί ≤²Ίϊί≤ύ ≤ί: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
┴±≈ί▀Ύ ίΌάή∙ή▐≥ ϊύΉώΎΫ±ή▐ϋύΆί άΏⁿ EXPORT:V10.02.01 Ή▌≤∙ ≤ΫΉέάΪώΆ▐≥ ϊώάϊ±ΎΉ▐≥
ίώ≤άή∙ή▐ ▌ήώΊί ≤ί ≤ίΪ ≈ά±άΆΪ▐±∙Ί EL8MSWIN1253 Άάώ ≤ίΪ ≈ά±άΆΪ▐±∙Ί NCHAR UTF8
server ίώ≤άή∙ή▐≥ ≈±ύ≤ώΉΎΏΎώί▀ ≤ίΪ ≈ά±άΆΪ▐±∙Ί UTF8 (ϊΫΊάΪ▐ ΉίΪάΪ±ΎΏ▐ ≤ίΪ ≈ά±άΆΪ▐±
∙Ί)
server ίΌάή∙ή▐≥ ≈±ύ≤ώΉΎΏΎώί▀ ≤ίΪ ≈ά±άΆΪ▐±∙Ί NCHAR AL16UTF16 (ϊΫΊάΪ▐ ΉίΪάΪ±ΎΏ▐ ≤ί
Ϊ ≈ά±άΆΪ▐±∙Ί nchar)
. ίώ≤άή∙ή▐ Ϊ∙Ί άΊΪώΆίώΉ▌Ί∙Ί ΪΎΫ SCOTT ≤ΪΎ SCOTT
. . ίώ≤άή∙ή▐ ΪΎΫ Ώ▀ΊάΆά "TEST" 2 ή±άΉΉ▌≥ ίώ≤▐≈ϋ
ύ≤άΊ
╟ ίώ≤άή∙ή▐ ΪίΈί▀∙≤ί ίΏώΪΫ≈■≥ ≈∙±▀≥ Ώ±ΎίώϊΎΏΎ▀ύ≤ύ.
C:\Documents and Settings\s_k>SQLPLUS SCOTT/TIGER
SQL*Plus: Release 10.2.0.1.0 - Production on ╩Ϋ± ╔ΎΫΊ 22 12:41:20 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
╙²Ίϊί≤ύ ≤ί:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT * FROM TEST;
A B
1 TEST_TEST
2 ????_????What may be the cause.....????
Note: I use db 10g v.2 on Windows XP platform.. and the two db instances reside on the same machine....
Thanks...
Sim"Generally speaking the value of the NLS_LANG registry key or environment variable needs to be equal to the characterset of the database."
Yes...that's why i have set the NLS_LANG env.variable to GREEK_GREECE.EL8MSWIN1253 ..equal to:
SQL> select * from nls_database_parameters;
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET EL8MSWIN1253
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.1.0"nls_language doesn't come into play, nor nls_instance_parameters."
Yes...it's true.
"So, in the dump you posted, no one can tell whether those characters were INSERTed correctly at all. Your NLS_LANG *registry key* may have been set to an incorrect value (it defaults to American_America.MSWIN1252)."
Actually , i have used a third-party tool PL/SQL Developer (which does have the OracleDB10g as default home).
Looking at the Windows registry of OracleDB10g the NLS_LANG is equal to GREEK_GREECE.EL8MSWIN1253.
"Thirdly, as I implied above the NLS_LANG on import should have been American_America.UTF8."
According to the Note 227332.1 , if the db characterset of the two dbs are not the same.. then it is preferable the conversion should be done on the import process and not the export....
So, in an example described there -export from a AMERICAN_AMERICA.WE8MSWIN1252 db and import on UTF8 db - (seems exactly the same as mine) the import is done as such:
c:\>set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
c:\>imp ....
The conversion to UTF8 is done while inserting the data
in the UTF8 database.Additional notes....
I have used many different patterns doing the import......
1) Use of AMERICAN_AMERICA.UTF8
2) Use of GREEK_GREECE.EL8ISO8859P7
3) Use the appropriate NLS_LANG that corresponds to the display of chcp command....
All tries display some '?' chars.....
Anyway... I 'll continue reading ... and testing
Thanks... a lot for your points
Sim -
How to compare dates between two items
Hello all,
I am trying to compare dates in two items.
The first item is a computation P45_PAGE_LOADED_TIME
select sysdate from dual;
This essentially keeps track of when the user opened the form. They are accessing data that may become obsolete while they are in the form.
So we have a dynamic action that finds the last_update date from a table. This field is of type date. It is placed in a text field called P45_STATUS.
We then have a notification which we want to fire when P45_PAGE_LOADED_TIME is before P45_STATUS. We tried the following condition
declare
least_date date;
begin
SELECT LEAST(TO_DATE(:P45_STATUS),TO_DATE(:P45_PAGE_LOADED_TIME)) into least_date
from dual;
if least_date = to_date(:P45_STATUS) then
return false;
else
return true;
end if;
end;
Any guidance would be most appreciated.
ThanksMaybe your better off putting your anonymous block into a plsql function.
A function that you can test. If it works in plsql then you must call it in APEX.
I kinda get a headache when I see that least, to_date, to_date query (although I've seen worse :p)
Make it like:
create or replace function fun_least_date(in_status in varchar2,
in_page_loaded_time varchar2) return boolean
is
l_status date;
l_page_loaded_time date;
least_date date;
l_return boolean;
begin
l_status := to_date(in_status, 'FORMAT MASK!!!');
l_page_loaded_time := to_date(in_page_loaded_time, 'FORMAT MASK!!!!');
least_date := least(l_status, l_page_loaded_time);
if least_date = l_status then
l_return := false;
else
l_return := true;
end if;
return l_return
end fun_least_date;If your sure that your function is correct then use it as a condition for your dynamic action.
Regards
Nico
ps: I haven't tested that function. Be aware that you most correctly enter the format mask you use in APEX. Also before APEX may know about these variables you should set a dynamic action on your items to always submit their value to the server when they change!!! -
Copy single table between two servers
Hi... I perform a remote copy (SCC9) yesterday, a few months i did another copy and exclude some tables, in the expert setting, now in my copy, we need a table that was excluded in the last copy (yesterday).
Do you know how to copy that table??
Thanks in advance..Hi
Check this out
[Link1|http://sapbasis-security.blogspot.com/2008/04/copying-tables-entries-between-two.html]
[Link2|http://books.google.co.in/books?id=ASekwAiAXdMC&pg=PA426&lpg=PA426&dq=howtoCopysingletablebetweentwoserversin+sap&source=bl&ots=BS7d2sSz4C&sig=9QWwA7Mlg_7Q6tj_lS4lcMqZz4k&hl=en&ei=T1xVSuTyK6bU6gPh6oXCDw&sa=X&oi=book_result&ct=result&resnum=1]
Regards
Uday -
How can I get the difference of tables between two oracle server?
We team have 2 oracle servers in the same version.
one is develop server and the other is priduct server.
I want to know what is difference in tables define between the two oracle servers.
give me a method or a step or a sql script or a tool to compare these two set of tables.
Edited by: Oracle-Sunmeng on Aug 1, 2012 6:36 PMHi Sunmeng,
Does Database Link exists between Databases ??
If I am Clear, Are you looking Something like this.
To Identify the tables difference, you can query the USER_TAB_COLUMNS view.
SELECT DISTINCT table_name, 'User1' AS user_table
FROM user_tab_columns
UNION ALL
SELECT DISTINCT table_name, 'User2' AS user_table
FROM user_tab_columns@dblink
ORDER BY 1;Which gets us all the Tables available in Both User. where you can filter based on what
you require.
Similary, you for column difference
SELECT table_name, column_name, 'User1' AS user_table
FROM user_tab_columns
UNION ALL
SELECT table_name, column_name, 'User2' AS user_table
FROM user_tab_columns@dblink
ORDER BY 1;If you need to count the no of columns in both Tables of different databases. Then try this,
SELECT table_name, 'User1' user_name,
(SELECT MAX (column_id)
FROM user_tab_columns a
WHERE a.table_name = b.table_name) colno
FROM user_tables b
UNION ALL
SELECT table_name, 'User2' user_name,
(SELECT MAX (column_id)
FROM user_tab_columns@dblink a
WHERE a.table_name = b.table_name) colno
FROM user_tables@dblink b;And, what the Columns in both tables may be same but, if datatype and length of column differs ?????
Thanks,
Shankar
Edited by: Shankar Viji on Aug 1, 2012 10:47 PM
Edited by: Shankar Viji on Aug 1, 2012 10:49 PM -
Comparing Data between two tables with different structure
Hi,
I have 2 tables T1 and T2. Both tables have different structure. I have to check for rows missing in T1 which exist in T2 and vice-versa. I can do that using MINUS operator. But the part where the data exists in both T1 and T2, I have to compare some columns (9 columns the names of this column coming from a meta-data table) if they have same values. If not an exception has to be generated.
Any help is appreciated.
ThanksHi,
Whenever you need help on this forum, post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data (4) Your best attempt so far
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
Formatted tabular output is okay for (3). Type before and after the tabular text, to preserve spacing.
What do you mean by "an exception has to be generated"?
Do you want to raise an error?
Do you want something to appear in the result set?
MINUS finds rows that are in one result set, but not in another.
INTERSECT finds rows that are in both result sets.
Column names have to be hard-coded into the SQL statement. If you want to write something now that will get column names from a metadata table sometime in the future, then you have to use dynamic SQL. SQL*Plus sometimes has quick and dirty ways of doing dynamic SQL, so say whether you're using SQL*Plus or not. -
Compare data between two tables all coullms
Hi All,
I have a task to compare data for the dev and prod data for the same table ,can some one please help me with the script for this ...
Thanks in Advance..SELECT Foo.*, Bar.*
FROM Foo
FULL OUTER JOIN
Bar
ON Foo.c1 = Bar.c1
AND Foo.c2 = Bar.c2
AND Foo.cn = Bar.cn
WHERE Foo.key IS NULL
OR Bar.key IS NULL;
Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
Blog : MS SQL Development and Optimization
Blog : Large
scale of database and cleansing
Maybe you are looking for
-
Add all values from xml.children()
I have an xml of numbers that I am using to power some dynamic bar charts.. I can easily pull out a string of all node values for variable area (SQMI) trace(stsXml.Records.Record.SQMI.children()); the trace result looks like this 67290147245978038334
-
Hi, xorg crashes for me with a segfault with these versions, first line of the backtrace mentions /usr/lib/xorg-server/Xorg (OsLookupColor+0x119) [0x594a29]. Anyone else seeing the same? I'll try with the previous NVIDIA driver in the meantime. Thank
-
After I hooked up my apple TV the picture on the TV came in large and now it looks like the zoom is on
-
Running the latest version, with Win7, all menus including right click contextual, and menu bars flicker and disappear. THe menu is still there, just not readable. Have read about possible Addon problems, but thats impossible, since I have zero Addon
-
ICloud Backup not Restoring!
I got a new iPhone 6 and am trying to restore it with a backup of my iPhone 5S (iOS8) but every time I try it, it gets about a quarter of the way and fails with an error regarding losing internet connection. I have tried 3 different networks, includi