Solved

Oracle insert with select and nextval

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

695 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