Why does perl DBI adds special characters (less than asterisk greater than) to prepared statement (Oracle)?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Why does perl DBI adds special characters <*> (less than asterisk greater than) to prepared statement (Oracle)?



I'd like to use a prepared statement with perl DBI (version 5.16.3) to update a row in an Oracle database table.


my $query = 'update THE_TABLE set (COLUMN_ONE = ?, COLUMN_TWO = ?,
MODIFY_DATE = SYSDATE) where ID = ?';
my $statement_update = $db_handle->prepare($query) or die 'DB Error: ' . $db_handle->errstr;
$statement_update->execute(1, 1, '123456789') or die 'DB Error: ' . $statement_update->errstr;



When executing, perl DBI is adding a special <*> symbol group to the statement and that is causing the error:



DBD::Oracle::st execute failed: ORA-00907: missing right parenthesis (DBD ERROR: error possibly near <*> indicator at char 31 in 'update THE_TABLE set (COLUMN_ONE <*>= :p1, COLUMN_TWO = :p2, MODIFY_DATE = SYSDATE) where ID = :p3') [for Statement "update THE_TABLE set (COLUMN_ONE = ?, COLUMN_TWO = ?, MODIFY_DATE = SYSDATE) where ID = ?" with ParamValues: :p1=1, :p2=1, :p3='123456789'] at a_perl_script.pl line ...


DBD::Oracle::st execute failed: ORA-00907: missing right parenthesis (DBD ERROR: error possibly near <*> indicator at char 31 in 'update THE_TABLE set (COLUMN_ONE <*>= :p1, COLUMN_TWO = :p2, MODIFY_DATE = SYSDATE) where ID = :p3') [for Statement "update THE_TABLE set (COLUMN_ONE = ?, COLUMN_TWO = ?, MODIFY_DATE = SYSDATE) where ID = ?" with ParamValues: :p1=1, :p2=1, :p3='123456789'] at a_perl_script.pl line ...



With symbolhound I could find this page, where it looks like others met the same thing. And it looks like it is random where perl DBI puts the <*> symbols.



How could I adjust perl DBI to properly make this statement?





(DBD ERROR: error possibly near <*> indicator <= indication where error may be. It's not that DBI is executing such query. Btw, why parens in update query?
– Сухой27
Aug 6 at 10:31


(DBD ERROR: error possibly near <*> indicator





I see. I wrote the query based on this with paranthesis. I try it without them.
– adtewa
Aug 6 at 10:36





If not sure about query, try it with sqlPlus first.
– Сухой27
Aug 6 at 10:39




2 Answers
2



It doesn't insert that symbol into the query, that gets executed. It's just a marker in the error message indicating the position of the syntax error as a convenience for you, to find that spot easier.



To get rid of the error, remove the parenthesis from your query.


...
my $query = 'update THE_TABLE set COLUMN_ONE = ?, COLUMN_TWO = ?,
MODIFY_DATE = SYSDATE where ID = ?';
...



perl DBI is adding a special <*> symbol group to the statement and that is causing the error



You have this completely wrong, I'm afraid. Firstly, it's not Perl that is adding the symbols, it's the Oracle query compiler. And secondly, those symbols are not causing the error, they are showing you where Oracle thinks the error is.



Look more closely at the error message. It says:



DBD ERROR: error possibly near <*> indicator



The word "indicator" is your clue. It has been added to "indicate" where the error it.



As you've already been told, the solution is to remove the unnecessary parentheses from your query.



Precision and accuracy are important parts of being a professional programmer. You need to get used to reading and understanding error messages - not just leaping on the first possible explanation that comes to mind.





"Precision and accuracy are important parts of being a professional programmer" Very much so. It's something that's lost on the "How can I become a programming expert in three months" brigade.
– Borodin
Aug 6 at 11:13





Someone disagrees. I got a downvote :-)
– Dave Cross
Aug 6 at 14:45





Probably a drunken code hooligan. You have eight up votes to make up for it.
– Borodin
Aug 6 at 21:05






Re "You need to get used to reading and understanding error messages - not just leaping on the first possible explanation that comes to mind.", ...especially when that explanation involves blaming the tool. It's almost never the tool!
– ikegami
Aug 7 at 4:56







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS