Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 30th, 2005, 07:42 AM
Javaholic Javaholic is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 34 Javaholic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 20 m 40 sec
Reputation Power: 4
insert into where column = somevalue

Code:
insert into SJ5752.quadrat_dataplots(HEIGHT,SPECIES,STATE,MORPH)
select HEIGHT,SPECIES,STATE,MORPH from SJ5752.quadrat_dataplots where PLOTID ='plot 1'


Code:
insert into SJ5752.quadrat_dataplots(HEIGHT,SPECIES,STATE,MORPH)
    values('12.5','sg','l','no') where PLOTID = 'plot 1'


I have tried both of the above and both failed to work.

I want to insert only into a row where PLOTID = some value

What can i do?

Reply With Quote
  #2  
Old August 30th, 2005, 07:53 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,917 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 14 h 46 m 3 sec
Reputation Power: 279
Maybe you are trying to update an existing row where PLOTID = 'plot 1' with new values?

Reply With Quote
  #3  
Old August 30th, 2005, 07:55 AM
shammat shammat is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 1,007 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 13 h 19 m 21 sec
Reputation Power: 67
You have to use UPDATE.
INSERT creates a new row, UPDATE is used to modify existing ones

Reply With Quote
  #4  
Old August 30th, 2005, 08:06 AM
Javaholic Javaholic is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 34 Javaholic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 20 m 40 sec
Reputation Power: 4
Quote:
Originally Posted by shammat
You have to use UPDATE.
INSERT creates a new row, UPDATE is used to modify existing ones


Thank you

Reply With Quote
  #5  
Old August 30th, 2005, 09:07 AM
Javaholic Javaholic is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 34 Javaholic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 20 m 40 sec
Reputation Power: 4
I tried:
Code:

update SJ5752.quadrat_dataplots
set (HEIGHT,SPECIES, STATE,MORPH) = (
select HEIGHT,SPECIES,STATE,MORPH from SJ5752.quadrat_dataplots where PLOTID = 'plot 1'
)


but it doesn't have the desired effect, any ideas?

Reply With Quote
  #6  
Old August 30th, 2005, 09:12 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,917 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 14 h 46 m 3 sec
Reputation Power: 279
sql Code:
Original - sql Code
  1. UPDATE SJ5752.quadrat_dataplots
  2. SET HEIGHT = '12.5', SPECIES = 'sg', STATE = 'l', MORPH = 'no'
  3. WHERE PLOTID = 'plot 1';

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > insert into where column = somevalue


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT