Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing a String value in StoredProcedure???

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a string value separated by the delimiters like:

abc#def#ghi#jkl#$mno#pqr#stu#vwx#$............

I want to parse the above string in a stored procedure so that i can insert each value separated by # in a particular column.

So how can i achieve this??

Thanks ,
Jignesh
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on which DB you use, because each has its own stored proc syntax.

I would advise to do this kind of processing outside of the DB, though, as it has nothing to do with storing/retrieving data. You don't want to change stored procs if the data format changes.
 
Vinny Menon
Ranch Hand
Posts: 62
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jignesh
You could make use of StringTokenizer class,
since the "#" is being used as a delimiter and parse your string accordingly.


hth,
cheers
vinny m
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic