mysql-error-1064

MySQL trigger definition - 1064 error

蹲街弑〆低调 提交于 2020-07-09 17:17:39
问题 My proposed trigger: #START TRIGGER delimiter // DECLARE msg VARCHAR(255); CREATE TRIGGER passStandard_check BEFORE INSERT ON Module FOR EACH ROW BEGIN IF NEW.passStandard < 0 || NEW.passStandard > 1 THEN set msg = concat('Trigger Error: Pass Standard: ', cast(NEW.passStandard as char)); signal sqlstate '45000' set message_text = msg; END // delimiter ; #END TRIGGER But I get the following error: Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your

MySQL trigger definition - 1064 error

让人想犯罪 __ 提交于 2020-07-09 17:17:27
问题 My proposed trigger: #START TRIGGER delimiter // DECLARE msg VARCHAR(255); CREATE TRIGGER passStandard_check BEFORE INSERT ON Module FOR EACH ROW BEGIN IF NEW.passStandard < 0 || NEW.passStandard > 1 THEN set msg = concat('Trigger Error: Pass Standard: ', cast(NEW.passStandard as char)); signal sqlstate '45000' set message_text = msg; END // delimiter ; #END TRIGGER But I get the following error: Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your

how to count with more than 1 having clause mysql

非 Y 不嫁゛ 提交于 2020-06-17 14:28:29
问题 i have 1 table called order_star_member, which contain createdAt as the date of the transaction, users_id as the buyer, total_price_star_member as the amount of the transaction. on this case i want to find out buyer who had star member (transaction in a month within >= 600000) and find out where they coming from, the data(dummy) for order_star_member begin on January 2019 untill March 2019 CREATE TABLE order_star_member ( users_id INT, createdAt DATE, total_price_star_member DECIMAL(10,2) );

Mysql making --secure-file-priv option to NULL

半世苍凉 提交于 2020-01-24 12:00:07
问题 I am running MySQL in Ubuntu. I getting this error while running specific set of queries. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement When I did SELECT @@secure_file_priv; in my mysql server I got /var/lib/mysql-files/ . I think I need to make this to NULL . This is the query I am running: LOAD DATA INFILE :file INTO TABLE test_files COLUMNS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'; Now the question is how to make this

How to convert/cast varchar to date?

余生长醉 提交于 2020-01-12 10:17:07
问题 I have a date column with data type varchar(mm-dd-yyyy) in mySQL 5.1. How do I convert it to DATE? Here is what I have so far - SELECT id, date FROM tableName WHERE (CAST((SUBSTRING (date FROM 7 FOR 4 )||'/'||SUBSTRING (date FROM 4 FOR 2 )||'/'||SUBSTRING (date FROM 1 FOR 2 )) AS DATE) >= '01/01/2012' ) ORDER BY date DESC; Getting this error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM 7

MySQL Decimal DataType - Truncating Insert Values With Commas?

前提是你 提交于 2020-01-11 13:49:11
问题 I have a MySQL field that is of the type Decimal(12,2). Upon using the following query to get an insert, I'm not getting the correct value stored. INSERT INTO table (someValue) VALUES ('1,200'); This, instead of displaying "1200.00" in the decimal field "someValue", is displaying "1.00" - truncating the data after the first comma. My questions are, why does MySQL have this behavior, and is there a simple way to get around it? 回答1: if your value is read from some HTML form and you can't avoid

No operations allowed after statement closed

有些话、适合烂在心里 提交于 2020-01-10 20:05:32
问题 I am getting the Exception with the signature No operations allowed after statement closed. inside my Java code where I am trying to insert values into the database. The error signature says that my Statement object gets closed and I am trying to use it again in my code , but what I am struggling to understand is why is this happening as I am not closing any connections anywhere in my code. Here is the Java code. public class DataBaseAccessUtils { private static String jdbcUrl = AppConfig

MySQL error - “You have an error in your SQL syntax”

坚强是说给别人听的谎言 提交于 2020-01-09 11:41:51
问题 The error message I got: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''word','group','selfnote') VALUES ('item','a','note to self')' at line 1 The PHP code is: $toq="INSERT INTO articles ('word','group','selfnote') VALUES ('$ttle','$wrdr','$snote')"; I was trying to find solutins, but they didn't seem to work as echoing gives: INSERT INTO articles ('word','group','selfnote') VALUES ('item','a','note to