Select current user tables

Hello

I need to get the list of TABLES that the current user has a privilege. To do this I use the following query:

SELECT DISTINCT O.object_name
Of object o, all_tab_privs tp
WHERE o.object_name = tp.table_name
AND o.object_type = 'TABLE '.
AND tp.grantee = USER
ORDER BY o.object_name

My problem with this query is the poor performance, and this is essential in my system.

Does anyone have any sugestion?

Why not just:

SQL > select table_name from ALL_TABLES;

The view is automatically limited to the logged in user.

and this is essential in my system.

Really? Your application is so dynamic, you need to test this when running?

Tags: Database

Similar Questions

  • GRANT SELECT on a table to the user / role changes for the tab last_DDL

    Hello

    Is grant select (or any private object) to the user/role a DDL statement?

    GRANT SELECT on a table to the user / role changes the last_DDL to the table.
    1 > is this expected behavior?
    2 > no way in which we can grant select on a table by another user, without changing the DDL? (for example create view).


    The test is performed:

    Prior to the issuance:


    OBJECT_NAME CREATED TIMESTAMP LAST_DDL_TIME OWNER
    ------- ---------------------- ---------- ------------- --------------------
    AR HZ_CUSTOMER_PROFILES 8 MAY 00 13 MARCH 13 2003-06 - 26:12:41:29



    Grant statement:
    GRANT SELECT ON "AR". "' HZ_CUSTOMER_PROFILES ' TO 'AR_VIEW ';

    Note: AR_VIEW is a role, I tried granting also directly to the user.


    After the grant:

    OBJECT_NAME CREATED TIMESTAMP LAST_DDL_TIME OWNER
    ------- ---------------------- ---------- ------------- --------------------
    AR HZ_CUSTOMER_PROFILES 8 MAY 00 21 MARCH 13 2003-06 - 26:12:41:29



    Old thread, discuss whether Grant is DDL or not, but no documented conclusions.
    ( Re: Grant, revoke is DDL and DCL? )

    Please help in the assessment above.

    -Best regards,.
    Mani

    It's the DOF.

    After all, this isn't DML, it implicitly committed and you cannot use it directly in PL/SQL: features of DDL. :-)

  • How to revoke the SELECT on a table for a specific user?

    Environment:

    SQL * 3.1 on Windows XP Pro SP3 Developer to connect to Oracle 11.2.0.3 EE on Solaris 10.5.

    I have table T with SELECTION privilege granted on this issue both a role and a specific user.

    I am using SQL * Developer to revoke the privilege SELECT on this table of the individual user and leave the role.

    I can see how to revoke the role by right-clicking on the table and goes to the privileges-> revoke but I can't find where to choose a specific user to revoke of.

    Any help is greatly appreciated!

    -gary

    Hi Gary,.

    You are probably aware of the SQL syntax of base to make grant and revoke of SQL * more or the SQL Developer Worksheet:

    grant select on .T to ;
    revoke select on .T from ;
    

    To reach the equivalent to revoking of SQL Developer Connection Navigator...
    1. open the connection for
    2 expand the Tables node, and then open the object for table T browser.
    3. click on the grants tab and then, in its toolbar, select Actions->-> Revoke privileges
    4. Select in the drop-down list of the dialog box to remove user Action.
    5 shuttle privilege SELECT from the right back to the left, and then click apply.

    One would expect to be able to do the same thing from say the node under the node for the use of the SYSTEM for other users, but this isn't the case.

    Hope this helps,
    Gary Graham
    SQL development team

  • 2.1: Data tab of the query about other users mix with current user [Fixed 2.1.1 Table

    Hello


    I use the SQL Dev 2.1, againts Oracle 9.2.0.6.0-production version
    My account has privilege almost as s/n, which allows me to show other users tables.
    I have a table whose name is exactly the same as other users of table that differs from the number of columns.
    Let's say that,
    mine is USERA. TABLE_A with 4 columns (COL_A, COL_B, COL_C, COL_D)
    on the other is USERB. TABLE_A with 3 columns (COL_A, COL_B, COL_C)

    When I opened the other users - USERB tables. TABLEA,
    the columns tab shows 3 columns
    but the data tab, try query (I saw a popup progress bar) COL_D thus causing error that COL_D is not available shown on the log.
    I forgot the message but I think it is ORA-00904: "COL_D": invalid identifier.

    I vaguely remember that few people had posted this problem on the old version of SQL Dev (1.2 or an earlier version, I guess).
    I noticed THAT SQL Dev 1.5.5 does not receive this error.

    Does anyone have the same problems?


    Kind regards

    Buntoro

    Published by: user457519 on December 25, 2009 12:37 AM
    Correction on the ORA error message

    Is another reported problem (that I myself cannot reproduce in 2.1, but made a few versions ago), but I'm sure that a bug has been registered against it.

    Kind regards
    K.

  • The arrays pointed to by table_alias must be in the same schema as the current user

    I have another question regarding the use of table aliases. When I tried to create a structure of the event with the table alias pointing to a table not in the schema of the current user, I get errors when trying to create the rule class.

    I don't know if it's because the Policy Manager cannot use a table alias pointing to the tables of other users.

    Hello

    The following script works for me. If it works, please send me your script to Yao aravind [dot] [at] oracle [dot] com.

    Thank you
    -Aravind.

    connect scott/tiger 
    
    grant select on scott.emp to a;
    grant select on scott.dept to a;
    
    connect a/a
    
    begin
       dbms_rlmgr.create_event_struct(event_struct => 't_a');
       dbms_rlmgr.add_elementary_attribute(event_struct => 't_a',
                                           attr_name    => 'a_employees',
                                           tab_alias    => exf$table_alias('scott.emp'));
       dbms_rlmgr.add_elementary_attribute(event_struct => 't_a',
                                           attr_name    => 'a_departments',
                                           tab_alias    => exf$table_alias('scott.dept'));
    end;
    /
    
    BEGIN
       dbms_rlmgr.create_rule_class(rule_class   => 't_alia',
                                    event_struct => 't_a',
                                    action_cbk   => 't_acb',
                                    rslt_viewnm  => 't_arv',
                                    rlcls_prop   => '');
    END;
    /
    

    Solution: In order to use aliases for tables in schemas, SELECT on tables privileges must be explicitly granted to the schema in which the class rule is created. Also, DMLEVENTS and CNFEVENTS the configuration of the rule can be used only when the paintings and the rule class are defined in the same schema.

  • Why Wizard does not start when the current user?

    Program does not RUN. Wizard does not open after you select the Option for the current user

    P.S. If you can't always install Firefox, even using the FULL Installer:

    Reinstalling but this time download the file on your computer. When the download is complete, install it as an administrator by right clicking the configuration file and select "Run as Administrator".

  • Restrict the insert, update, delete the other user table

    I created a new database user. I have granted the privileges system into a TOAD.

    • Select any table
    • alter any table
    • delete a table

    I found that account can select, alter, drop table arrays of other schema. So how I can limit the which account to modify, remove only its tables belonging and select table of all the schema?

    Is there the ALTER table, ALTER view, ALTER procedure, ALTER synonym, DROP table, DROP view, DROP procedure, DROP synonym system privileges? How can I grant it without ANY system privileges?

  • WIN8 cannot select the user when connecting more

    I used to have the option to select the user to connect as but now I have a screen that says:

    Press Ctrl + Alt + Delete or use the Windows Security button to unlock

    When I hit Ctrl + Alt + Delete I get only the most recent user login.  If I hit the left arrow right top left of the image, I must return to the Ctrl + Alt + Delete screen.  There is no way I can see to select another user.

    If the current user remembers actually disconnect from the screen Ctrl + Alt + Delete I am taken to a login with a choice of the users screen.

    This used to work and I don't know if my 5 yo changed something or if a updated Windows did something.  But my wife and son both need to use this notebook so I really need separate accounts.

    I found a few long really complex stuff on the ' net on the definition of the strategy group and fiddle with the registry but I know my 5 yo did nothing like that.

    How do I change back?

    Dennis

    PS what is the "Windows Security button" anyway?

    I realized that I had recently installed Cisco AnyConnect VPN software to connect to the work.  Which of - installed and now life is still happy.  I will contact Cisco.

    Sorry for the short reply above.  Validation has been broken here earlier today and several machines at the same time making a response and a new post, I didn't type a bunch just to get the "Oops, something went wrong" again.

    Dennis

  • Accelerate the selection * of a table

    Hi all

    OS: RHEL

    DB: 11 gR 2

    Is it possible that we can accelerate the selection * of a table?

    Kind regards

    $phinx19 wrote:

    Hi all

    OS: RHEL

    DB: 11 gR 2

    Is it possible that we can accelerate the selection * of a table?

    Kind regards

    # If it is everything you write, you get a full table scan independently of all the indexes that exist on this table:

    SQL > create table (yazflutt)

    snorm number 2.

    3 gleezle varchar2 (40),

    date of Halloween 4,

    Number 5 art);

    Table created.

    SQL >

    SQL > start

    2 for i in 1.10000 loop

    3. insert into yazflutt

    4 values (i, 'pourles yinko' |) I |'! (', sysdate - I, i);

    5 end of loop;

    6

    7 validation;

    8 end;

    9.

    PL/SQL procedure successfully completed.

    SQL >

    SQL > set autotrace on

    SQL >

    SQL > select * from yazflutt;

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    yinko 567 567 pourles!                        15 APRIL 14 567

    yinko 568 568 pourles!                        14 APRIL 14 568

    ...

    9982 yinko 9982 pourles!                       5 JULY 88 9982

    9983 pourles yinko 9983!                       4 JULY 88 9983

    9984 yinko 9984 pourles!                       3 JULY 88 9984

    9985 pourles yinko 9985!                       2 JULY 88 9985

    9986 yinko 9986 pourles!                       1 JULY 88 9986

    9987 yinko 9987 pourles!                       30 JUNE 88 9987

    9988 yinko 9988 pourles!                       29 JUNE 88 9988

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    9989 yinko 9989 pourles!                       9989 JUNE 28, 88

    yinko 9990 9990 pourles!                       JUNE 27 88 9990

    9991 yinko 9991 pourles!                       9991 26 JUNE 88

    9992 yinko 9992 pourles!                       25 JUNE 88 9992

    9993 yinko 9993 pourles!                       9993 JUNE 24, 88

    9994 yinko 9994 pourles!                       23 JUNE 88 9994

    9995 pourles yinko 9995!                       9995 22 JUNE 88

    yinko 9996 9996 pourles!                       JUNE 21 88 9996

    9997 yinko 9997 pourles!                       20 JUNE 88 9997

    9998 pourles yinko 9998!                       9998 19 JUNE 88

    yinko 9999 9999 pourles!                       18 JUNE 88 9999

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    10000 pourles 10000 yinko!                      JUNE 17, 88 10000

    10000 selected lines.

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2573332187

    ------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |          | 10000 |   556K |    10 (10) | 00:00:01 |

    |   1.  TABLE ACCESS FULL | YAZFLUTT | 10000 |   556K |    10 (10) | 00:00:01 |

    ------------------------------------------------------------------------------

    Note

    -----

    -the dynamic statistics used: dynamic sampling (level = 2)

    Statistics

    ----------------------------------------------------------

    9 recursive calls

    0 db block Gets

    795 consistent gets

    0 physical reads

    0 redo size

    488545 bytes sent via SQL * Net to client

    7877 bytes received via SQL * Net from client

    668 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    10000 rows processed

    SQL >

    SQL > set autotrace off

    SQL >

    SQL > create index yazflutt_idx1 on yazflutt (snorm);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx2 on yazflutt (gleezle);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx3 on yazflutt (hopple);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx4 on yazflutt (art);

    The index is created.

    SQL >

    SQL > exec dbms_stats.gather_table_stats (user, 'YAZFLUTT',-online true waterfall, estimate_percent-online null)

    PL/SQL procedure successfully completed.

    SQL >

    SQL > set autotrace on

    SQL >

    SQL > select * from yazflutt;

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    yinko 567 567 pourles!                        15 APRIL 14 567

    yinko 568 568 pourles!                        14 APRIL 14 568

    yinko 569 569 pourles!                        APRIL 13, 14 569

    ...

    9983 pourles yinko 9983!                       4 JULY 88 9983

    9984 yinko 9984 pourles!                       3 JULY 88 9984

    9985 pourles yinko 9985!                       2 JULY 88 9985

    9986 yinko 9986 pourles!                       1 JULY 88 9986

    9987 yinko 9987 pourles!                       30 JUNE 88 9987

    9988 yinko 9988 pourles!                       29 JUNE 88 9988

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    9989 yinko 9989 pourles!                       9989 JUNE 28, 88

    yinko 9990 9990 pourles!                       JUNE 27 88 9990

    9991 yinko 9991 pourles!                       9991 26 JUNE 88

    9992 yinko 9992 pourles!                       25 JUNE 88 9992

    9993 yinko 9993 pourles!                       9993 JUNE 24, 88

    9994 yinko 9994 pourles!                       23 JUNE 88 9994

    9995 pourles yinko 9995!                       9995 22 JUNE 88

    yinko 9996 9996 pourles!                       JUNE 21 88 9996

    9997 yinko 9997 pourles!                       20 JUNE 88 9997

    9998 pourles yinko 9998!                       9998 19 JUNE 88

    yinko 9999 9999 pourles!                       18 JUNE 88 9999

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    10000 pourles 10000 yinko!                      JUNE 17, 88 10000

    10000 selected lines.

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2573332187

    ------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |          | 10000 |   341K |    10 (10) | 00:00:01 |

    |   1.  TABLE ACCESS FULL | YAZFLUTT | 10000 |   341K |    10 (10) | 00:00:01 |

    ------------------------------------------------------------------------------

    Statistics

    ----------------------------------------------------------

    1 recursive calls

    0 db block Gets

    725 consistent gets

    0 physical reads

    0 redo size

    488545 bytes sent via SQL * Net to client

    7877 bytes received via SQL * Net from client

    668 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    10000 rows processed

    SQL >

    SQL > set autotrace off

    SQL >

    Whatever the index in place a ' select * ' makes a full table scan, period.  Unless you can optimize your storage space, memory, or even use version 11.2 laters results cache and there is not a lot you can do.

    David Fitzjarrell

  • To create an interactive report in the apex by selecting from multiple tables

    Hi, I am creating an interactive report by selecting from multiple tables.

    SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration

    JOIN THE

    WITNESS w

    ON w.witness_id = s.FK1_WITNESS_ID

    JOIN THE

    Incident I have

    WE

    i.incident_no = w.FK1_INCIDENT_NO

    JOIN THE

    user_station ps

    ON ps.station_id = i.nearest_station_id

    JOIN THE

    the user in.

    WE

    in. STATION_ID = ps.station_id

    WHERE po.officer_id = 1

    by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '

    So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.

    I wonder you can not create a report by selecting from multiple tables?

    If you can please I need your help.

    Thank you

    You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...

    Or wrap a selection around your selection with joins, and then make the where clause on the external selection...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • ORA-01747: invalid user.table.column... on the REPLACEMENT notice

    Oracle 11g Release 2

    I run an UPDATE statement. In the 'set' I am trying to update a column by using a subquery on the right side. REPLACE the statement Gets the error ORA-01747: specification of invalid column, table.column, or user.table.column.

    create table tab1
    ( file_id   number  ,
      record_id number  ,
      part_type_id number ,
      part_number  number ,
      positon_id   number ,
      notes        varchar2(255) ,
      mapped       varchar2(1) default 'N'
    )
    /
    insert into tab1 values(1,1,123,777,1,'NEW|A/C COMPRESSOR KIT','N') ;
    insert into tab1 values(1,2,123,777,2,'REMAN|A/C LINE','N') ;
    insert into tab1 values(1,3,123,777,2,'TEST NOTE','N') ;
    commit;
    select * from tab1;
    /*
      FILE_ID  RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID NOTES                     MAPPED
    --------- ---------- ------------ ----------- ---------- ------------------------- ------
            1          1          123         777          1 NEW|A/C COMPRESSOR KIT         N
            1          2          123         777          2 REMAN|A/C LINE                 N
            1          3          123         777          1 TEST NOTE                      N
    */
    
    
    DECLARE
       v_note2 varchar2(255) := 'NEW' ;
    BEGIN
    UPDATE tab1 t 
             SET 
              , t.notes =  (select REPLACE(t.notes,v_note2,null) 
                            from dual )
          WHERE t.file_id = 1         -- value comes from another source
          AND   t.part_type_id = 123  -- value comes from another source
          AND   t.part_number = 777   -- value comes from another source
          AND   t.position_id = 1  ;  -- value comes from another source
    END ;
    /
    
    ERROR at line 3:
    ORA-01747: invalid user.table.column, table.column, or column specification
    

    Here's what the end result should be:

      FILE_ID  RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID NOTES                     MAPPED
    --------- ---------- ------------ ----------- ---------- ------------------------- ------
            1          1          123         777          1 |A/C COMPRESSOR KIT            N
            1          2          123         777          2 REMAN|A/C LINE                 N
            1          3          123         777          1 TEST NOTE                      N
    

    Hello

    orclrunner wrote:

    Oracle 11g Release 2

    I run an UPDATE statement. In the 'set' I am trying to update a column by using a subquery on the right side. REPLACE the statement Gets the error ORA-01747: specification of invalid column, table.column, or user.table.column.

    1. create table tab1
    2. (file_id number,
    3. number of record_id,
    4. number of part_type_id
    5. number of PART_NUMBER,
    6. number of positon_id
    7. Notes VARCHAR2 (255),
    8. mapped by default varchar2 (1) ' don't
    9. )
    10. /
    11. insert into tab1 values (1,1,123,777,1,'NEW |) Kit COMPRESSOR / it, ' don't);
    12. insert into tab1 values (1,2,123,777,2,'REMAN |) A/C LINE ',' don't);
    13. insert into tab1 values (1,3,123,777,2, 'NOTE of TEST', ' don't);
    14. commit;
    15. Select * from tab1;
    16. /*
    17. FILE_ID RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID MAPPED NOTES
    18. --------- ---------- ------------ ----------- ---------- ------------------------- ------
    19. 1 1 123 777 1 NEW | A/C COMPRESSOR KIT N
    20. 1 2 123 777 2 REMAN | A/C LINE N
    21. 1 3 123 777 1 TEST NOTES N
    22. */
    23. DECLARE
    24. VARCHAR2 (255) v_note2: = "NEW";
    25. BEGIN
    26. Tab1 t UPDATE
    27. SET
    28. t.notes = (select REPLACE(t.notes,v_note2,null)
    29. the double)
    30. WHERE t.file_id = 1 - value comes from another source
    31. AND t.part_type_id = 123 - value comes from another source
    32. AND t.part_number = 777 - value comes from another source
    33. AND t.position_id = 1;  -value comes from another source
    34. END;
    35. /
    36. ERROR at line 3:
    37. ORA-01747: invalid column, table.column, or user.table.column specification

    Here's what the end result should be:

    1. FILE_ID RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID MAPPED NOTES
    2. --------- ---------- ------------ ----------- ---------- ------------------------- ------
    3. 1          1          123         777          1 | A/C COMPRESSOR KIT N
    4. 1 2 123 777 2 REMAN | A/C LINE N
    5. 1 3 123 777 1 TEST NOTES N

    The comma after SET is a syntax error.

    Why you use double?  Why not just

    UPDATE tab1

    SET of notes = REPLACE (notes, v_note2)

    WHERE file_id = 1

    ...

    ?

  • Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    ODI error. When you try to import.

    Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    It is a common question.

    Allow your SCD SCD table column properties if you do not select "crush on change."
    This property simply

    -Online CPC IKM goto => select ignore option error on update of existing lines.

  • grant select a user to a new user

    I know it should be easy, but can't seem to find a way around it.

    I can grant roles granted to a user to a new user, but the existing user has loads of select on other tables.

    How to get the selection of existing user and give them to the new user?

    Thank you

    See all the privileges granted to ALICE directly (not through a role)

    select * from dba_tab_privs where grantee='ALICE';
    

    With this, you can write a select statement that generates SQL to grant the same privileges to BOB

    select 'grant '||privilege||' on '||owner||'.'||table_name||' to BOB;' from dba_tab_privs where grantee='ALICE';
    

    Then, run the output of this statement to make grants.

  • Access grant select on all tables in a diagram to another diagram

    Hi all

    I can grant select access on the tables of a schema (SAY USER1) to another (SAY USER2) by giving him a role and in turn grant this role to another scheme as below:

    FOR x IN (SELECT * from user_tables)
    LOOP
    RUN IMMEDIATELY "SELECT WE GRANT | x.table_name | "To < < role1 > > ';
    END LOOP;

    Role1 Grant User2;

    but my question is that suppose I create another table say "TEMP_TAB" in the scheme of USER1 after the execution of the block above user2 will be able to access the table TEMP_TAB. My guess is certainly not. If I'm wrong, I want a way to grant select on a table in the schema of user1 immediately as and when it is created to User2.

    Please suggest a solution.

    Thank you and best regards,
    Vipin Kumar Rai

    993280 wrote:
    Knani,

    but in this case the User2 can choose any table in any schema. I want only USER2 for the right to select for only User1 tables.

    Thank you
    Vipin

    Oh sorry. Misinterpreted your post. What you did is the right way to do it. You must add the select role privilege whenever you create a new table. There is no "SELECT the TABLE all THE" specific to a type of data user privilege.

  • the current user of the session &amp; current schema

    Hi all


    ACC to a url
    "
    o CURRENT_USER: the name of the user whose privilege the session is running
    in the framework.

    o SESSION_USER: the name of the user who originally created this session? who is online
    in. It is constant for a session.

    o CURRENT_SCHEMA: the name of the default schema that will be used to resolve references
    for objects not qualified.
    "

    Session user is clearly making the distinction. My question is that is there any situation when the CURRENT_USER and CURRENT_SCHEMA is different? My understanding is that when we have a program of sup with authid define, then the user of the session I (if another user not the define called)
    is different and the current_schema is different. The current_schema is definers schema while the user of the session is the Summoner of the program overtime. I guess that this is a good understanding.


    Is EQUIVALENT to current_user, current_schema? If this is not the case, if someone can cite a small program to show the difference?

    As others have said, current_schema contols which schema for unqualified names are resolved in. It can be changed using:

    alter session set current_schema = 
    

    or in a stored procedure liike authid clause:

    SQL> Create Procedure test_definer as
      2     l_user           VARCHAR2(30);
      3     l_current_user   VARCHAR2(30);
      4     l_session_user   VARCHAR2(30);
      5     l_current_schema VARCHAR2(30);
      6  begin
      7     select user into l_user from dual;
      8
      9     select Sys_Context('USERENV', 'CURRENT_USER')
     10     into l_current_user
     11     from dual;
     12
     13     select Sys_Context('USERENV', 'SESSION_USER')
     14     into l_session_user
     15     from dual;
     16
     17     select Sys_Context('USERENV', 'CURRENT_SCHEMA')
     18     into l_current_schema
     19     from dual;
     20
     21     Dbms_Output.Put_Line ('User is: '||l_user);
     22     Dbms_Output.Put_Line ('Current User is: '||l_current_user);
     23     Dbms_Output.Put_Line ('Session User is: '||l_session_user);
     24     Dbms_Output.Put_Line ('Current_schema is: '||l_current_schema);
     25  end;
     26  /
    
    Procedure created.
    
    SQL> Create Procedure test_current
      2     authid Current_user as
      3     l_user           VARCHAR2(30);
      4     l_current_user   VARCHAR2(30);
      5     l_session_user   VARCHAR2(30);
      6     l_current_schema VARCHAR2(30);
      7  begin
      8     select user into l_user from dual;
      9
     10     select Sys_Context('USERENV', 'CURRENT_USER')
     11     into l_current_user
     12     from dual;
     13
     14     select Sys_Context('USERENV', 'SESSION_USER')
     15     into l_session_user
     16     from dual;
     17
     18     select Sys_Context('USERENV', 'CURRENT_SCHEMA')
     19     into l_current_schema
     20     from dual;
     21
     22     Dbms_Output.Put_Line ('User is: '||l_user);
     23     Dbms_Output.Put_Line ('Current User is: '||l_current_user);
     24     Dbms_Output.Put_Line ('Session User is: '||l_session_user);
     25     Dbms_Output.Put_Line ('Current_schema is: '||l_current_schema);
     26  end;
     27  /
    
    Procedure created.
    

    Copyright being the default, test_definer procedure works with the privileges and in the schema of the user Thatcreated in this oracle of $ case ops. The test_current procedure operates in the schema of the user calling him and privileges. So if we call both in the scheme of the owner that they are actually the same:

    SQL> exec test_definer;
    User is: OPS$ORACLE
    Current User is: OPS$ORACLE
    Session User is: OPS$ORACLE
    Current_schema is: OPS$ORACLE
    
    PL/SQL procedure successfully completed.
    
    SQL> exec test_current;
    User is: OPS$ORACLE
    Current User is: OPS$ORACLE
    Session User is: OPS$ORACLE
    Current_schema is: OPS$ORACLE
    
    PL/SQL procedure successfully completed.
    

    However, if we create a new user and give that run them both, we'll see a feel:

    SQL> create user a identified by a;
    
    User created.
    
    SQL> grant create session to a;
    
    Grant succeeded.
    
    SQL> grant execute on test_definer to a;
    
    Grant succeeded.
    
    SQL> grant execute on test_current to a;
    
    Grant succeeded.
    
    SQL> connect a/a
    Connected.
    SQL> exec ops$oracle.test_definer;
    User is: A
    Current User is: OPS$ORACLE
    Session User is: A
    Current_schema is: OPS$ORACLE
    
    PL/SQL procedure successfully completed.
    
    SQL> exec ops$oracle.test_current;
    User is: A
    Current User is: A
    Session User is: A
    Current_schema is: A
    
    PL/SQL procedure successfully completed.
    

    John

Maybe you are looking for