Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

SQL - Insert Into . . . .

Thread Tools
 
Search this Thread
 
Old Aug 27, 2002 | 02:38 PM
  #1  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Unhappy

I'm stuck !!

Syntax has got me stumpted. I need to copy the values of a tables' field called "barcode" into another tables' barcode field. They need to be created as new records.

How do I do this in Oracle SQL ?

Something like:

insert into long051002010.barcode values(select barcode from boxes051002) ????

[Edited by DJ Dunk - 8/27/2002 2:41:19 PM]
Reply
Old Aug 27, 2002 | 02:51 PM
  #2  
GaryK's Avatar
GaryK
Scooby Regular
 
Joined: Sep 1999
Posts: 4,037
Likes: 0
From: Bedfordshire
Lightbulb

Dunk,

I think you just need to drop the VALUES clause:

INSERT INTO <table> (SELECT ....)

Not at a machine where can I try it.

Gary
Reply
Old Aug 27, 2002 | 03:03 PM
  #3  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Thumbs up

Thanks Gary that sorted it

. . . kind of. The table has a not-null column in it, going to need more work methinks
Reply
Old Aug 27, 2002 | 03:11 PM
  #4  
GaryK's Avatar
GaryK
Scooby Regular
 
Joined: Sep 1999
Posts: 4,037
Likes: 0
From: Bedfordshire
Post

Dunk

you could try including a literal value in the SELECT to populate the NOT NULL column, depends if you need the data to be specific so

INSERT INTO <table> (SELECT col1, "literal" AS col2, col3, etc.)

worth a go

Gary
Reply
Old Aug 27, 2002 | 03:17 PM
  #5  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Thumbs up

Will give it a go. The not-null values will be overwritten afterwards anyway.

Thanks for the help, most appreciated

Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
ATWRX
Full Cars Breaking For Spares
88
Feb 1, 2016 07:28 PM
Lukesaunders91
Member's Gallery
19
Oct 11, 2015 11:07 PM
Ganz1983
Subaru
5
Oct 2, 2015 09:22 AM
2pot
Suspension
0
Sep 21, 2015 04:54 PM
astraboy
ScoobyNet General
6
May 2, 2001 08:10 AM




All times are GMT +1. The time now is 10:22 AM.