Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Normalization of attributes
>> I need to check if the prefixes [of two strings] are equal ... <<
Look at the POSITION (<string1> IN <string2>) function -- your product should have some version of this ISO Standard SQL-92 procedure.
First create a table of integers, 1 to (n):
CREATE TABLE Sequence (seq INTEGER NOT NULL);
now use that to cut off all possible substrings on the left hand side:
SELECT *
FROM Foobar AS F1, Sequence AS S1
WHERE POSITION (SUBSTRING (F1.str1 FROM 1 FOR S1.seq) IN F1.str2) = 1
AND S1.seq <= CHAR_LENGTH (F1.str1);
--CELKO--
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Nov 04 1999 - 23:08:54 CST
![]() |
![]() |