Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To get the size of the String

 
vikram nalagampalli
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Let me give a gist of my situation. I am passing a comma delimited String of SSNs (eg. 1234567890,0987654321,2345678901,3456789012)as a argument for a Stored procedure. But the problem is that, the parameter in Stored procedure can only accept a Max size of 32k. I have more probability that this String of SSN is more than 32k.
so my first question would be
1. How do i find the size of the string?
let me know what i did is right
int len = ssn.length();
int size_In_Bytes = len/1024;
2. Can anyone help me with a logic, about how to pass this string in pieces of less than 32k to the stored procdure, but at the same time making sure that SSN is passed completely.
I really appreciate an answer ASAP. Thanks in advance
Regards,
vikram
 
Neal Swearer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a StringTokenizer to parse the SSNs out and call the stored procedure on each SSN (looping through them one at a time).
 
vikram nalagampalli
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Neal Su:
You could use a StringTokenizer to parse the SSNs out and call the stored procedure on each SSN (looping through them one at a time).

Thanks fro your reply
can you be a little more detail.
 
Cory Wilkerson
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you're operating under UTF-8, every digit in every social security number that I'm aware of (granted, that's us only) can be represented in eight-bit bytes, therefore, I can't imagine a social security number exceeding a 32,000 bit limitation in the database.
Here's use of a tokenizer:

Good luck,
Cory Wilkerson
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic