grant the privilege on the SQL types to another schema

I created two SQL types under the APP_OWNER scheme as follows:

CREATE or REPLACE TYPE t_instr_info as an OBJECT
(NUMBER IMNT_KY)

CREATE or REPLACE TYPE t_tab_instr_info
AS THE t_instr_info TABLE

The privilege on these two types as follows:

Grant execute on t_tab_instr_info to vprods_app2

Grant execute on t_instr_info to vprods_app2

The stored procedures must be developed in the scheme of the APP. In the scheme of the APP, I need to call this type to declare the array as follows:

v_tab_output app_owner.t_tab_instr_info: = app_owner.t_tab_instr_info ();

I get a PLS-00905: object owner.t_tab_instr_info is not valid

I tried giving EVERYTHING instead of run, but the problem persists.

Help, please. As a policy of all objects including tables, types etc. must be app_owner and the app schema privileges

Thank you in advance.

One thing I forgot to mention (since you do not explicitly specify how you are granting things) is that you need to issue DIRECT subsidies (as in my example above), you cannot compile the code if you have subsidies via a role (but you can execute anonymous blocks).

This is an example

create user APP_OWNER identified by APP_OWNER default tablespace users temporary tablespace temp;
grant connect, resource, create role to APP_OWNER;

create user APP_SCHEMA identified by APP_SCHEMA default tablespace users temporary tablespace temp;
grant connect, resource to APP_SCHEMA;

connect APP_OWNER/APP_OWNER@xe

create role for_apps;

CREATE OR REPLACE TYPE t_instr_info as OBJECT
(IMNT_KY NUMBER);
/ 

CREATE OR REPLACE TYPE t_tab_instr_info
AS TABLE OF t_instr_info;
/ 

grant execute on t_instr_info to for_apps;
grant execute on t_tab_instr_info to for_apps;

grant for_apps to app_schema;

connect APP_SCHEMA/APP_SCHEMA@xe
APP_SCHEMA_XE?create or replace procedure test
  2  as
  3     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
  4  begin
  5     null;
  6  end;
  7  /

Warning: Procedure created with compilation errors.

Elapsed: 00:00:01.17
APP_SCHEMA_XE?show err
Errors for PROCEDURE TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/17     PL/SQL: Item ignored
3/17     PLS-00201: identifier 'APP_OWNER.T_TAB_INSTR_INFO' must be
         declared

APP_SCHEMA_XE?declare
  2     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
  3  begin
  4     null;
  5  end;
  6  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.17

Tags: Database

Similar Questions

  • The elements and the SQL Types

    I just started learning apex and I'm confused about the application and page elements. Since they can serve as a kind of variables in the SQL and PL/SQL (for example, by using the syntax variables bind), at some point they should be prescribed a type, since SQL and PL/SQL are two strongly typed languages.

    It seems that the items have types, see the documentation (http://docs.oracle.com/cd/E11882_01/appdev.112/e11947/bldapp.htm#BCEDCGGH), but I don't know how they correspond to the SQL types.

    For example, I saw that to_date is always used with items of type date picker, implying that it is a string of SQL type.

    So the question. What have SQL type apex page/application parts, is what type conversion do I need to use when dealing with items in SQL and PL/SQL?

    They are all VARCHAR2 (4000) as far as I know - anything application are the same and the page elements is adjustable in number or date more. Put date or number will include only internal validation, check whether the format is match the parameters of globalization of applications.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • How to detect the SQL type to avoid SQL injection

    Hello

    I work in a company of gsm and we develop a program for analysis of trends. Users of this program can write SQL statements. I want to write sql statements specific as my program input statement (SELECT... from...). Instructions to SELECT most. I have dynamic SQL and PL/SQL blocks in my program. I get user-defined SQL statements and execute dynamic Sql code.

    Here's the problem: I need to understant what type of SQL, they give as my program input parameter to avoid wrong operations (DELETE, TRUNCATE, DROP...)

    First of all I thought to the RegExp to understant if a SELECT SQL or SQL DELETE...

    Is there a recommended on this problem? Oracle has any procedure to detect?

    Thank you

    Hi a_yavuz,

    We had to solve the same problem while we work a project that receives user sql statements, we check the sql as follows:

    lb_bool: = regexp_like (upper (pv_sql),'^ (-() * *(SELECT|))) (WITH)');

  • How to share data in the tables ' User_ * ' with another schema

    I want to share the data in the table WHERE USER_SEGMENTS with another schema. If I create a view and grant select on the view, when the other schema queries the view data are identical to themselves querying the SYS.user_segments table directly.
    create view sys_user_segments as select * from sys.user_segments;
    grant select on sys_user_segments to A;
    My guess is that the SYS.user_segments table is a view based on the current user.

    Is there a way to share such data without creating a copy of the table?

    Oracle: 10g

    Thank you

    If the ADMINISTRATOR is concerned about B access to DBA_SEGMENTS (or by creating DBA_SEGMENTS views that belongs to a user who has access on top and then grant access to this view of B), it seems pretty crazy allow that kind of database connection.

    If you create a database link belonged to B that connects to A, B is, in substance, given any privilege that has exercises. But it is done in a very, very dark which will no doubt be neglected in the future when someone gets a check. He'll be sitting here to wait that someone (accidentally or intentionally) Decides to exploit the security hole and do something that is causing a problem (by removing all data from a table, grabbing all the sensitive data in a table, etc.). Risks of this almost certainly far, far* far * outweigh the risks of even leaving B to obtain direct access to DBA_SEGMENTS.

    Justin

  • PL/SQL procedure in another scheme gives unexpected result call

    I have a SQL Script that does this:
    Conn pnr / < password of user pnr >;
    Set serveroutput on;
    exec vms.disable_all_fk_constraints;
    SELECT the owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R ';

    and the disable_all_fk_constraints procedure, which is owned by the user 'vms' is defined as:
    create or replace
    procedure disable_all_fk_constraints is
    v_sql VARCHAR2 (4000);
    Start
    dbms_output.put_line ('disable all referential integrity constraints.');
    for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type = 'R') loop
    dbms_output.put_line ('Disabling constraint' | rec.constraint_name |) 'from ' | Rec.table_name | '.');
    v_sql: = 'ALTER TABLE ' | Rec.table_name | "DISABLE THE CONSTRAINT ' | Rec.constraint_name;
    execute immediate (v_sql);
    end loop;
    end;

    When I run the script SQL, the call to vms.disable_all_fk_constraints disables the FK forced in the schema "vms", while I wanted to disable the FK constraints in schema "pnr" (the applicant of the procedure). I know I could do this job by copying disable_all_fk_constraints to the 'pnr' schema procedure and calling it as "+ exec disable_all_fk_constraints; +"inside, the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.

    What can I do?

    Thank you

    Hello

    Create the procedure with AUTHID CURRENT_USER, like this:

    create or replace
    procedure disable_all_fk_constraints
    AUTHID  CURRENT_USER               -- Added
    is
        v_sql VARCHAR2(4000);
    begin
        ...
    

    With AUTHID DEFINE (which is the default), everything that happens inside the stored procedure goes as if the Owers of procedure was done, except that the USER function returns always the name of the actual user.

    Published by: Frank Kulash, January 11, 2011 11:07
    I just see response to Sven. It is true, that it is a very dangerous thing to do.

  • Grant the SQL query


    Hi gurus of the Oracle


    We have a single query asks what response time is slow. could you please look at the statistics and explain the plan and provide some suggestions to improve the response time

    of the query.

    SELECT ippoolid serial number ipaddress
    de tblmippooldetail

    ippoolid = :1 and (reserved IS NULL or reserved = 'N')

    and (last_updated_time IS NULL or last_updated_time + interval '1' minute < SYSTIMESTAMP) AND ROWNUM = 1 FOR UPDATE;


    Execution plan

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

    Hash value of plan: 1077097192

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

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

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

    |   0 | SELECT STATEMENT |                  |     1.    69. 0 (100) | 00:00:01 |

    |   1.  UPDATE |                  |       |       |       |          |

    |   2.   KIND OF BUFFER.                  |       |       |       |          |

    |*  3 |    COUNT STOPKEY |                  |       |       |       |          |

    |*  4 |     TABLE ACCESS BY INDEX ROWID | TBLMIPPOOLDETAIL |     1.    69. 0 (0) | 00:00:01 |

    |*  5 |      INDEX RANGE SCAN | PK_MIPPOOLDETAIL |     1.       | 0 (0) | 00:00:01 |

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

    Information of predicates (identified by the operation identity card):

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

    3 - filter (ROWNUM = 1)

    4 filter (("RÉSERVÉ" EST NULL ou "RÉSERVÉ" = ' n ') AND ("LAST_UPDATED_TIME" IS NULL or))

    SYS_EXTRACT_UTC (INTERNAL_FUNCTION("LAST_UPDATED_TIME") + INTERVAL ' + 00 00:01:00 ' DAY (2) FOR)

    SECOND (0)) < SYS_EXTRACT_UTC (SYSTIMESTAMP (6)))

    5 - access ("IPPOOLID" = 1)

    Statistics

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

    1 recursive calls

    Gets hold of 6 db

    152842 compatible Gets

    0 physical reads

    636 redo size

    705 bytes sent via SQL * Net to client

    524 bytes received via SQL * Net from client

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

    3 sorts (memory)

    0 sorts (disk)

    1 rows processed

    We solved the performance problem by doing below changes

    1. NEW index

    CREATE INDEX IDX_IP_RESERVED ON TBLMIPPOOLDETAIL (RESERVED);

    1. INITRANS parameters

    ALTER TABLE TBLMIPPOOLDETAIL INITRANS 200;

    ALTER INDEX PK_MIPPOOLDETAIL INITRANS 200;

    ALTER INDEX IDX_CALLING_ID INITRANS 200;

    ALTER INDEX IDX_IPRESERVED INITRANS 200;

  • Failed to refresh the mview belonging to another schema

    Oracel 10 gr 2
    Solaris 10

    I have the following:
    1 materialized view called MV_A belonging to the schema SCH_A.
    2 SCH_A source table is TBL_B;
    3. TBL_B in the SCH_B schema. and
    4. a third schema, SCH_C, tries to run dbms_snapshot.refresh ("SCH_A.MV_A", "C");

    The error returned is:
    ERROR on line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2430
    ORA-06512: at line 1

    SCH_C has the following privileges:
    run on sys.dbms_snapshot;
    Insert MV_A priv; and
    Select on SCH_B.TBL_B

    This seems to be a simple question but I went through the documentation and research were unsuccessful. Thanks in advance.

    create the PL/SQL procedure named SCH_A_REFRESH belonged to SCH_A which is dbms_snapshot.refresh ("SCH_A.MV_A", "C");

    GRANT EXECUTE ON SCH_A_REFRESH TO SCH_C

  • ORA-01031: insufficient privileges while selectin view belongs to another schema in oracle database 11g

    Hello

    DB version 11.2.0.3.0

    We have a few views resides in the application schema, we cerated user and granted select on the view through the roles.

    but the user becomes ORA-01031: insufficient privileges when accessing the content view

    appreciated inputs

    BR

    Praaksh GR

    > I issued a grant select on Z.table - X with the option grant.

    This isn't what you need - you should

    Grant select on Z.table y with the option grant.

    Grant select on Y.view to X;

  • Do I have to reapply for grants and synonyms. Edit rename them to another scheme

    Hello

    We follow the process to replace some tables in UAT/PROD with the new table structure.

    Thus, for example, A table in a schema:

    Step 1 - create a TableA_NEW with the necessary structure and walls.
    Step 2-Insert into TableA_NEW select * from TableA.
    Step 3-Alter Table TableA rename TableA_OLD - take backup from TableA
    Step 4 - Alter Table TableA_NEW and rename the TableA - change the new ti from table Table of origin

    Now should I reapply all grants and synonyms initially applied to TableA.
    When I test in Dev, all grants and synonyms still stands. But I can't take any chances for UAT/PROD.

    Also when I restore these changes and rename the tables back to the original table.
    So should I reapply all grants and synonyms initially applied to TableA.


    Please suggest...

    user8941550 wrote:
    Hello

    We follow the process to replace some tables in UAT/PROD with the new table structure.

    Thus, for example, A table in a schema:

    Step 1 - create a TableA_NEW with the necessary structure and walls.
    Step 2-Insert into TableA_NEW select * from TableA.
    Step 3-Alter Table TableA rename TableA_OLD - take backup from TableA
    Step 4 - Alter Table TableA_NEW and rename the TableA - change the new ti from table Table of origin

    Now should I reapply all grants and synonyms initially applied to TableA.
    When I test in Dev, all grants and synonyms still stands. But I can't take any chances for UAT/PROD.

    Also when I restore these changes and rename the tables back to the original table.
    So should I reapply all grants and synonyms initially applied to TableA.

    Please suggest...

    Step 1 - create a TableA_NEW with the necessary structure and walls. New table - has no subsidies
    Step 2-Insert into TableA_NEW select * from TableA.
    Step 3 - Alter Table TableA and rename TableA_OLD - take backup of TableA Renamed table maintains subsidies. At this point invalid synonym
    Step 4 - Alter Table TableA_NEW and rename the TableA - changing new technology table original Table new table still has no subsidies, valid synonym now

    Thus, subsidies disappear, but means will be valid at the end of the process.

  • Code and the database tables in different schemas

    Hello
    My version of db: database Oracle 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    I would like to understand the advantages and disadvantages of the following situation:
    We have only one request.
    The design of the db for this application has 44 paintings, of which 28 are base tables related by PK and FK relations. The other 16 are look upward and refer to tables that are not related to one.
    The team has decided to place the tables in a diagram 28 A and the other 16 in another schema B within the same database. (The reason for this is... because it's done in other projects to do it here too).
    Coming now to the code (stored procedures, functions, packages, etc.). Teams want to ask most of the code in the diagram B with the Ref 16 tables. (the reason being again the same).
    What are the advantages and disadvantages this?
    Please advice.

    PS:
    I have googled and find something on these lines:
    cons:  
    o harder to manage
    o harder to upgrade
    o harder to patch
    o harder to maintain
    o causes your shared pool size to increase 1,000 times (shared sql goes down the tubes)
    o takes more space
    o queries against the dictionary will be impacted
    o latching on the shared pool goes WAY up (latching = locks = serialization device = 
    slows you down)
    
    pros:
    o none that I can think of.

    From my experience, if you see natural divisions that give you smaller patterns, well contained, you should take advantage of them and start with separate schemas. If done correctly, it can greatly improve the maintainability of your application.

    Assume that your initial project will have 60 paintings and they might fall into three groups of 15, 20 and 25 tables respectively. There are also objects of code such as PL/SQL packages. Your choice is:
    -Use a single scheme of 60 paintings, suppose that with 100 objects in code.
    -Use 3 diagrams divided as described. The total code objects will probably be a little more that unique schema design, because they need to provide interfaces with others. So let's assume that schemas will have 30, 40 and 50 code objects each.

    Now, wait 3 years.

    The history of single-schema:
    -The single-schema is passed to 120 tables. There has been a corresponding increase in code, now more than 200 objects. But they are very complex. Over time, each piece of code will interact with the tables more and more and many other objects in code.
    -You (the architect or Manager) can not really apply any internal for this structure since no subsidy is required to add dependencies. Therefore, if you change a table there is a vast impact.
    -You can easily divide the responsibilities because everything affects everything else. You can't manage simultaneous development efforts because the impact widespread changes cause the same tables/components to be affected by multiple projects. If you have the project execution dependencies / as you have interdependencies technique/code.
    -You have a "big ball of mud" and it is very difficult to get out of this situation.

    Multi-schema history:
    -Each of the 3 original patterns has grown, but some more than others. A fourth was added a year ago, when there was a major expansion in a new district, as a result of "natural divisions.
    -On the inside of each of these schemas, it is always a challenge to impose internal structure. But those patterns more smaller and therefore more small problems.
    -Through schemes, subsidies are necessary to allow interaction, this is not a "wild west" where everyone can access everything (and introduce dependencies on everything). Teams to define interfaces (packages or the views that are specifically intended to be interface points) where the interactions with other scehmas are necessary.
    -If changes to a table are needed, the impact can be limited to the schema that contains naturally. You know that no one else has created dependencies at this table, because you were never issued grants on this.
    -The responsibility for these schemas was divided between 2 teams, each team having full responsibility for its 2 diagrams.
    -Teams can complete projects much more easily, even with a parallel development, because there is less than a "domino effect" with each change.

    Now, these benefits depend on "natural divisions that give you the diagrams smaller, well contained." If you make the wrong choice here, you will always have a mess. You design with the end in mind scenario.

  • Grant the privilege to access HTTP with httpuritype

    Hi all

    With SQL Developer and DB - 12 c, perfectly executed the following:

    Insert in the values of service)

    1

    , httpuritype('__http://api.mercadopublico.cl/servicios/v1/publico/ordenesdecompra.xml?fecha=02032014&ticket=DF140AC7-B227-44C7-95DD-FEA0AF61C542').getxml)

    );

    but when I write a procedure like this:

    create or replace PROCEDURE GET_TICKET AS

    BEGIN

    Insert in the values of service)

    1

    , httpuritype('__http://api.mercadopublico.cl/servicios/v1/publico/ordenesdecompra.xml?fecha=02032014&ticket=DF140AC7-B227-44C7-95DD-FEA0AF61C542').getxml)

    );

    END GET_TICKET;


    gives this error:

    Connect to the ccs_xml database.

    ORA-29273: HTTP request failed

    ORA-24247: network access denied by access control list (ACL)

    ORA-06512: at "SYS." HTTPURITYPE", line 38

    ORA-06512: at "SYS." HTTPURITYPE", line 108

    ORA-06512: at "CCS_XML. GET_TICKET', line 3

    ORA-06512: at line 2

    Process is complete.

    Disconnection from the ccs_xml database.

    How do I grant the necessary privileges.

    your help is highly appreciated

    Best regards

    Carlos

    Yes, that's what I alluded to in your feed: How to import xml data from a site http with PL/SQL

    If you're on 11g, you may also need to set an ACL for the request.

    See this article for an overview of what you need to do, it applies to 11g and beyond:

    ORACLE-BASE-fine-grained Access to Services network in Oracle Database 11g Release 1

  • failed to connect the user had not granted the type of logon required on this computer

    W2K, Win XP Home, Win XP Vista Pro and al

    Some win appear XP OS like win 2 k professional versions, others as XP Home appear as WP Pro builds.
    The integrated network has a combination of these BONES still bastard licensed and the subject of errors occur

    "failed to connect the user didn't would have been granted the type of logon required on this computer.

    What sets with that?

    Never had this problem until that Microslop mixing and matching the OS with no sense of compatibility problems started

    IS THERE ANOTHER OS THAT WORKS THERE... PLEASE EXPLAIN!

    Frustrated and angry consumers of products Microslop

    Dave R

    check out this link and see how it works for you.

    http://forums.techguy.org/networking/533210-solved-user-has-not-been.html

  • ORA-06502: PL/SQL: digital error or the value in the conversion for a long TIME on the CLOB type

    Hello

    I have an EA of RDBMS Oracle 11.2.0.4.

    I ger the following error when I try to convert a data type LONG to type CLOB data thanks to a PL/SQL procedure:

    declare
    v_prefix varchar2 (20): = null;
    v_text_view_clob clob: = null;
    long v_text_view_long: = null;

    cursor c_v
    is
    Select
    a.view_name as view_name
    Of
    USER_VIEWS one;

    Start
    for r_v in c_v
    loop
    Start
    v_text_view_clob: = null;
    v_text_view_long: = null;

    -Do the SQL code of the view
    Select
    a.Text text
    in
    v_text_view_long
    Of
    USER_VIEWS one
    where
    a.view_name = r_v.view_name;

    v_text_view_clob: = v_text_view_long;

    update of ohibo_views one
    set
    a.view_text = v_text_view_clob
    where
    a.view_name = r_v.view_name;
    exception
    while others then
    dbms_output.put_line ('View =' | r_v.view_name |) "kan niet worden geconverteerd!");
    dbms_output.put_line (substr (sqlerrm, 1, 60));
    end;
    end loop;
    -commit;
    exception
    while others then
    lift;
    end;
    /

    I get the error a specific record:

    View = VER_POLISMUTATIES_VW kan niet worden geconverteerd!

    ORA-06502: PL/SQL: digital error or value

    At looked the origina; Value of type LONG and it is indeed a "long" piece of text.

    However, CLOB has a restriction about 4G * db_block_size and LONG 2 G - 1 according to the documentation.

    I should be able with the method above to convert a LONG in CLOB.

    Anyone had a similar situation?

    Thanks in advance for advice how to solve.

    Kind regards

    PS: my apologies, I didn't know which group to post this discussion: database or PL/SQL.

    Good indeed, a link with the right explanation.

    I didn't know that there was such a function.

    Thank you!

    Kind regards

  • Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    That question is ambiguous: there is NOT a SINGLE type of data that can be declared in pl/sql, but not in sql.

    The Oracle documentaton is your friend.

    The doc of the SQL language treats the SQL data types.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/datatype.htm

    The doc PL/SQL does PL/SQL data types. Because PL/SQL is a language of proceedings (and sql is NOT) there are several types of data, as shown in this doc, PL/SQL-specific:

    PL/SQL scalar data types are:

    • SQL data types
    • BOOLEAN
    • PLS_INTEGER
    • BINARY_INTEGER
    • REFCURSORexplained in "Cursor Variables"
    • User-defined subtypes

    ALWAYS start with the Oracle documentation for these fundamental questions.

    Several times, as with this question, the question is too general to give a simple answer.

  • Export as .xls. Classic report type: SQL (body of function from PL/SQL returning the SQL) query

    Hey guys,.

    I'm using version 4.2.6 apex. The theme is 26.

    IM also using Listener Oracle APEX.

    I can print my classic report in PDF or CSV format.

    But I need to export it as a .xls extension.

    Report type: SQL (body of function from PL/SQL returning the SQL) query

    I need is like this cause my 'where' clause type is dynamic.

    Look at using this method: Tom's Blog: a non-standard export excel 2010 (.xlsx)

    I do something similar for downloads to excel in my projects...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

Maybe you are looking for