Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Creating Table In Oracle PL/SQL

CREATE TABLE my_employee
(
id INT(4) NOT NULL,
last_name VARCHAR2(25),
first_name VARCHAR2(25),
user_id VARCHAR2(8),
salary INT(9, 2)
)

>Solution :

INT datatype can’t contain precision nor scale (in Oracle):

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SQL> CREATE TABLE my_employee
  2  (
  3     id           INT (4) NOT NULL,
  4     last_name    VARCHAR2 (25),
  5     first_name   VARCHAR2 (25),
  6     user_id      VARCHAR2 (8),
  7     salary       INT (9, 2)
  8  );
   id           INT (4) NOT NULL,
                    *
ERROR at line 3:
ORA-00907: missing right parenthesis

Use NUMBER datatype instead:

SQL> CREATE TABLE my_employee
  2  (
  3     id           NUMBER (4) NOT NULL,
  4     last_name    VARCHAR2 (25),
  5     first_name   VARCHAR2 (25),
  6     user_id      VARCHAR2 (8),
  7     salary       NUMBER (9, 2)
  8  );

Table created.

SQL>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading