使用批量插入时插入空值

编程入门 行业动态 更新时间:2024-10-11 17:28:23
本文介绍了使用批量插入时插入空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一张桌子:

CREATE TABLE cust ( cust_id NOT NULL, cust_name NOT NULL, address NULL );

我必须将这些行插入另一个表:

I have to insert these rows into another table:

CREATE TABLE 1cust_det ( cust_id NOT NULL, cust_name NOT NULL, address NOT NULL );

不幸的是,cust.address列包含NULL值.我想使用光标将这些行从cust插入到1cust_det.我该怎么办?

Unfortunately the cust.address column contains NULL values. I want to insert these rows from cust to 1cust_det using a cursor. What do I have to do?

推荐答案

INSERT INTO cust_det SELECT cust_id, cust_name, COALESCE(address, 'UNKNOWN') FROM cust

更多推荐

使用批量插入时插入空值

本文发布于:2023-10-26 17:50:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530894.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:入时   批量

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!