Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Normalization of attributes

Re: Normalization of attributes

From: <joe_celko_at_my-deja.com>
Date: Fri, 05 Nov 1999 05:08:54 GMT
Message-ID: <7vtop5$bc$1@nnrp1.deja.com>

>> 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US