I have connected to an external Oracle DB.
I need to run an SQL with some Oracle function like these :
LPAD, TO_CHAR, TO_NUMBER ...But Outsystems don't support those functions, and show the error below.
Does someone have solution for this problem.
Thank you.!
Thank you all for helping me,
@Krishnanand Pathak @Gitansh Anand @Daniel Kuhlmann
since I need to make a query from Oracle DB so SQL function won't work for this case.
But when I try using @Krishnanand Pathak 's suggestion with SQL function, I found the way to "target" the SQL to the right DB platform.
First, the default advanced SQL will just accepted SQL function, so when I create a new SQL, it won't accept function from Oracle like this:
But after i try to put the From {Entity} to complete the queryThen I close the editor and reopen it. The SQL will target Oracle DB and all the oracle function are shown in suggestion, and the query works as well.Hope this will give you a little information if you guys need to connect external oracle DB with some built in function query.
Thanks.!
Hi @Kiet Phan, You can use the built-in function FormatText (look at the screenshot below). If you want to use it on an input parameter or a static text, you can use this before the SQL and then pass it to SQL, and if you want to use it on an entity attribute, then write a query and get the required columns without the LPAD, then after the query execution use this function on the column you want.ThanksGitansh Anand
Hi @Kiet Phan
Outsystems support SQL server database engine and you are using Oracle database function that's why it's giving you error,
I hope it'll help you,
ThanksDeep
It is clearly stated in the question:
āI have connected to an external Oracle DB"
Regards,
Daniel
Hi @Daniel Kuhlmann
Thanks for your suggestion but may i know what i posted wrong, If you read original post then there is a snapshot attached and we can see there is no entity used, so default it'll take function and keywords from SQL not from Oracle,
and this is what @Kiet Phan mentioned in his solution,
Please correct me if i am wrong,
As I wrote before, the question is about SQL for Oracle. Then you talk about that OutSytems is on MS SQL Server, and telling the user that that is the reason of the error. SQL statements are always written to the database you access. So Oracle syntax for Oracle database, SQL Server syntax for SQL server database.
Hi @Kiet Phan,
There are equivalent functions available in SQL Server to achieve same result as shown below
Check the below links for more equivalent functions are available.https://www.c-sharpcorner.com/UploadFile/c5c6e2/sql-server-functions-and-oracle-equivalent/
https://www.akadia.com/services/sqlsrv_oracle_functions.html
You can also search on google directly.
RegardsKrishnanand Pathak
How does this reply help if the orginal poster clear states he is using an external Oracle database?