免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: gz_xuhaoz
打印 上一主题 下一主题

求助:光标中如何使用同义词 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2007-09-10 14:28 |只看该作者
原帖由 numenhuang 于 2007-9-10 11:27 发表
xxxx,yyyy前分别带上schema名称,再测试


  加上了也不行。

论坛徽章:
0
12 [报告]
发表于 2007-09-10 15:11 |只看该作者
create or replace procedure test
as
cursor cc is select * from YYYY;
begin
null;
end;
/

能否创建

论坛徽章:
0
13 [报告]
发表于 2007-09-10 15:47 |只看该作者
原帖由 numenhuang 于 2007-9-10 15:11 发表
create or replace procedure test
as
cursor cc is select * from YYYY;
begin
null;
end;
/

能否创建



不能创建

Warning: Procedure created with compilation errors.

SQL> show errors
Errors for PROCEDURE TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/14     PL/SQL: SQL Statement ignored
3/28     PL/SQL: ORA-00942: table or view does not exist



SQL> select count(*) from YYYY;

  COUNT(*)
----------
     10423

论坛徽章:
0
14 [报告]
发表于 2007-09-10 15:51 |只看该作者
sqlplus system
sql>select * from dba_synonyms where synonym_name='YYYY'
贴出来看看

create or replace procedure test
as
cursor cc is select * from 同义词基表用户.同义词基表;
begin
null;
end;

论坛徽章:
0
15 [报告]
发表于 2007-09-10 16:04 |只看该作者
原帖由 numenhuang 于 2007-9-10 15:51 发表
sqlplus system
sql>select * from dba_synonyms where synonym_name='YYYY'
贴出来看看

create or replace procedure test
as
cursor cc is select * from 同义词基表用户.同义词基表;
begin
null;
end;



SQL> SHOW USER
USER is "FSZW_LSGJ"

select * from dba_synonyms where synonym_name='IM_PR_NOSECT'

OWNER                          TABLE_OWNER
------------------------------ ------------------------------
TABLE_NAME
------------------------------
FSZW_LSGJ                      COMMON_LSGJ
IM_PR_NOSECT


SQL>
SQL> create or replace procedure test
  2  as
  3  cursor cc is select * from COMMON_LSGJ.IM_PR_NOSECT;
  4  begin
  5  null;
  6  end;
  7  /

Warning: Procedure created with compilation errors.

SQL> SHOW ERRORS
Errors for PROCEDURE TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/14     PL/SQL: SQL Statement ignored
3/40     PL/SQL: ORA-00942: table or view does not exist

论坛徽章:
0
16 [报告]
发表于 2007-09-10 16:08 |只看该作者
SQL> SHOW USER
USER is "FSZW_LSGJ"

sql>select * from COMMON_LSGJ.IM_PR_NOSECT where rownum<10;

如果报错
connect system
grant select on COMMON_LSGJ.IM_PR_NOSECT to FSZW_LSGJ;

论坛徽章:
0
17 [报告]
发表于 2007-09-10 16:09 |只看该作者

回复 #16 numenhuang 的帖子

SQL> select count(*) from  COMMON_LSGJ.IM_PR_NOSECT;

  COUNT(*)
----------
     10423

SQL>

论坛徽章:
0
18 [报告]
发表于 2007-09-10 16:11 |只看该作者
sql>select * from COMMON_LSGJ.IM_PR_NOSECT where rownum<10;

论坛徽章:
0
19 [报告]
发表于 2007-09-10 16:13 |只看该作者

回复 #18 numenhuang 的帖子

可以的,没有问题。

论坛徽章:
0
20 [报告]
发表于 2007-09-10 16:16 |只看该作者
原帖由 gz_xuhaoz 于 2007-9-10 16:13 发表
可以的,没有问题。


如果这样的话
SQL> create or replace procedure test
  2  as
  3  cursor cc is select * from COMMON_LSGJ.IM_PR_NOSECT;
  4  begin
  5  null;
  6  end;
  7  /
还会报错?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP