You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ORA-00907错误求助:排查CREATE TABLE语句语法问题

Fixing Your ORA-00907 Error in the CREATE TABLE Statement

Hey there, I see you've been stuck on this ORA-00907 error for an hour—let's get this sorted out quickly!

The root cause here is how you're using the LONG data type in your table definition. Here's the breakdown:

  • Oracle's LONG type does not accept a length parameter (the numbers in parentheses like (10000) are invalid here).
  • Even worse, LONG is a deprecated type in Oracle—Oracle recommends using CLOB for large text data instead. But wait, looking at your field names (travel_allowance, housing_allowance, PF, etc.), these are all numeric values (salary components), so using a numeric data type like NUMBER makes way more sense than any text type!

Here's the corrected CREATE TABLE statement tailored to your use case:

CREATE TABLE salary_details (
    emp_id NUMBER(2),
    travel_allowance NUMBER(10, 2), -- 10 digits total, 2 for cents (adjust precision as needed)
    housing_allowance NUMBER(12, 2),
    PF NUMBER(12, 2),
    account_no NUMBER(15), -- If account numbers need leading zeros preserved, use VARCHAR2(20) instead
    Total_sal NUMBER(12, 2)
);

A quick note on account_no: If your account numbers might include leading zeros that need to stay intact (like some bank account formats), swap NUMBER(15) with VARCHAR2(20)—numeric types automatically drop leading zeros, which could break your data integrity.

If you ever do need to store large text data in the future, remember to use CLOB instead of LONG, like this:

some_large_text_field CLOB

内容的提问来源于stack exchange,提问作者Humaid Kidwai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:08:30