Results 1 to 7 of 7

Thread: SQL stored procedure can be called only 1 time !?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2017
    Posts
    23
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default SQL stored procedure can be called only 1 time !?

    I have the following stored procedure which is executed correctly (in the first time) from MySQL workbench and from my QT application:

    Qt Code:
    1. DROP PROCEDURE IF EXISTS mprocedure;
    2. DELIMITER $$
    3. CREATE PROCEDURE mprocedure()
    4. BEGIN
    5. DECLARE EXIT HANDLER FOR SQLEXCEPTION
    6. BEGIN
    7. ROLLBACK;
    8. SELECT 'An exception occurred';
    9. END;
    10. DECLARE EXIT HANDLER FOR SQLSTATE '23000'
    11. BEGIN
    12. ROLLBACK;
    13. SELECT 'Unique Record Duplication occured, all saved records will be deleted from all other tables';
    14. END;
    15. START TRANSACTION;
    16. INSERT INTO `My_schema`.`cus`(`Health insurance number`,`discount percentage`,`max discount`)VALUES('88520000000000','.9','.99');
    17. INSERT INTO `My_schema`.`per`(`sex`,`Socialstatus`,`firstdate`,`cus_id_cus`)values( 'male', 'single', '2018-01-01 00:00:00', LAST_INSERT_ID());
    18. commit;
    19. END;
    20. $$
    21. DELIMITER ;
    22. call mprocedure();
    To copy to clipboard, switch view to plain text mode 
    but when i tried to execute the previous again, i had 3 cases:
    1. If the call was from MySQL workbench, it gave me the error that is supposed to be received
    Qt Code:
    1. "Unique Record Duplication occurred, all saved records will be deleted from all other tables"
    To copy to clipboard, switch view to plain text mode 
    2. But if the call was from QT app, it should give me the same error but unfortunately gave me nothing.
    3. If i used
    Qt Code:
    1. call mprocedure();
    To copy to clipboard, switch view to plain text mode 
    instead of the whole previous string, it worked well.
    Any help is appreciated
    Last edited by Ahmed Abdellatif; 4th May 2018 at 16:55.

Similar Threads

  1. Stored procedure in Firebird
    By ozplc in forum Qt Programming
    Replies: 0
    Last Post: 9th June 2011, 22:40
  2. Qt4 Mysql stored procedure
    By lynnH in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2010, 08:05
  3. Stored procedure and ODBC
    By filya in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2010, 08:40
  4. problem in using stored procedure
    By zolfaghari in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2010, 08:25
  5. qt how get out parameter of Stored Procedure?
    By yunpeng880 in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2009, 12:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.