Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting multiple values with Oracle Insert Into...Values

I am trying to run the following command in Oracle 11g but keep getting an error of 'commmand not properly ended'. I am new to Oracle and I haven't been able to find anything about insert multiple value sets (unless they are selected from a table which in this case they are not)....

INSERT INTO category (catcode, catdesc)
VALUES ('BUS', 'BUSINESS'),
    ('CHN', 'CHILDREN'),
    ('COK', 'COOKING'),
    ('COM', 'COMPUTER'),
    ('FAL', 'FAMILY LIFE'),
    ('FIT', 'FITNESS'),
    ('SEH', 'SELF HELP'),
    ('LIT', 'LITERATURE'),
    ('CHN', 'CHILDREN'),
    ('BUS', 'BUSINESS');

If this syntax is completely off, then how can I insert multiple values in one statement?

like image 798
codingManiac Avatar asked Aug 14 '26 11:08

codingManiac


1 Answers

Try like this,

INSERT ALL 
     INTO category (catcode, catdesc) VALUES ('BUS', 'BUSINESS')
     INTO category (catcode, catdesc) VALUES ('CHN', 'CHILDREN')
     INTO category (catcode, catdesc) VALUES ('COK', 'COOKING')
     INTO category (catcode, catdesc) VALUES ('COM', 'COMPUTER')
     INTO category (catcode, catdesc) VALUES ('FAL', 'FAMILY LIFE')
     INTO category (catcode, catdesc) VALUES ('FIT', 'FITNESS')
     INTO category (catcode, catdesc) VALUES ('SEH', 'SELF HELP')
     INTO category (catcode, catdesc) VALUES ('LIT', 'LITERATURE')
     INTO category (catcode, catdesc) VALUES ('CHN', 'CHILDREN')
     INTO category (catcode, catdesc) VALUES ('BUS', 'BUSINESS')
SELECT * FROM DUAL;

Refer here for more in detail.

like image 98
Dba Avatar answered Aug 16 '26 23:08

Dba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!