File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Parsing a String value in StoredProcedure??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Parsing a String value in StoredProcedure???" Watch "Parsing a String value in StoredProcedure???" New topic

Parsing a String value in StoredProcedure???

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276

I have a string value separated by the delimiters like:


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 ,


The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
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

Joined: Jan 10, 2006
Posts: 62

Hi Jignesh
You could make use of StringTokenizer class,
since the "#" is being used as a delimiter and parse your string accordingly.

vinny m

Regards,Vinny M.
proud Fan of European Champion CHELSEA FC
"If you don't see the bug where you're looking, perhaps you're looking in the wrong place" -James Gosling
I agree. Here's the link:
subject: Parsing a String value in StoredProcedure???