I’m making a script that goes through a table that contains all the other table names on the database. As it parses each row, it checks to see if the table is empty by
select count(*) cnt from $table_name
Some tables don’t exist in the schema anymore and if I do that
select count(*)
directly into the command prompt, it returns the error:
206: The specified table (adm_rpt_rec) is not in the database.
When I run it from inside Perl, it appends this to the beginning:
DBD::Informix::db prepare failed: SQL: –
How can I avoid the program quitting when it tries to prepare this SQL statement?
Working code – assuming you have a ‘stores’ database.
Output from running the code above.
This printed the error (
PrintError=>1), but continued. Change the 1 to 0 and no error appears. The parentheses in the declarations of$tabnameand$numare crucial – array context vs scalar context.