1

I'm trying this query, but it's not working

insert into REGIONS(region_name) values ('SOUTH_AFRICA') , ('NORTH_AFRICA');
4
  • it should be as below insert into REGIONS(region_name) values ('SOUTH_AFRICA'); insert into REGIONS(region_name) values ('NORTH_AFRICA'); Commented May 3, 2019 at 18:19
  • I know that but I'm required to use only one INSERT statment Commented May 3, 2019 at 18:21
  • Weird that Oracle doesn't support this syntax. Commented May 3, 2019 at 18:25
  • @JacobH unfortunately 11g doesn't support it Commented May 3, 2019 at 18:33

1 Answer 1

1

You can use INSERT INTO with SELECT as below:

INSERT INTO REGIONS (region_name) 
SELECT 'SOUTH_AFRICA' FROM DUAL
UNION
SELECT 'NORTH_AFRICA' FROM DUAL
Sign up to request clarification or add additional context in comments.

12 Comments

" ERROR at line 3: ORA-00923: FROM keyword not found where expected "
I got this error message
it's not working , "FROM keyword not found where expected"
@ToqaYousri Can you try to updated answer
Seems you have a not null column named REGION_ID, so it is not allowing insert. You can include the column in the insert into and add the value for the same in the select
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.