?
Solved

Oracle insert with select and nextval

Posted on 2009-07-12
2
Medium Priority
?
2,313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

765 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