M.J.
M.J.

Reputation: 16646

pattern matching in DB2 SQl

I have a table

Marks_Table (
MARKS_ID         NUMBER,
ST_ID            NUMBER,
MARK_DESC        VARCHAR(20),
MARKS            NUMBER
)

Now, MARK_DESC, contains the desciption of the Marks. Now i want to have the rows in the table which contains test in the description.

Now the problem is, that the description may contains test in any pattern, it may be Test, test, TeSt, tEST and so on..

How to fetch the rows with the above conditions.?

Thanks..

Upvotes: 0

Views: 630

Answers (2)

Peter Miehle
Peter Miehle

Reputation: 6070

Marks_Table (
MARKS_ID         NUMBER,
ST_ID            NUMBER,
MARK_DESC        VARCHAR(20),
MARKS            NUMBER,
MARK_search      VARCHAR(20),
)

and insert MARK_search as something like normate(MARK_DESC) with removing spaces and uppercase with a (insert/update) trigger and a stored procedure

Upvotes: 0

nabuchodonossor
nabuchodonossor

Reputation: 2060

what about the "UPPER" function?

select * from marks_table where upper(mark_desc) like '%TEST%'

Upvotes: 4

Related Questions