The documentation for DBI is pretty clear on the return value of do and it says:
Prepare and execute a single statement. Returns the number of rows affected or "undef" on error. A return value of "-1" means the number of rows is not known, not applicable, or not available.
But you are not testing the defined-ness or the negativity of the return value, you are testing the truthfulness of it. So, if zero rows are affected the return value will be zero, but your code in its present form takes this to be a failure. Instead of your current test, perhaps something like this might be better:
$rows = $source_dbh->do($ctas_sql); unless (defined $rows) { # handle error condition here }
Caveat: Your comments and code suggest you are using Oracle which I haven't touched for years so there may be something specific to that DB at play here as well.
Update: That's probably cobblers. do should return 0E0 on zero rows and your output clearly shows that rows is '' or undef. Sorry for the noise.
In reply to Re: DBI false error
by hippo
in thread DBI false error
by kyledba2013
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |