user2659722
user2659722

Reputation:

error getting while inserting multiple rows in sql

my table

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

inserting query:

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

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

Upvotes: 0

Views: 2626

Answers (1)

phoenixgr
phoenixgr

Reputation: 186

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.

EDIT: Since you are using oracle see if this is helpful.

Upvotes: 1

Related Questions