MySQL stored procedures and (Java calls)

Source: Internet
Author: User

Create procedure deletedatabypdfdocid (   in pdfdocid varchar ()) BEGIN# Delete data based on Pdfdocid delete from pdf_formula where pdf_docid = pdfdocid ;D elete  FROM pdf_image WHERE PDF_DOCID = pdfDocId ;D elete from pdf_table  WHERE PDF_DOCID = pdfDocId ;D elete from pdf_paragraph where pdf_ docid = pdfdocid ;D elete from pdf_addendum_section where pdf_docid =  pdfDocId ;D Elete from pdf_addendum_chapter where pdf_docid = pdfdocid  ;D elete from pdf_addendum where pdf_docid = pdfdocid ;D elete  from pdf_section where pdf_docid = pdfdocid ;D Elete from pdf_backcover  WHERE PDF_DOCID = pdfDocId ;D elete from pdf_catalog where pdf_ Docid = pdfdocid ;D elete from pdf_chapter where pdf_docid = pdfdocid ;D elete  from pdf_coverpage where pdf_docid = pdfdocid ;D elete from pdf_ descriptioin_info where pdf_docid = pdfdocid ;D Elete from pdf_foreword  WHERE PDF_DOCID = pdfDocId ;D elete from pdf_introduction where  pdf_docid = pdfdocid ;D elete from pdf_maintext where pdf_docid =  pdfdocid ;D elete from pdf_modify_details where pdf_docid = pdfdocid ;D elete from pdf_reference_doc where pdf_docid = pdfdocid ;D ELETE FROM  standard_formal_catalogstructure WHERE PDF_DOCID = pdfDocId ;D Elete from  standard_formal_element WHERE PDF_DOCID = pdfDocId ;D elete from  Standard_samples_notes where PDF_DOCID = pdfDocId ;D elete from pdf_document where id =  Pdfdocid;delete from lkstcs_operations_log where pdf_docid = pdfdocid;delete  FROM standard_complie_record WHERE PDF_DOCID = pdfDocId ; Endcreate procedure updatepdfelementstdno (   in stdno varchar (),    in oldstdno varchar (begin#) Update standard number Update pdf_addendum set standard_no  = stdNo WHERE STANDARD_NO = oldStdNo; update pdf_addendum_chapter set standard_no = stdno where standard_no  = oldstdno; update pdf_addendum_section set standard_no = stdno where standard_no  = oldstdno; update pdf_backcover set standard_no = stdno where standard_no =  Oldstdno; Update pdf_catalog set&nbSp standard_no = stdno where standard_no = oldstdno; update pdf_chapter set standard_no = stdno where standard_no =  Oldstdno; update pdf_coverpage set standard_no = stdno where standard_no =  Oldstdno; Update pdf_descriptioin_info set standard_no = stdno where standard_no  = oldStdNo; update pdf_foreword set standard_no = stdno where standard_no =  Oldstdno; update pdf_formula set standard_no = stdno where standard_no =  Oldstdno; update pdf_image set standard_no = stdno where standard_no =  Oldstdno; update pdf_introduction set standard_no = stdno where standard_no =  oldStdNo; Update pdf_maintext set standard_no = stdno where&nbsP standard_no = oldstdno; update pdf_modify_details set standard_no = stdno where standard_no =  oldStdNo; update pdf_paragraph set standard_no = stdno where standard_no =  Oldstdno; update pdf_reference_doc set standard_no = stdno where standard_no =  oldStdNo; update pdf_section set standard_no = stdno where standard_no =  Oldstdno; update pdf_table set standard_no = stdno where standard_no =  Oldstdno; update standard_formal_catalogstructure set standard_no = stdno where  standard_no = oldstdno; Update standard_formal_element set standard_no = stdno where standard_no  = oldStdNo; Update pdf_document set standard_no = stdno where standard_no = oldstdno; Update standard_complie_record set standard_no = stdno where standard_no  = oldStdNo; END


The above two pieces of code are stored procedures for updating and deleting data,

Call:

public void Update (string sNo1, String sNo2) {

String updatesql= "{call Updatepdfelementstdno(?,?)}"; /The name of the stored procedure

GetSession (). Createsqlquery (Updatesql). setString (0, SNo1). setString (1, SNo2). Executeupdate ();

}

This article from "Shihou" blog, declined reprint!

MySQL stored procedures and (Java calls)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.