Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top