Solved

nvarchar in mssql

Posted on 2009-04-06
4
1,377 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
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 configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

744 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

16 Experts available now in Live!

Get 1:1 Help Now