3

I am trying to create table in Oracle 11g as select from a table in SQL Server 2012 via database link.

The table in SQL Server contains column: hslakkis varchar(3)

In Oracle it created the table with the same column but different size: hslakkis varchar2(9)

This behavior causes me a lot of problems with the columns size in Oracle. How can I prevent Oracle from increasing the column size?

marc_s
9,0626 gold badges46 silver badges52 bronze badges
asked Dec 21, 2015 at 15:39
2
  • What are the character sets on the two databases? That'll be the reason. (UTF antics) Commented Dec 21, 2015 at 15:44
  • The Oracle use AL32UTF8 character set while the Sql Server uses cp1255 character set. Commented Dec 21, 2015 at 15:54

1 Answer 1

5

This is a feature that's controllable by a parameter. From the documentation:

Multi-byte Character Sets Ratio Suppression This feature optionally suppresses the ratio expansion from SQL Server database to Oracle database involving multi-byte character set. By default, Oracle gateways assume the worst ratio to prevent data being truncated or insufficient buffer size situation. However, if you have specific knowledge of your SQL Server database and do not want the expansion to occur, you can specify HS_KEEP_REMOTE_COLUMN_SIZE parameter to suppress the expansion.

Basically, Oracle is assuming that all of the data in the source table may take up 3 bytes per character, due to characterset conversion.

answered Dec 21, 2015 at 16:01
1
  • Yikes. Better be aware of that and apply the parameter! Commented Dec 21, 2015 at 16:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.