Solved

Oracle insert with select and nextval

Posted on 2009-07-12
2
2,303 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now