OK. For anyone who may be searching for a similar answer, I'm going to try to explain the solution.
As renrig pointed out, the number of bind_cols did not match, and as NetWallah pointed out, I had added a new constraint to the SQL query. A close reading of the query brought me to a slightly different set of bind_cols. Perhaps the experts can forgive a newbie's lack of understanding of the whole picture, but I did not "get" the relationship between the select statement and the bind_cols. It seems I needed to account for everything in the select statement in the bind_cols, although the book I was reading told me I could pick and choose which to bind. Anyway, the new set of bind_cols:
$sth->bind_col( 1, \$bib_id ); $sth->bind_col( 2, \$_title_marc ); $sth->bind_col( 3, \$timedate ); $sth->bind_col( 4, \$callno ); $sth->bind_col( 5, \$mfhd_id ); $sth->bind_col( 6, \$trash ); $sth->bind_col( 7, \$location ); $sth->bind_col( 8, \$loca_id ); $sth->bind_col( 9, \$isbn );
These match, point for point, the select statement. The "trash" column, number 6, refers to the second To_Char. I still don't really understand why this was necessary, but when I added it, the query ran. I knew this because it started throwing errors when the script tried to insert the data into my newbooks table: "DBD::Oracle::db do failed: ORA-00947: not enough values"
Progress! Errors are good! :-)
This is the code I needed to look at:
$dbh->do (qq{insert into newbooks values('$s_title','$timedate','$subj +ect','','$callno','$url','$display_date','$location','$loca_id','$isb +n')});
Turns out the code was fine, but my table was off. I created a new table in the Oracle database that matched, in order and precisely, the above values. I then ran the script and it populated the table! Eureka!
Again, not Earth-shaking for the experts out there, but for someone who is trying to come to grips with the way programming works, this was. I hope it may help someone else someday.
In reply to Re: bind_col() and the SQL query
by Hans Castorp
in thread bind_col() and the SQL query
by Hans Castorp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |