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 27 August 2002, 02:38 PM
  #1  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
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]
Old 27 August 2002, 02:51 PM
  #2  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
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
Old 27 August 2002, 03:03 PM
  #3  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Thumbs up

Thanks Gary that sorted it

. . . kind of. The table has a not-null column in it, going to need more work methinks
Old 27 August 2002, 03:11 PM
  #4  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
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
Old 27 August 2002, 03:17 PM
  #5  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Thumbs up

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

Thanks for the help, most appreciated

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



Quick Reply: SQL - Insert Into . . . .



All times are GMT +1. The time now is 02:48 AM.