Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to split strings in pl/sql or in sql/plus
Here's some pl/sql code I used a few years ago:
set serveroutput on;
declare
components owa_text.vc_arr ;
string1 varchar2(200) default '06/13/2005';
begin
if (owa_pattern.match(string1, '(\w*)/(\w*)/(\w*)', components)) then
for counter in 1 .. components.count loop dbms_output.put_line(components(counter)); end loop;
end if;
end;
/
this works in 9i (9.2) here is the output:
QL*Plus: Release 8.1.7.0.0 - Production on Thu Jun 9 15:47:58 2005
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
06
13
2005
PL/SQL procedure successfully completed.
Dave
baka wrote:
> hello
> I want to break the the follwoing string variable into two strings.
>
> eg; str="abcd\wxyz"
> into
> str1="abcd"
> str2="wxyz"
>
> i know how to do this in all 4GLs .
> is it possible to do it in SQL/PLUS or PL/SQL?
> (by the way i am re3ading a datfile from a .csv)
>
> Thanks in Advance
>
Received on Thu Jun 09 2005 - 14:58:14 CDT