Materialized view
luiz-andrade opened this issue · comments
Materialized view with the package
How do I run this materialized view with the package?
- It works
$conn = oci_pconnect("user", "pass", "127.0.0.1/XE");
$sql = oci_parse($conn, "BEGIN DBMS_MVIEW.REFRESH('MV_DW_TESTE'); END;");
$result = oci_execute($sql);
With this command above it works
- with PDO does not work
$pdo = DB::connection('oracle')->getPdo();
$result = DB::connection('oracle')->getPdo()->exec("BEGIN DBMS_MVIEW.REFRESH('MV_DW_TESTE'); END;");
System details
- Linux Mint Version 21.2
- PHP Version 8.1
- Laravel Version 10
- Laravel-OCI8 Version v10.3.1
Was able to replicate the issue using the package. Using SQL Developer, I also replicated the issue using EXECUTE IMMEDIATE 'DBMS_MVIEW.refresh(''users_mv'')';
It seems like the PDO behaves like execute immediate
but can't trace yet how it occurs.
Will try to check again when I got the chance.
Got it, just remove the exec in your SQL.
DB::statement("begin DBMS_MVIEW.refresh('users_mv'); end;");