Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Oracle Error on Database Creation

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm creating a table that's supposed to hold books.  The foreign key is the authorId and I want it to cascade on delete.  I'm using Oracle 11g.  Whenever I run this I get an error saying: ORA-00905: missing keyword

The tutorials I'm using say the syntax is correct.  This is where I've gone thus far:
http://www.dba-oracle.com/t_constraint_foreign_key.htm
https://www.oracletutorial.com/oracle-basics/oracle-foreign-key/
https://dzone.com/articles/how-to-create-a-foreign-key-on-a-table-in-oracle-s
https://www.youtube.com/watch?v=xDti3Y66Naw

Here's the statement I've written:

 
Saloon Keeper
Posts: 12013
257
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's supposed to be "DOUBLE PRECISION", not double.

Anyway, why are you using floating point types for prices? Can the price of a book be in fractions of cents? Store the price as an integer number of cents.
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or maybe FLOAT, but I agree with Stephan about using integers for prices.  I have seen costs in fractions of a penny, though.
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic