Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Try catch in MYSQL Stored procedures

Try catch in MYSQL Stored procedures

Scheduled Pinned Locked Moved Database
databasemysqlhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PeriyasamyRamachandran
    wrote on last edited by
    #1

    Hi All, I am new in MYSQL Database. I am using the interface SQLYog tool. I just want simple stored procedure with INSERT query and it should be handled exception handling(Try-catch). If the records are inserted in a table then the procedure should return 1. If the records are not inserted(because Exception may occured) then the procedure should return 0. Cau anybody help me? Please.. Thanks, Periyasamy Ramachandiran.

    N 1 Reply Last reply
    0
    • P PeriyasamyRamachandran

      Hi All, I am new in MYSQL Database. I am using the interface SQLYog tool. I just want simple stored procedure with INSERT query and it should be handled exception handling(Try-catch). If the records are inserted in a table then the procedure should return 1. If the records are not inserted(because Exception may occured) then the procedure should return 0. Cau anybody help me? Please.. Thanks, Periyasamy Ramachandiran.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      See this[^] setting handlers. To see the insertion/updation/deletion failure/success status, check row_count(). Something like,

      --your insert query
      IF (row_count()[^]> 0) THEN
      --insertion success
      ELSE
      ..failure

      Navaneeth How to use google | Ask smart questions

      P 1 Reply Last reply
      0
      • N N a v a n e e t h

        See this[^] setting handlers. To see the insertion/updation/deletion failure/success status, check row_count(). Something like,

        --your insert query
        IF (row_count()[^]> 0) THEN
        --insertion success
        ELSE
        ..failure

        Navaneeth How to use google | Ask smart questions

        P Offline
        P Offline
        PeriyasamyRamachandran
        wrote on last edited by
        #3

        Navaneeth, Thanks for your reply. Let me try this. -Periyasamy Ramachandiran.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups