Link to home
Start Free TrialLog in
Avatar of czechmate1976
czechmate1976Flag for United Kingdom of Great Britain and Northern Ireland

asked on

ORACLE SQL DEVELOPER reports error

Can anyone help me find an error in this query please, I am trying to insert multiple rows at once but the blimming thing won't let me, saying the SQL command is not properly ended!! I am going mad here. Thanks for saving my sanity.

Please see the example in the code snippet.


INSERT INTO customer(
custid, firstname, lastname, houseno, street, city, postcode, telnum, email, county
) VALUES (
100012, 'Sergio', 'Fish', '34', 'Johny Walker Av', 'Kingston', 'K2 5OP', '02080987456', 'walkerJohn@bt.com', 'surrey' 
) , (
100013, 'Georg', 'Hanz', '12', 'Fishmongers Lane', 'Brighton', 'B2 0YU', '01940123456', 'hanzie@talktalk.co.uk', 'Kent');

Open in new window

Avatar of thenelson
thenelson

Try removing:
, (
100013, 'Georg', 'Hanz', '12', 'Fishmongers Lane', 'Brighton', 'B2 0YU', '01940123456', 'hanzie@talktalk.co.uk', 'Kent')

to change the query to:

INSERT INTO customer(custid, firstname, lastname, houseno, street, city, postcode, telnum, email, county) VALUES (100012, 'Sergio', 'Fish', '34', 'Johny Walker Av', 'Kingston', 'K2 5OP', '02080987456', 'walkerJohn@bt.com', 'surrey');

Does the query have carriage returns or did posting to EE add those?
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thenelson, removing ( does not solve the issue ;)
I guess he is trying to insert two records...
"I guess he is trying to insert two records..."
I figured that. It is not supported in Access or SQL server - wasn't sure about Oracle. Never thought about using a Union statement in an append query - Thanks!
Avatar of czechmate1976

ASKER

I am trying to insert multiple rows into a table using Oracle SQLdeveloper but it didn't work in any way.. I know that in mysql I could insert numerous records without these extra tags 'SELECT FROM DUAL UNION'.. but here it doesn't work the same..  


INSERT all
INTO customer(custid, firstname, lastname, houseno, street, city, postcode, telnum, email, county)
VALUES (100012, 'Sergio', 'Fish', '34', 'Johny Walker Av', 'Kingston', 'K2 5OP', '02080987456', 'walkerJohn@bt.com', 'surrey')
INTO CUSTOMER(100013, 'Georg', 'Hanz', '12', 'Fishmongers Lane', 'Brighton', 'B2 0YU', '01940123456', 'hanzie@talktalk.co.uk', 'Kent')
SELECT 1 FROM DUAL;
try this

insert into ...
(
select ... from dual
union
select ... from dual
)

or even this

insert into ...
select * from
(
select ... from dual
union
select ... from dual
) x

Thanks for your help!