Solved

nvarchar in mssql

Posted on 2009-04-06
4
1,401 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 47

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This video shows how to recover a database from a user managed backup
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now