小编Ter*_*nce的帖子

mysql存储过程打印错误消息和回滚

我正在尝试编写一个存储过程,首先打印错误消息然后回滚

我尝试了这个,但这不起作用

我能够回滚它,但如果出现错误,它不会打印错误消息

DELIMITER 

CREATE PROCEDURE transaction_sp ()

BEGIN

DECLARE exit handler for sqlexception
BEGIN
-- ERROR
-------------------------------------------------------------------------------------- 
select "error message '%s' and errorno '%d'"------- this part in not working
-------------------------------------------------------------------------------------- 
ROLLBACK;
END;

DECLARE exit handler for sqlwarning
BEGIN
-- WARNING
-------------------------------------------------------------------------------------- 
 select "warning message '%s' and errorno '%d'"------- this part in not working
-------------------------------------------------------------------------------------- 
ROLLBACK;
END;

START TRANSACTION;
-- ADD option 5
INSERT INTO product_option(product_id,option_id,required) VALUES(insertedProductID,5,0);
SET poid = (SELECT LAST_INSERT_ID());
INSERT INTO     product_option_value(product_option_id,product_id,option_id,option_value_id,quantity,subtract,price,pr ice_prefix,points,points_prefix,weight,weight_prefix)    VALUES(poid,insertedProductID,5,50,0,0,4.99,'+',0,'+',0,'+');

-- ADD option …
Run Code Online (Sandbox Code Playgroud)

mysql stored-procedures

5
推荐指数
2
解决办法
9454
查看次数

mysql select * 其中像当前日期

我尝试了这个,但为什么这不起作用它也没有给我任何错误

select * from table where timestamp_field like '%select year(now())-select month(now())-select day(now())%'
Run Code Online (Sandbox Code Playgroud)

mysql

2
推荐指数
1
解决办法
2477
查看次数

在aws cli中映射数据类型

我想在amazon aws sqs中添加消息到队列

所以我试过这个

root~#  aws sqs send-message --queue-url "queue/url" --message-body "message with attribute" --message-attributes '{"Name": "somename", "Type":"String", "Value":"somevalue"}'
Run Code Online (Sandbox Code Playgroud)

它给了我这个错误

'unicode' object has no attribute 'keys'
Run Code Online (Sandbox Code Playgroud)

但如果我--message-attributes从命令中删除该部分

 root~#  aws sqs send-message --queue-url "queue/url" --message-body "message with attribute"
Run Code Online (Sandbox Code Playgroud)

然后它完美无缺

http://docs.aws.amazon.com/cli/latest/reference/sqs/send-message.html

我猜它是地图类型如何以地图格式发送此参数

--message-attributes (map)

amazon-sqs amazon-web-services aws-cli

1
推荐指数
1
解决办法
991
查看次数

CRON 作业错误 /usr/bin/env: 节点: 没有这样的文件或目录

我在 cron 作业中收到此错误

 /usr/bin/env: node: No such file or directory
Run Code Online (Sandbox Code Playgroud)

所以我这样做了

 */10 * * * * . $HOME/.bashrc sh /path/to/cronjob.sh
Run Code Online (Sandbox Code Playgroud)

在我的 cron 工作中

但随后它给了我这个错误

 /etc/cron.daily/man-db:
 /usr/bin/mandb: can't set the locale; make sure $LC_* and $LANG are correct
Run Code Online (Sandbox Code Playgroud)

shell cron node.js

0
推荐指数
1
解决办法
5315
查看次数