I have a CSV whihc contains 3 fields as below:
value1, value2, value 3
Note: there is a space between “value” and “3” in the 3rd field.
I am uploading this data row by row to Oracle DB using perl DBD::Oracle and DBI.
here is the query that I am using to upload:
$dbh->do ("INSERT INTO $table VALUES ($col1_value, $col2_value, $col3_value)");
however, it is faling to upload and complaining like below:
DBD::Oracle::db do failed: ORA-00917: missing comma (DBD ERROR: error possibly near <*> indicator at char 103 in 'INSERT INTO TABLE_NAME VALUES (value1, value2, value <*>3 )')
So it is failing on hte 3rd value whihc contains a space.
could you guide me on how to upload the string with “Space” in it to Oracle.
BTW, I am not oracle guy so please point me if anything that I am doing is wrong.
Thnaks.
For many reasons (security, efficiency, correctness) you want to be using placeholders to put values into SQL.
This avoids needing to do any escaping both for syntactical and security purposes.