Oracle Data Types

Context: FIT2094_MOC · the four column types allowed in this unit · chosen per attribute in a CREATE TABLE · the physical realisation of a domain

Quick Revision

  • 🎯 Objective: pick one of per column ➔ fix storage + valid values.
  • ⚡ Key Constraint: is fixed-width, space-padded; is variable — wrong choice wastes space or mis-compares.

📝 Core

  • ➔ fixed -char text, padded with spaces; 'Apple' in stored as 'apple '. Use for known-length codes.
  • ➔ up to chars, stored as-is (no padding); 'Apple' stays 'apple'. Default for names/free text.
  • = total digits (precision), = decimal digits (scale, optional); before-point digits .
  • ➔ date + time to the second (Gregorian), e.g. 10-Mar-2026 14:32:18; stored numerically ➔ two dates subtract to a day count.

NUMBER examples:

DeclarationRange / formExample
(= )
5 digits before point, 2 after
3 digits before point, 1 after

⚠️ Common Mistakes

  • 💡 padding breaks equality/joins ➔ a padded 'apple ' may not match an unpadded 'apple'; reserve for genuinely fixed-length codes.
  • 💡 Scale eats precision ➔ in the integer part holds only digits, so maxes at , not .

🧠 Active Recall