Follow this procedure if exists return the result 2 else result is 1.
DROP PROCEDURE insert_or_Update;
delimiter $$
create procedure insert_or_Update()
begin
IF NOT EXISTS (select * from transactionheadbalance where IsCanceled=5) THEN
SELECT 1;
ELSE
SELECT 2;
END IF;
end $$
delimiter ;
CALL insert_or_Update();
RESULT:
Mysql If exists create and Drop the table.
If exists create the table.
CREATE TABLE IF NOT EXISTS Test ( id int, name varchar(80))
If Exists drop the table.
DROP TABLE IF EXISTS Test
0 Comments