-3

I have large data (more than 4000 characters) and I have a column of type VARCHAR2(4000) in Oracle 11g.

Is there any way to insert that data in this column without changing its data type?

user272735
  • 10,473
  • 9
  • 65
  • 96
S_sauden
  • 302
  • 2
  • 10
  • 1
    No it is not possible. What are your options? Add a column? – Nick.Mc Jul 11 '17 at 04:58
  • Your question might be a duplicate of [this](https://stackoverflow.com/questions/25237463/max-size-of-varchar2-in-pl-sql-and-sql). – Jeff Holt Jul 11 '17 at 05:00
  • 1
    Change the title of your question. The word "field" is ambiguous considering you put the "plsql" tag on your question. If you're referring to a variable in a PL/SQL block, then change the title to use the word "variable"; otherwise use the word "column". – Jeff Holt Jul 11 '17 at 05:06
  • 1
    You already answered your question. Read your question once again. You wrote `I have large data (more than 4000 character) and i have field with varchar2(4000) datatype.I am just trying to insert that data in field without changing datatype` . In term of layman, you are trying to put a `JAR of water` in a `CUP` without changing the size of `cup`. And you know the consequences of your activity. – XING Jul 11 '17 at 08:02

2 Answers2

0

If you are referring to a variable defined in a PL/SQL package, function, or procedure, then the maximum length of a VARCHAR2 variable is 32k. If the value must be persisted then you have to decide if you want to keep the data contiguous. If you do, then you must change the column's datatype to CLOB. If it does not need to be contiguous, then simply create a child relation to store the pieces.

Jeff Holt
  • 2,940
  • 3
  • 22
  • 29
0

No, your data will get truncated, if it is more than the value you specified in the data type. The best way you can resolve this issue is by changing varchar2(4000) to varchar2(max) . MAX will allow you to insert data upto 32000 characters.