I have a database (database1
) and a table imei_db(IMEI VARCHAR(15), db VARCHAR(40))
. I also have other databases (ex: database2
) and I want a trigger that, whe inserting a row on database1
.imei_db
, it verifies before the actual insert if there is a database with a name equal to db
field value.
For example:
Existing databases: database1, database2
Succeeds: INSERT INTO imei_db VALUES ("111222333444555","database2")
Fails: INSERT INTO imei_db VALUES ("111222333444555","database3")