Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> sql filter by language
Just to provide an example, I'm using some made up tables. It's
actually doing an intermedia search through two clobs, but that's
irrelevent. The basic structure is the same, but I need to provide a
filter based on language. Basically, what I want is to be able to
search on one column, regardless of language. But when I find a record
that matches, I want to return it in the language of choice. However,
if it doesn't exist in that language, then still return it in the
other language. So using my fake tables below, if I was looking for
book and I wanted it returned in french, then it would find productId
number 2, but it would return the entry that is in french. The twist
is that if I was looking for pen, which doesn't have a french entry,
then I need to return the english entry.
select productName from productTable
where //pseudo-code//preferredLanguage = 'french'
and productTable.productId in
(select productId from secondProductTable
where secondProductTable.description = 'book')
I was thinking of some group by using having sum, or something along those lines. This has to be sql, not pl/sql. thanks
productTable
productId productLang productName 1 english chairName 1 french chaiseNom 2 english bookName 2 french livreNom 3 english penName 4 english paperName 4 french papierNom
secondProductTable
productId productLang productDesc 1 english chair 1 french chaise 2 english book 2 french livre 3 english pen 4 english paper 4 french papierReceived on Thu Jan 23 2003 - 14:29:52 CST
![]() |
![]() |