Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> owa_pattern change to selectively change case?
I want to take a mixed case part description, and change it so that
just the first letter is capitalized. Then, I want to go back and
apply "upper" to any part numbers that fall within that part
description.
For example: "This Part Fits the ABC2-345-6WR Extension"
Change to first letter cap: "This part fits the abc2-345-6wr
extension"
Then "upper" the part number: "This part fits the ABC2-345-6WR
extension"
I know how to do the first step.
I'm trying to use owa_pattern.change to do the 2nd step. I can get the pattern match to work, but it won't then apply the upper() to the result. I've got to be missing something stupid. Any suggestions?
Here's a test output:
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> @$ORACLE_HOME/rdbms/admin/privtext.sql
Package body created.
No errors.
SQL> @$ORACLE_HOME/rdbms/admin/pubpat.sql
Package created.
No errors.
set define off serveroutput on
SQL> declare s varchar2(60) := 'Ab-24wr-02';
2 begin
3 owa_pattern.change(s,'[A-Za-z0-9]*',upper('&'));
4 dbms_output.put_line(s);
5 end;
6 /
Ab-24wr-02
PL/SQL procedure successfully completed. Received on Tue Nov 04 2003 - 08:15:06 CST