I wish to execute the following type of code in sqlite3:
drop table x if (select y from z where col1 = "a");
Essentially execute DDL commands IF certain values exist currently in the same database.
Any ideas?
A sqlite shell script:
.bail ON
SELECT CASE COUNT(*)
WHEN 0 THEN 1/0 -- will throw
ELSE 1
END
FROM z
WHERE col1 = 'a';
DROP TABLE x;
Run it with sqlite the_database < the_script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With