Solved

nvarchar in mssql

Posted on 2009-04-06
4
1,422 Views
Last Modified: 2012-05-06
Does oracle have nvarchar if I plan to write application that work with bot mssql and oracle what should I do
0
Comment
Question by:teera
4 Comments
 
LVL 25

Assisted Solution

by:lwadwell
lwadwell earned 100 total points
ID: 24083564
Yes it does,  but like Oracle prefers VARCHAR2 instead of VARCHAR ... NVARCHAR is called NVARCHAR2 in Oracle!

http://www.orafaq.com/wiki/NVARCHAR2
0
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 100 total points
ID: 24083585
If you want to store non-Unicode characters use VARCHAR in MSSQL and VARCHAR2 in Oracle.
If you want to store Unicode characters use NVARCHAR in MSSQL and NVARCHAR2 in Oracle.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 200 total points
ID: 24083810
As to creating type "synonyms" or SQL domains to match SQL Server, Oracle doesn't support the standard SQL DOMAIN (annoying) but you can create a Oracle type, but it will probably not solve your issue of being able to use a common DDL, because you cannot give lengths to the types, that I am aware of.

create or replace type nvarchar as object ( field nvarchar2(500) );

create table mytab
(
   f1 nvarchar
);

But you cannot do:

create table mytab
(
  f1 nvarchar(100)
);


But there are more mapping issues between Oracle <-> SQL Server than just column type names.

I don't try to manage a single DDL, I use an ER tool to maintain a logical model and generate multiple physical models from those. Embarcadero ER/Studio is very good at this, and there are others.

I have schemas that I maintain and I can generate Oracle, Sybase and SQL Server physical models, and keep them in sync by changing only the logical model.

Also, when synching changes made manually from a database, you can sync it back to the logical model, then forward to the dependant physical models.

If you do a lot of this type of work, the investment in a tool like this (3k) pays for itself within a short time. You must learn the tool well, though. I don't recommend ERwin for this as I have had problems with the "complete compare" crashing, which is why I moved to Embarcadero 2 yrs ago.

0
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 100 total points
ID: 24084808
In Oracle the character set of the Data base is in high impartance.
The character set should be able to store the letters of the alphabet
you use.
The most universal characters set is AL32UTF8.

After your DBA ensures this you can store the data in VARCHAR2 columns.
Normaly the semantic is in bytes (keep in mind that some Unicode letters need
more then one byte per letter). Example:  
name VARCHAR2 (89),

But you can also use "character semantic - the length is declared in number of characters (but not greater then 4000 bytes). Example:

name VARCHAR2 (89 char),


0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question