General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 14th, 2004, 09:19 AM
maty maty is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 4 maty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Oracle: Error while replacing a table

Hi there,

I get an error while replacing a table in SQL*Plus Worksheet:

CREATE OR REPLACE TABLE testtable (a INTEGER);
*
FEHLER in Zeile 1:
ORA-00922: Fehlende oder ungültige Option

(in english: Error in line 1, missing or invalid option)

What's wrong? Is there another way for getting a table replaced?

Regards: Mirko

Reply With Quote
  #2  
Old May 14th, 2004, 02:06 PM
michlmann michlmann is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 56 michlmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
AFAIK:
There is no CREATE OR REPLACE TABLE statement.

DROP TABLE testtable;
CREATE TABLE testtable(a INTEGER);

... would be the right way.

Reply With Quote
  #3  
Old May 14th, 2004, 02:35 PM
maty maty is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 4 maty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wow... I didn't realize, that the batch doesnt stop if the table doesn't exist. Thanks.

I'm a bloody beginner with oracle and I have another question:

I created a sequence, lets say scott.my_sequence. Is there a select statement which gives me the next value of the sequence?

select next_val from scott.my_sequence;

doesn't do the job....

Thanks for your answer.

Reply With Quote
  #4  
Old May 14th, 2004, 07:17 PM
michlmann michlmann is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 56 michlmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Use the dual table:

SELECT my_sequence.NEXTVAL FROM dual;

But be awared: every time you select the next value, the sequence gets updated (incrementing it's value). You may select the current value of a sequence using my_sequence.CURRVAL. Before you can use CURRVAL you have to first (once) initialize the sequence with NEXTVAL.

Reply With Quote
  #5  
Old May 17th, 2004, 05:56 PM
maty maty is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 4 maty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Many thanks for your answer. I wonder, how someone can find such an information in the online databases at the otn... after your answer it was not a big deal to find an article about the dual table and its purpose.
Thanks again.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Oracle: Error while replacing a table


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 4 hosted by Hostway
Stay green...Green IT