B
breezy_7909
Unregistered / Unconfirmed
GUEST, unregistred user!
我在oracle中动态生成表后,在数据库中也看见了创建的表(如表名为‘aa’,但通过
select * from aa 访问 出错,显示为oracle错误:ORA-00942表或视图不存在,有时报ORA-00903表名无效。请高手指点。相应程序段如下:
procedure TForm1.BtnAddTableClick(Sender: TObject);
var AddStandN, SqlStr:String;
begin
AddStandN:=Edittablename.Text;
with ADOQueryTemp do
begin
Sql.Clear;
SqlStr:='CREATE TABLE "METADB"."'+AddStandN+'"';
SqlStr:=SqlStr+' ( "METAID" NUMBER(10) NOT NULL, ';
SqlStr:=SqlStr+' "NAME" VARCHAR2(20) NOT NULL, ';
SqlStr:=SqlStr+' "TITLE" VARCHAR2(20) NOT NULL, ';
SqlStr:=SqlStr+' "TYPE" VARCHAR2(20), ';
SqlStr:=SqlStr+' "DEFINE" VARCHAR2(400), ';
SqlStr:=SqlStr+' "QULIFIER" VARCHAR2(50), ';
SqlStr:=SqlStr+' "COMMENT" VARCHAR2(400), ';
SqlStr:=SqlStr+' "BELONGSTAND" VARCHAR2(40) )';
Sql.Add(SqlStr);
ExecSql;
end;
messagebox(Handle,'表已创建!','系统提示',MB_OK+MB_ICONINFORMATION);
end;
另外,数据库中已创建的表是可以正常显示的。
select * from aa 访问 出错,显示为oracle错误:ORA-00942表或视图不存在,有时报ORA-00903表名无效。请高手指点。相应程序段如下:
procedure TForm1.BtnAddTableClick(Sender: TObject);
var AddStandN, SqlStr:String;
begin
AddStandN:=Edittablename.Text;
with ADOQueryTemp do
begin
Sql.Clear;
SqlStr:='CREATE TABLE "METADB"."'+AddStandN+'"';
SqlStr:=SqlStr+' ( "METAID" NUMBER(10) NOT NULL, ';
SqlStr:=SqlStr+' "NAME" VARCHAR2(20) NOT NULL, ';
SqlStr:=SqlStr+' "TITLE" VARCHAR2(20) NOT NULL, ';
SqlStr:=SqlStr+' "TYPE" VARCHAR2(20), ';
SqlStr:=SqlStr+' "DEFINE" VARCHAR2(400), ';
SqlStr:=SqlStr+' "QULIFIER" VARCHAR2(50), ';
SqlStr:=SqlStr+' "COMMENT" VARCHAR2(400), ';
SqlStr:=SqlStr+' "BELONGSTAND" VARCHAR2(40) )';
Sql.Add(SqlStr);
ExecSql;
end;
messagebox(Handle,'表已创建!','系统提示',MB_OK+MB_ICONINFORMATION);
end;
另外,数据库中已创建的表是可以正常显示的。