My query does not return anything when my query contains accents on the WHERE clause
The accents are the cause of the problem and I don't know how to fix it.
I think that the encoding in UTF8 is not done, and the ORACLE UNISTR('') method does not work.
The 2 queries return a result in ORACLE SQL DEVELOPER
This query works :
$database->Parse("SELECT
ID_WORKSPACE_USERS,
LOGIN_WORKSPACE_USERS,
FONCTION_WORKSPACE_USERS
FROM WORKSPACE_USERS
WHERE FONCTION_WORKSPACE_USERS = UNISTR('Job 1')"
);
This query does not work (I don't have any extra space in my database) :
$database->Parse("SELECT
ID_WORKSPACE_USERS,
LOGIN_WORKSPACE_USERS,
FONCTION_WORKSPACE_USERS
FROM WORKSPACE_USERS
WHERE FONCTION_WORKSPACE_USERS = UNISTR('Job é')"
);
I found the solution, this code allows to query the database using UTF8 encoding
You have to indicate $character_set = 'AL32UTF8'.
Also, session_mode can take 3 values :
0 : uses the database encoding
1 : uses the national encoding
2 : use AL32UTF8 encoding
Personally, I set session_mode to null because setting $character_set
is enough.
So I removed the UNISTR function from my request, no more need.
$character_set = 'AL32UTF8';
$session_mode = null;
oci_connect($login, $password, $description, $character_set, $session_mode);