1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
C:\Documents and Settings\mnitu>sqlplus mni/mni@xe
SQL*Plus: Release 11.2.0.2.0 Production on Mar. Juin 12 14:56:13 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
SQL> create user sch1 identified by sch1;
User created.
SQL> create user sch2 identified by sch2;
User created.
SQL> grant resource, connect to sch1;
Grant succeeded.
SQL> grant resource, connect to sch2;
Grant succeeded.
SQL> grant create synonym to sch1;
Grant succeeded.
SQL> connect sch2/sch2
Connected.
SQL> create table tab_a(col int);
Table created.
SQL> grant select, insert, delete, update on tab_a to sch1;
Grant succeeded.
SQL> connect sch1/sch1
Connected.
SQL> create synonym tab_a for sch2.tab_a;
Synonym created.
SQL> select count(*) from tab_a;
COUNT(*)
----------
0
SQL> create or replace function f return number is
2 l_cpt pls_integer;
3 begin
4 select count(*)
5 into l_cpt
6 from tab_a;
7 return l_cpt;
8 end;
9 /
Function created.
SQL> show err
No errors.
SQL> |
Partager