简体   繁体   中英

Perl DBI no prepare

I am using Perl (DBI:ODBC) to connect to Teradata. SQL statement being executed is replace procedure statement.
Teradata ODBC driver doesn't allow to prepare REPLACE PROCEDURE throwing exception.
So, instead of prepare + execute I've tried to use do
$rownum = $con->do("replace procedure ... ");

The problem is that if replace procedure can not be executed (syntax errors, missing objects) then ODBC driver doesn't generate an error. It simply returns recordset with the list of errors.

So if an error occured during replace procedure, then $rownum value will be non zero.
But DBI->do doesn't support return of recordsets.
So, current situation is:

  1. I can't use prepare + execute because of unsupported statement by the driver
  2. I can't use do, because I can't get error list (however I can identify this error by non-zero rows affected value).

Generally: how to fetch results of the query that can't be prepared?

Force DBD::ODBC to use SQLExecDirect instead of SQLPrepare/SQLExecute. odbc_exec_direct

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM