create sequence student_studentid_seq
increment by 10
start with 100
nocycle;
create table student
(studentid number(10),
name varchar2(30) not null,
ss# number(9) unique,
gpa number(2,3) not null,
constraint student_studentid_pk PRIMARY KEY (studentid),
constraint student_gpa_ck CHECK (GPA >= 0));
insert into student (studentid, name, ss#, gpa)
values(student_studentid_seq.NEXTVAL,'Draze Katan', 323456789,1);
receiving error message:
Error starting at line 29 in command:
insert into student (studentid, name, ss#, gpa)
values(student_studentid_seq.NEXTVAL,'Draze Katan', 323456789,1)
Error report:
SQL Error: ORA-01438: value larger than specified precision allowed for this column
01438. 00000 - "value larger than specified precision allowed for this column"
*Cause: When inserting or updating records, a numeric value was entered
that exceeded the precision defined for the column.
*Action: Enter a value that complies with the numeric column's precision,
or use the MODIFY option with the ALTER TABLE command to expand
the precision.
エラーメッセージは次の制約のために表示されます:constraint student_gpa_ck CHECK(GPA> = 0)); insert文でGPA rawに '0'を入力すると、rawが挿入されますが、それ以上の場合はエラーメッセージが表示されます。私はCHECK制約を作成しましたが、エラーメッセージを受け取っています
これは私の運動の質問の1つですが、わかりません。間違いが完全解決ではないヒントが必要です。あなたが私を助けてくれたらどうか。
なぜプライマリキーにnumber(10)を使用していますか?整数でなければなりません。番号は遅いです。 –
@JoeLove番号が遅いですか?いくつかのサポートデータで詳しく説明できますか? – BobC
なぜGPAの 'number(2,3)'ですか?それが問題です(チェック制約ではありません)。それはどういう意味ですか?あなたが3.84と2.33のような数字であることを意味するならば、あなたは 'number(3,2)'が必要です。 3は「3桁の有効数字」を意味し、2は「...最後の2つは小数点以下を意味する」を意味する。 – mathguy