You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have a problem running querys that contains char §.
The DB2 instance contins table with column names that contains § char for example CLM$§1.
when i try to execute the query the following query, laravel returns sql error
DB::connection('ibmi')
->table('ST3SFA.TSTCLM$F')
->selectRaw('
TRIM(CAST(CLM$§1 AS VARCHAR(255))) AS id
,TRIM(CAST(CLM$02 AS VARCHAR(255))) AS description
,TRIM(CAST(ECLM05 AS VARCHAR(255))) AS super_calss_id
,CASE WHEN TRIM(CAST(CLM$96 AS VARCHAR(255))) = \'\' THEN CAST(NULL as VARCHAR(255)) ELSE CURRENT_TIMESTAMP END AS deleted_at
')
->orderByRaw('TRIM(CAST(CLM$§1 AS VARCHAR(255)))')
->chunk(10, function ($lines) {
foreach ($lines as $line) {
$result = [
'id'=>ucfirst(strtolower($line->id)),
'description'=>ucfirst(strtolower($line->description)),
'super_calss_id'=>ucfirst(strtolower($line->super_calss_id)),
'deleted_at'=>$line->deleted_at,
];
dump($result);
}
});
Error:
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 0 (SQLPrepare[0] at /builddir/build/BUILD/php-7.3.14/ext/pdo_odbc/odbc_driver.c:204) (SQL: select TRIM(CAST(CLM$§1 AS VARCHAR(255))) AS id ,TRIM(CAST(CLM$02 AS VARCHAR(255))) AS description ,TRIM(CAST(ECLM05 AS VARCHAR(255))) AS super_calss_id ,CASE WHEN TRIM(CAST(CLM$96 AS VARCHAR(255))) = '' THEN CAST(NULL as VARCHAR(255)) ELSE CURRENT_TIMESTAMP END AS deleted_at from ST3SFA.TSTCLM$F order by TRIM(CAST(CLM$§1 AS VARCHAR(255))) FETCH FIRST 10 ROWS ONLY)
I have tried to enable 'UNICODESQL' => 1, and 'DEBUG' => 65536, in the cfg but without success.
If i try to execute the same query wituout specifying column names and using the *
the result is returned but the colun is not accessible sing it contains $ in the name.
Anyone has faced this kind of problem before?
Thanks in advance
Riccardo
The text was updated successfully, but these errors were encountered:
Hi,
I have a problem running querys that contains char §.
The DB2 instance contins table with column names that contains § char for example
CLM$§1
.when i try to execute the query the following query, laravel returns sql error
Error:
I have tried to enable
'UNICODESQL' => 1,
and'DEBUG' => 65536,
in the cfg but without success.If i try to execute the same query wituout specifying column names and using the *
the result is returned but the colun is not accessible sing it contains $ in the name.
Anyone has faced this kind of problem before?
Thanks in advance
Riccardo
The text was updated successfully, but these errors were encountered: