• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1486
  • Last Modified:

nvarchar in mssql

Does oracle have nvarchar if I plan to write application that work with bot mssql and oracle what should I do
0
teera
Asked:
teera
4 Solutions
 
lwadwellCommented:
Yes it does,  but like Oracle prefers VARCHAR2 instead of VARCHAR ... NVARCHAR is called NVARCHAR2 in Oracle!

http://www.orafaq.com/wiki/NVARCHAR2
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
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
 
mrjoltcolaCommented:
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
 
schwertnerCommented:
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now