确保test表存在
try:
create or replace procedure pro_test as
begin
insert into testmis.test(name,myid) value(1,'1');
commit;
end pro_test;
/
try:
create or replace procedure pro_test as
begin
insert into testmis.test(name,myid) value(1,'1');
commit;
end pro_test;
/
SQL> create or replace procedure test_pro as
2 begin
3 insert into testmis.test(name,myid) values('1','1');
4 commit;
5 end test_pro;
6 /警告: 创建的过程带有编译错误。SQL> show error procedure test_pro;
PROCEDURE TEST_PRO 出现错误:LINE/COL ERROR
-------- -----------------------------------------------------------------
3/2 PLS-00201: 必须说明标识符 'TEST'
3/2 PL/SQL: SQL Statement ignored
SQL>
你的用户可能没有这个表的权限!
connect testmis/password
grant select,insert on test to youruser;
...
as
begin
insert into testmis.test(name,myid) value(1,'1');
commit;
end test;
testmis.test这个表要存在而且当前用户要有修改的权限
SQL> create table testmis.test
2 (
3 name varchar2(50),
4 myid varchar2(50)
5 );表已创建。SQL> alter procedure test_pro compile;警告: 更改的过程带有编译错误。SQL> show error procedure test_pro;
PROCEDURE TEST_PRO 出现错误:LINE/COL ERROR
-------- -----------------------------------------------------------------
3/2 PLS-00201: 必须说明标识符 'TEST'
3/2 PL/SQL: SQL Statement ignored
crete table test (name varchar2(50),myid varchar2(50));create or replace procedure test_pro as
begin
insert into test(name,myid) values('1','1');
commit;
end test_pro;
/
SQL> create table testmis.test
2 (
3 name varchar2(50),
4 myid varchar2(50)
5 );表已创建。
SQL> create or replace procedure testmis.testp
2 as
3 begin
4 insert into testmis.test(name,myid) values('1','1');
5 commit;
6 end;
7 /过程已创建。SQL> alter procedure testmis.testp compile;过程已更改。
SQL> show error procedure testmis.testp;
没有错误。如果是: procedure testp 就会有错误啊
SQL> create or replace procedure testp
2 as
3 begin
4 insert into testmis.test(name,myid) values('1','1');
5 commit;
6 end;
7 /警告: 创建的过程带有编译错误。
看有没有testmis这个用户?
------------------------------ ---------- ----------
SYS 0 14-11月-00
SYSTEM 5 14-11月-00
OUTLN 11 14-11月-00
DBSNMP 16 14-11月-00
AURORA$JIS$UTILITY$ 25 14-11月-00
OSE$HTTP$ADMIN 26 14-11月-00
AURORA$ORB$UNAUTHENTICATED 27 14-11月-00
ORDSYS 28 14-11月-00
ORDPLUGINS 29 14-11月-00
MDSYS 30 14-11月-00
CTXSYS 33 14-11月-00USERNAME USER_ID CREATED
------------------------------ ---------- ----------
SCOTT 35 14-11月-00
ADAMS 36 14-11月-00
JONES 37 14-11月-00
CLARK 38 14-11月-00
BLAKE 39 14-11月-00
MTSSYS 40 14-11月-00
TESTMIS 42 27-5月 -04
而是用户的名字
你创建的表实际上是创建在testmis用户下,你的存储过程如果创建在system用户下(不加testmis.)
当然编译出错(找不到testmis表)
因此存储过程也必须创建在testmis用户下,即create or replace procedure testmis.testp ...