Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tokenizer

Status
Not open for further replies.

asth01

Programmer
Jan 18, 2004
36
US
Hi,

Can I tokenize a big String into token with separators like Space or Comma in PL/SQL?

Thanks in advance,
 
Asth01,

My parents taught me never to "tokenize" in public. [smile]
First, please define (with examples) what you want to occur. Sample inputs with sample expected results and any necessary transformation explanations would be helpful for us to help you.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 20:44 (05Apr04) UTC (aka "GMT" and "Zulu"), 13:44 (05Apr04) Mountain Time)
 
Actually I have written a small Java program that uses split() function and returns String[]. I want to use this program in a PL/SQL procedure.

I am stuck at publishing the Java function. I tried:

CREATE OR REPLACE FUNCTION MIG_USER.SPLIT_STR (STR VARCHAR2, DELIM VARCHAR2)
RETURN VARRAY(20) OF VARCHAR2
AS LANGUAGE JAVA
NAME 'String_Mani.split_it(java.lang.String) return java.lang.String[]';

But it gives me error.

Also, I want to assign the return of String [] to VARRAY in PL/SQL.

Please help me!!!
 
Hi there ,

If we are talking perticularly about a comma-delimited string, there is a procedure provided in the DBMS_UTILITY package.

DBMS_UTILITY.COMMA_TO_TABLE and
DBMS_UTILITY.TABLE_TO_COMMA

See the details in the "PL/SQL supplied packages reference" of Oracle.

If you want a generic tokanizer, you can write a little function/procedure for that purpose. I have done this before. Just use logic and some substr, instr etc etc.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top