3

Why is long an issue with Oracle?

It will be better if some one can tell me what are the issues with using the long data type in oracle? something related to storage?

I was asked this in an interview.

Lazer
  • 90,700
  • 113
  • 281
  • 364
Egalitarian
  • 2,168
  • 7
  • 24
  • 33

2 Answers2

2

LONG is archaic and deprecated, and has been superseded by CLOB. There are lots of restrictions with LONGs and they are difficult to manipulate in SQL. So while you may have to deal with them in old databases, you would be unwise to ever use a LONG column in a new table.

Tony Andrews
  • 129,880
  • 21
  • 220
  • 259
  • So should i alter my table if i am using long ???? since it ll be phased out finally – Egalitarian Aug 02 '10 at 08:52
  • It will probably never disappear completely as too many old databases would break. If the table has been in use for a long time and there is code written to cope with a LONG column then probably best to leave it alone. – Tony Andrews Aug 02 '10 at 09:13
  • So how to deal with long in databases in which i can not change the attribute type to CLOB. some one suggested that write chunks of data but how to do that?? any idea .. or can u provide me a link?? which gives me the code as well – Egalitarian Aug 03 '10 at 05:28
0

Unfortunately, LONGs are still sometimes necessary. For example, you can read a LONG from a remote database, but you can't read a CLOB from a remote database until 12.2. (Although you can always write a CLOB to a remote database.) I'm guessing this is why they are still used everywhere in the data dictionary.

Other than that issue, you should probably always use CLOBs.

Jon Heller
  • 34,999
  • 6
  • 74
  • 132
  • So how to deal with long in databases in which i can not change the attribute type to CLOB. some one suggested that write chunks of data but how to do that?? any idea .. or can u provide me a link?? which gives me the code as well – Egalitarian Aug 03 '10 at 05:26