MySQL Forums
Forum List  »  Stored Procedures

Re: procedure with if
Posted by: Peter Brawley
Date: April 18, 2019 01:52PM

New syntax errors, and the sproc is still unsound for reasons given.

DDL code should not be mixed with DML code. Once DDL is verified, the DML which this sproc tries inefficiently and cumbersomely to implement is accomplished simply & efficiently with ...

Insert Into reg_conbp (`new_conbp_numerocc`, `new_conbp_rutprov`, `new_conbp_serie`, `new_conbp_fecha`, 
                       new_conbp_monto`, `new_conbp_numcheq`, `new_conbp_nummov`, `new_conbp_numfac`) 
  Select 
    conbp_numerocc, conbp_rutprov, conbp_serie, conbp_fecha, 
    conbp_monto, conbp_numcheq, conbp_nummov, conbp_numfac 
  From tbl_conbp 
  Where `conbp_monto`!= 0;

One last point. MySQL on Linux is case-sensitive, and blocks of capitalised text are hard to read, so it's usually best to stick to lower case table and column names, with if you wish keywords proper case or capitalised.



Edited 2 time(s). Last edit at 04/18/2019 04:09PM by Peter Brawley.

Options: ReplyQuote


Subject
Views
Written By
Posted
1126
April 17, 2019 02:06PM
401
April 18, 2019 09:33AM
382
April 18, 2019 12:35PM
Re: procedure with if
381
April 18, 2019 01:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.