Solved

Oracle insert with select and nextval

Posted on 2009-07-12
2
2,307 Views
Last Modified: 2012-05-07
Hi,

I have a simple insert question for 10g.

I have an insert and want to use a select from another table and nextval.

This returns an error...missing expression

Thanks
Phil




insert into zipcode_usa_canada (
ZIPCODE_ID,
ZIPCODE,
ZIP_TYPE,
ZIP_CITYNAME,
ZIP_CITYTYPE,
ZIP_STATENAME,
ZIP_STATEABBR,
ZIP_AREACODE,
LATITUDE,
LONGITUDE)
values (
select ZIPCODE_USA_CANADA_SEQ.nextval,
POSTALCODE, 
POSTALTYPE, 
CITYNAME, 
CITYTYPE, 
PROVINCENAME, 
PROVINCEABBR,  
AREACODE, 
LATITUDE, 
LONGITUDE
from ZIP_USA_CANADA_2009
where upper(citytype) = 'D' 
)

Open in new window

0
Comment
Question by:nohacks
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24833516
remove the values
insert into zipcode_usa_canada (
ZIPCODE_ID,
ZIPCODE,
ZIP_TYPE,
ZIP_CITYNAME,
ZIP_CITYTYPE,
ZIP_STATENAME,
ZIP_STATEABBR,
ZIP_AREACODE,
LATITUDE,
LONGITUDE)
select ZIPCODE_USA_CANADA_SEQ.nextval,
POSTALCODE, 
POSTALTYPE, 
CITYNAME, 
CITYTYPE, 
PROVINCENAME, 
PROVINCEABBR,  
AREACODE, 
LATITUDE, 
LONGITUDE
from ZIP_USA_CANADA_2009
where upper(citytype) = 'D' 

Open in new window

0
 

Author Closing Comment

by:nohacks
ID: 31602537
Thanks for the quick response...
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question