在sql中插入多行时出现错误 [英] error getting while inserting multiple rows in sql

查看:133
本文介绍了在sql中插入多行时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子

CREATE TABLE emp(
   EMP_NO NUMBER, 
   EMP_NAME VARCHAR2(10 BYTE), 
   ADDRESS VARCHAR2(15 BYTE), 
   PH_NO NUMBER(10,0), 
   DPT_NO NUMBER
)

插入查询:

insert into emp (
    emp_no,
    emp_name,
    address,
    ph_no,
    dpt_no) 
  values (100,'mohan','hyd',7569936347,101),
         (101,'ram','ctr',9553438342,102); 

我以这种方式为多个记录插入目的编写了插入查询...但是我遇到了错误,因为"sql命令未完全结束.我不知道如何解决这个问题..any可以帮助我

In this manner i write insert query for multiple records inserting purpose...but i'm getting error as "sql command is not perperly ended.i don't know how to rwsolve this one one..any can help me

推荐答案

假定您在使用2008年之前的sql server.您不能使用此语法分隔行.您可以编写不同的插入命令,也可以使用带有union的select语句将其强制为一个插入命令.

Assuming you are using sql server prior to 2008. You cannot use this syntax to separate the rows. You could write different insert commands or use a select statement using union to force them into one insert command.

由于您使用的是oracle,因此查看是否有帮助.

Since you are using oracle see if this is helpful.

这篇关于在sql中插入多行时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆