Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql stored procedure insert if not exists

DELIMITER //

CREATE PROCEDURE `intoBooksQty`(`newcallNumber` VARCHAR(10))
BEGIN
  INSERT INTO `bookqty` (`callNumber`, `bookQty`, `bookqtyOut`)
  SELECT `newcallNumber`, 1, 0
  FROM `books`
  WHERE `callNumber` = `newcallNumber`
    ON DUPLICATE KEY UPDATE `bookQty` = `bookQty` + 1;
END//

DELIMITER ;
Comment

PREVIOUS NEXT
Code Example
Sql :: change column in mysql 
Sql :: psql invalid command N 
Sql :: query to get all primary keys and foreign key 
Sql :: into in sql 
Sql :: psql: error: FATAL: database "odoo" does not exist 
Sql :: less than and between in sql query 
Sql :: list all functions and procedures in postgres query 
Sql :: T-SQL and the WHERE LIKE %Parameter% clause 
Sql :: sql interview questions for testers 
Sql :: what does leave do in mysql 
Sql :: function plsql 
Sql :: foreign key sql 
Sql :: mysql begin statement 
Sql :: how use trigger in sql 
Sql :: mysql privileges 
Sql :: sql change primary key to composite key 
Sql :: postgres backup of table 
Sql :: postgres enumerated type 
Sql :: oracle sql distinct vs unique 
Sql :: column with prefix in sql 
Sql :: TSQL convert csv to table 
Sql :: SQL Using Prepared Statements 
Sql :: sql check 
Sql :: postgresql comandos basicos 
Sql :: current month transactions in mysql 
Sql :: SQL Comments With Statements 
Sql :: sql int vs integer 
Sql :: 5000/208 
Sql :: configurer mysqlwampserver a distance 
Sql :: SQlite script 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =