Mike Nowakowski

Member since: Thursday, 18 October 2018
Last login: 4 years ago
Profile viewed: 169 views

No Rank
Points: 0

Mike Nowakowski created a new topic ' FireDAC data type conversion broken in Rad Studio 10.2' in the forum. 4 years ago

I’ve recently upgraded from Rad Studio 10.1 Berlin to 10.2 Tokyo and ran into a data type problem with my FireDAC queries. The following query illustrates the issue. This is being run against an Oracle database using a TFDPhysOracleDriverLink with the CharacterSet := csUTF8;

query := TFDQuery.Create(self);
query.Connection := FDConnection1;

query.SQL.Add('select ''X'' as test1');
query.SQL.Add('from dual');
query.SQL.Add('select :param1');
query.SQL.Add('from dual');

with query.ParamByName('param1') do
DataType := ftWideString;
Value := 'Y';

Rad Studio 10.2 throws the following when the above query is executed:
Exception - Project FireDACTest.exe raised exception class EOCINativeException with message '[FireDAC][Phys][Ora] ORA-12704: character set mismatch'

From my testing it appears there was a change to how the static strings are cast. I can explicitly cast the text in the query using TO_NCHAR(‘’X’’) so it matches the ftWideString of my param. Alternatively, I can change my param to ftString to match the ‘’X’’. Neither option is a feasible.

This behavior is new to Rad Studio 10.2 as the same code executes fine in 10.1. Does anyone have input on how to move forward so the above query executes without error? Possibly a new setting in FireDAC or something on the database side?