hanfengcan opened a new issue, #9596:
URL: https://github.com/apache/dolphinscheduler/issues/9596

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   我在执行SQL任务的时候, 报错`execute sql error: Can not issue data manipulation 
statements with executeQuery()`
   
   数据库使用了Doris
   
   建表和select都可以正常执行
   
   ### What you expected to happen
   
   能够执行insert语句
   
   ### How to reproduce
   
   目标表
   ```
   CREATE TABLE `wx_payment_details` (
     `create_time` datetime NOT NULL COMMENT "创建时间",
     `amount` decimal(12, 4) NULL COMMENT "支付金额",
     `settlement_refund_fee` decimal(12, 4) NULL COMMENT "退款金额",
     `goods_name` varchar(100) NULL COMMENT "商品名称",
     `goods_type` varchar(50) NULL COMMENT "商品类型",
     `transaction_id` varchar(100) NOT NULL DEFAULT "reserve" COMMENT "微信订单号"
   ) ENGINE=OLAP
   DUPLICATE KEY(`create_time`)
   COMMENT "微信订单记录"
   DISTRIBUTED BY HASH(`create_time`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   ```
   源表
   CREATE TABLE `wx_payment_details_load` (
     `create_time` varchar(100) NOT NULL COMMENT "",
     `appid` varchar(100) NOT NULL COMMENT "",
     `mch_id` varchar(100) NOT NULL COMMENT "",
     `mch_id_child` varchar(50) NOT NULL COMMENT "",
     `device_info` varchar(60) NULL COMMENT "",
     `transaction_id` varchar(100) NOT NULL COMMENT "",
     `out_trade_no` varchar(100) NOT NULL COMMENT "",
     `openid` varchar(100) NOT NULL COMMENT "",
     `trade_type` varchar(100) NOT NULL COMMENT "",
     `trade_state` varchar(100) NOT NULL COMMENT "",
     `bank_type` varchar(100) NOT NULL COMMENT "",
     `fee_type` varchar(100) NOT NULL COMMENT "",
     `amount` varchar(50) NOT NULL COMMENT "",
     `enterprise_discounts` varchar(100) NOT NULL COMMENT "",
     `refund_id` varchar(100) NOT NULL COMMENT "",
     `out_refund_no` varchar(100) NOT NULL COMMENT "",
     `settlement_refund_fee` varchar(50) NOT NULL COMMENT "",
     `enterprise_refund_discounts` varchar(100) NOT NULL COMMENT "",
     `refund_type` varchar(100) NULL COMMENT "",
     `refund_status` varchar(100) NULL COMMENT "",
     `goods_name` varchar(100) NOT NULL COMMENT "",
     `attach` varchar(100) NOT NULL COMMENT "",
     `service_charge` varchar(100) NOT NULL COMMENT "",
     `rate` varchar(100) NOT NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`create_time`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`create_time`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   
   将源表中的微信账单处理后写入目标表
   ```
   INSERT into example_db.wx_payment_details SELECT
     CAST ( split_part(create_time, '`', 2) as datetime ) as create_time,
     0 + split_part(amount, '`', 2) as amount,
     0 - split_part(settlement_refund_fee, '`', 2) as settlement_refund_fee ,
     split_part(goods_name, '`', 2) as goods_name,
     CASE goods_name
     when '`门诊' then '门诊缴费'
     when '`诊间支付' then '门诊缴费'
     when '`住院缴费' then '住院缴费'
     when '`住院预交' then '住院缴费'
     else goods_name end as goods_type, 
     split_part(transaction_id, '`', 2) as transaction_id
   FROM fy_payment_db.wx_payment_details_load;
   ``` 
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   2.0.2
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to