Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Are there any constraints on length of String?

 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any constraints on length of String, passed to oracle stored procedure using setString method?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What data type are you using, and what precision does it have? There are no limits on a String size in Java, but there are limits on how much data each data type can hold.
 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a String, such as
String value;
And i have a stored procedure. cstmt - is a CalalbleStatement for this procedure, Procedure parameter is VARCHAR2
If I call
cstmt.setString(1, value);
will there be some constraints on the length of my string variable? For example, if my string consists of 20000 chars, can there be problems in passing this string to Oracle proc?
 
Srilakshmi Vara
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sergey,

You can pass lengths in callable statement only to ASCII,Binary and character Streams.

Srilakshmi
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
VARCHAR2 is usually defined with a precision, normally specified as the number of characters which can be held. i.e. VARCHAR2(10). The maximum size is I think 4000 bytes. Notice this is not defined as characters - different character sets will use a different amount of space to store each character.

If you have to store very large amounts of character data, have a look at CLOBs
 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, guys!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic