INSERT statement works by itself but not in the script??
From: Bing Du (bdu_at_iastate.edu)
Date: 03/30/04
- Next message: Anno Siegel: "Re: Converting From C to Perl"
- Previous message: Gunnar Hjalmarsson: "Re: Variable substitution in variable name"
- Next in thread: Paul Lalli: "Re: INSERT statement works by itself but not in the script??"
- Reply: Paul Lalli: "Re: INSERT statement works by itself but not in the script??"
- Reply: Brian McCauley: "Re: INSERT statement works by itself but not in the script??"
- Reply: gnari: "Re: INSERT statement works by itself but not in the script??"
- Reply: John J. Trammell: "Re: INSERT statement works by itself but not in the script??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 10:22:39 -0600
Greetings,
This is perl, v5.8.0 built for i386-linux-thread-multi.
The result of the following INSERT is '0E0' (value of $rv) if run in a
Perl script that uses DBI and DBD::mysql (version 2.9003). The table
$ltm_ssn_table is still empty after INSERT.
=============
$rv = $mysql_dbh->do(qq{INSERT INTO $ltm_ssn_table (ltm_number,ssn,notes)
SELECT
$source_data_table.crse,$source_data_table.ssn,$old_ltm_ssn_table.notes
FROM $source_data_table LEFT JOIN $old_ltm_ssn_table
ON $source_data_table.crse=$old_ltm_ssn_table.ltm_number
AND $source_data_table.ssn=$old_ltm_ssn_table.ssn
WHERE $source_data_table.offer_dept_abrvn='$ltm_string'
});
============
However, the above INSERT works fine with the MySQL command line client:
========
mysql> INSERT INTO ltm_ssn (ltm_number,ssn,notes) SELECT
source_data.crse, source_data.ssn, old_ltm_ssn.notes FROM source_data
LEFT JOIN old_ltm_ssn ON source_data.crse=old_ltm_ssn.ltm_number AND
source_data.ssn=old_ltm_ssn.ssn WHERE source_data.offer_dept_abrvn='L TM;
Query OK, 485 rows affected (0.03 sec)
Records: 485 Duplicates: 0 Warnings: 0
==========
Would anybody tell me what's wrong with the INSERT within the script?
Appreciate any help.
Bing
- Next message: Anno Siegel: "Re: Converting From C to Perl"
- Previous message: Gunnar Hjalmarsson: "Re: Variable substitution in variable name"
- Next in thread: Paul Lalli: "Re: INSERT statement works by itself but not in the script??"
- Reply: Paul Lalli: "Re: INSERT statement works by itself but not in the script??"
- Reply: Brian McCauley: "Re: INSERT statement works by itself but not in the script??"
- Reply: gnari: "Re: INSERT statement works by itself but not in the script??"
- Reply: John J. Trammell: "Re: INSERT statement works by itself but not in the script??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|