Solved

Oracle insert with select and nextval

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

Join & Write a Comment

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…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

747 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

12 Experts available now in Live!

Get 1:1 Help Now