OracleORA-00903错误具体原因分析
文章作者 100test 发表时间 2007:03:14 13:37:28
来源 100Test.Com百考试题网
ORA-00903 invalid table name
ORA-00903:无效的表名
Cause A table or cluster name is invalid or does not exist. This message is also issued if an invalid cluster name or no cluster name is specified in an ALTER CLUSTER or DROP CLUSTER statement.
Action Check spelling. A valid table name or cluster name must begin with a letter and may contain only alphanumeric characters and the special characters $, _, and #. The name must be less than or equal to 30 characters and cannot be a reserved word.
原因:表名或簇名不存在或无效,当运行ALTER CLUSTER 或 DROP CLUSTER语句时,会出现此错误信息。
方案:检查拼写是否正确。一个有效的表名或簇名必须以字母开头,只含有字母或数字,不能超过30个字符,可以包含一些特殊字符$, _, #。表名或簇名不能是关键字。
案例一: 使用 DBMS_SQL包执行DDL语句
The DBMS_SQL package can be used to execute DDL statements directly from PL/SQL.
这是一个创建一个表的过程的例子。该过程有两个参数:表名和字段及其类型的列表。
CREATE OR REPLACE PROCEDURE ddlproc (tablename varchar2, cols varchar2) AS
cursor1 INTEGER.
BEGIN
cursor1 := dbms_sql.open_cursor.
dbms_sql.parse(cursor1, CREATE TABLE || tablename || ( || cols || ) ,
dbms_sql.v7).
dbms_sql.close_cursor(cursor1).
End.
/
SQL> execute ddlproc ( MYTABLE , COL1 NUMBER, COL2 VARCHAR2(10) ).
PL/SQL procedure successfully completed.
SQL> desc mytable.
Name Null? Type