2

We have a set of scripts, for both Oracle as SQL Server. These scripts are ANSI.

Now we want to support Unicode databases as well. But that requires some modifications to our scripts. For example the use of different datatypes and putting an 'N' before strings.

Does anybody know if there are tools to convert scripts to/from unicode? I couldn't find anything yet using several search engines.

Rhapsody
  • 6,017
  • 2
  • 31
  • 49
  • 1
    Please note that neither `ANSI` nor `Unicode` are actual character encodings. I assume you are talking about switching from single byte charsets (such as ISO-8859-1 or Windows-1252) to multi-byte charsets (such as UTF-8 or UTF-16). I mention this because I've noticed there're many developers out there who don't even know what character sets are used by their apps and that's a fundamental concept. – Álvaro González Jan 05 '11 at 10:42
  • Thanks for your reply. I do talk about switching from a single byte charset to a multi-byte charset. – Rhapsody Jan 05 '11 at 10:47

1 Answers1

2

In Oracle you have two approaches. If you have full control over the database server, I suggest you just change the default character set, i.e., the value of the NLS_CHARACTERSET parameter, and left the rest of the database stuff unchanged. Using regular CHAR/VARCHAR2 columns offers a wider feature set (such as full text indexing).

If don't have full control over the server or you need to keep compatible with old non-multibyte aware applications, you'll have to check the value of the NLS_NCHAR_CHARACTERSET parameter and alter all your DB stuff to use the NCHAR/NVARCHAR2 data types.

Here's another question that highlights the differences:

Difference between VARCHAR2(10 CHAR) and NVARCHAR2(10)

Last but not least, here you are some useful queries:

SELECT * FROM NLS_DATABASE_PARAMETERS;
SELECT * FROM NLS_INSTANCE_PARAMETERS;
SELECT * FROM NLS_SESSION_PARAMETERS;

Note: I can't help with the migration tool or SQL Server parts, sorry.

Community
  • 1
  • 1
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • Thanks again. I think I need to rephrase my question though. Your answer is clear, but my question is not, I think :-) I'm also relatively new to databases and unicode. – Rhapsody Jan 05 '11 at 10:53
  • @Rhapsody I admit I've only answered a tiny part of your question. What I meant is that it's possible that the Oracle version does not need any change. – Álvaro González Jan 05 '11 at 10:55