Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Different SELECT result when run from SQLPLUS and asSP

Re: Different SELECT result when run from SQLPLUS and asSP

From: <michael_bialik_at_my-deja.com>
Date: Tue, 07 Dec 1999 20:49:21 GMT
Message-ID: <82jrsf$rk7$1@nnrp1.deja.com>


Hi.

 Your assumption is correct:
 When SQL statement is executed within stored proc/function it is  executed with the access rights of it's creator.  So in your case SP returns a number of columns from it's creator owned  tables.
 The solutions is :
  GRANT SELECT ANY TABLE TO <procedure_creator>.

 HTH. Michael.

In article <82iprr$1qr$1_at_nnrp1.deja.com>,   todecker_at_my-deja.com wrote:
> Does anybody have an explanation for these results?
>
> SQL> select count(*)
> 2 from sys.all_tab_columns;
>
> COUNT(*)
> ---------
> 25968
>
> SQL> CREATE OR REPLACE PACKAGE test AS
> 2 PROCEDURE the_output;
> 3 END test;
> 4 /
>
> Package created.
>
> SQL> CREATE OR REPLACE PACKAGE BODY test AS
> 2
> 3 PROCEDURE the_output IS
> 4 x NUMBER(10);
> 5 BEGIN
> 6 select count(*)
> 7 INTO x
> 8 from sys.all_tab_columns;
> 9 dbms_output.put_line('x: '||x);
> 10 END;
> 11 END test;
> 12 /
>
> Package body created.
>
> SQL> set serveroutput on
> SQL> execute test.the_output;
> x: 5069
>
> PL/SQL procedure successfully completed.
>
> I tried it under oracle 8.0.5 and 8.1.5 and get the same results.
> It somehow seems to be related to the users rights because I have a
3rd
> installation where it works fine.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Dec 07 1999 - 14:49:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US