83
Views
4
Comments
Solved
[OutSystems UI Style Guide Preview] A fix for Oracle database
outsystems-ui-style-guide-preview
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hi Team

When publishing this component to Environment that use Oracle Database.
I got following error when access Patterns Screen.
Error executing query. Error in advanced query Get_MenuCategories in GetMenuCategories in Patterns in MainFlow in StyleGuidePreview (SELECT {MenuCategories}.* FROM {MenuCategories} WHERE (@SearchKeyword = '' OR ( {MenuCategories}.[Caption] LIKE '%' + @SearchKeyword + '%' OR EXISTS (SELECT 1 FROM {MenuSubCategory} WHERE {MenuSubCategory}.[MenuCategoryId] = {MenuCategories}.[Id] AND {MenuSubCategory}.[Label] LIKE '%' + @SearchKeyword + '%' )) )): ORA-01722: invalid number

It seems Advanced Query not compatible with Oracle Database, hope you can fix it.
BTW, following are my fix and it worked.
1. Add Input Parameter HasSearchKeyword


2. Edit Query

SELECT {MenuCategories}.*
FROM {MenuCategories}
WHERE (@HasSerachKeyword  = 0 OR (
        {MenuCategories}.[Caption] LIKE @SearchKeyword OR
        EXISTS (SELECT 1 
                FROM {MenuSubCategory}
                WHERE {MenuSubCategory}.[MenuCategoryId] = {MenuCategories}.[Id]
                AND {MenuSubCategory}.[Label] LIKE @SearchKeyword ))
)


3.Set Value as following
- HasSearchKeyword: SearchKeyword <> ""
- SearchKeyword : If(SearchKeyword = "", "", "%" + SearchKeyword + "%")



Regards
Wei

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Just confirmed and this was not included in time for version 1.2.1 but will be on 1.2.2 instead.
For better tracking on future release notes, you can refer to the code ROU-4221.

2021-03-12 19-55-30
Greg Whitten
 
MVP

The issue here is the "+ @SearchKeyword +" in the original query.  Oracle does not support + as a string concatenation operation.  The concat operator in Oracle is ||.  It's better to use the CONCAT function as that is supported in both SQL and Oracle: 

LIKE CONCAT(CONCAT('%', SearchKeyword), '%')

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi @Wei Zhu 

We already have identified this and fixed it for the next release  (version 1.1.4 with an ETA of December 19).
We used exactly the same approach mentioned by @Greg Whitten that explained it perfectly.

Cheers,
GM

2023-04-12 14-26-51
David Bednarski

Looks like this is still an issue in the current version (1.2.1).

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Just confirmed and this was not included in time for version 1.2.1 but will be on 1.2.2 instead.
For better tracking on future release notes, you can refer to the code ROU-4221.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.