No direct privilege to tables, instead via a procedure only

Guys,
I'm not very strong in writing pl/sql procedure, that's the reason coming to you "Gurus".
Need some help/guidance, in implementing this scenario:
Schema A owns a table: abcd & a procedure by the name xyz
Schema B needs to access this table; to do just insert & update, but no delete
Schema A has created a procedure xyz
Schema B can ONLY access this procedure xyz, to do this task (insert & update to table abcd), that's it, so he'll not be able to access the tables directly, but only via this xyz procedure owned by Schema A.
Please share your experienced thoughts to do this task, if possible to provide with examples that'll be of great help.
Best regards.

thanks guys, but here is the scenario:
we have SCOTT & DEMO
DEMO needs to insert & update only to SCOTT's EMP table, using SCOTT.MyPro (procedure)
can you please assist in creating this MyPro procedure,
or should I create 2 procedures or just one,
because there are 2 tasks: INSERT or UPDATE, how to do this,
thanks for you help & assistance.

Similar Messages

  • Grant Privilege to Role instead of Direct grant doesn't work

    Hi all
    My scenario is sas follow:
    create user a identified by a;
    create user b identified by b;
    grant connect,resource to a ;
    grant connect,resource to b ;
    conn a/a
    create table tbl( c1 number(10));
    conn system/sys
    create role roll;
    grant roll to b;
    conn a/a
    grant select on tbl to roll;
    conn b/b
    set role roll;
    create or replace procedure b.pr
    as
    v number(10);
    begin
    select a into v
    from a.tbl
    where a=0;
    end;
    show error
    Errors for PROCEDURE B.P:
    LINE/COL ERROR
    6/1 PL/SQL: SQL Statement ignored
    7/6 PL/SQL: ORA-00942: table or view does not exist
    This happen because i granted the SELECT privilege to user b through the role ROLL but if i granted the user b the SELECT privilege directly it work properly
    Why???
    And how could I grant the privilege from within a role, Because i don't want to grant it directly
    Thank in advance
    Bassil

    There is no other way. The owner of stored code must have been directly granted all necessary (used in code) select, insert, update, or delete privileges. The code owner cannot just have the referenced privileges granted to them via a role. There is no workaround, nor should there be as this is a security feature. Just because you have been granted insert or delete to another user's tables does not mean you should be able to grant that access to some other user. This is exactly what you do when you grant execute to stored code that referenced another user's objects.
    The referenced article is by Tom Kyte and there are few people who understand how to use Oracle to better effect than Tom. The same information can be found in the official documentation and is referenced by the article.
    You can write packages that use the privileges of the executing person. Perhaps for the specific problem you are writing the code to handle this is the route you want to take. See the manuals for the details.
    Note - If user A grants insert to user B on table_a then user B can write a procedure, proc_b, and grant execute to a role and anyone with the role can perform inserts into table_a via proc_b, without having any grants on table_a. You do not need to grant privileges on the objects referenced in stored code that runs as the code owner if this is what you are worried about. The users just need execute on the package, procedure, or function that performs the DML operations in this case and they can get that from a role.
    If you still do not understand you need to state exactly what it is you either do not understand or want to know how to do.
    HTH -- Mark D Powell --

  • Internal PLSQL Tables Access via SQL. But how ?

    Hello,
    I want to write the result of a database query in an internal PLSQL Table. After that i would like work with this internal PLSQL Table
    in a Package/Procedure/Function.
    Important for me is to access the internal Table via SQL because i have to refactor a package wich is working with 46 Database Tables an plain SQL. I
    would like to change these DB Tables into internal PLSQL Tables.
    I have written a short example wich will explain my approach to solving this problem.
    The syntax will be accepted by the Database but my 'dbms_output.put_line' statement at the end is empty or blank.
    What do i wrong ? Would be nice if anyone can help me out.
    With best regards
    Jens
    pre work :
    create table PERSON_DB_TABLE
    (SURNAME  VARCHAR2(50),
    LASTNAME VARCHAR2(50));
    insert into PERSON_DB_TABLE values
    ('JENS','FOERSTER');
    insert into PERSON_DB_TABLE values
    ('MAX','MEIER');
    insert into PERSON_DB_TABLE values
    ('MARTHA','MUSTERMANN');
    create type PERSON_OBJECT as object (
        SURNAME  VARCHAR2(50),
        LASTNAME VARCHAR2(50));
    create type PERSON_NESTED_TABLE as table of PERSON_OBJECT;
    now my anonymous block
    declare
       v_PERSON_OBJECT        PERSON_OBJECT;
       v_PERSON_NESTED_TABLE  PERSON_NESTED_TABLE;
       v_PERSON_OBJECT_2      PERSON_OBJECT;
    begin
       for v_counter in (select SURNAME, LASTNAME into v_PERSON_OBJECT.SURNAME,
                                                                                            v_PERSON_OBJECT.LASTNAME
                                  from PERSON_DB_TABLE)
         loop
            v_PERSON_NESTED_TABLE := PERSON_NESTED_TABLE(v_PERSON_OBJECT);
         end loop;
       for v_counter in (select SURNAME, LASTNAME into v_PERSON_OBJECT_2.SURNAME,
                                                                                            v_PERSON_OBJECT_2.LASTNAME
                                  from TABLE (v_PERSON_NESTED_TABLE))
         loop
            dbms_output.put_line(v_PERSON_OBJECT_2.LASTNAME);
         end loop; 
    end;

    1386a7b8-e834-43bf-a0d4-922b548bb70b wrote:
    I need this, because my customer didn't like the idea to use Database Tables instead of Variables in the RAM. So he wants this procedure redesigned.
    As Mike says, keep this person away from your database.
    Customers should not be dictating how to implement technical solutions, they should be providing business and logical requirements.
    PL/SQL arrays/collections use expensive PGA memory, taking up valuable server resources.
    Copying data from the database to PGA memory to try and process it using PL/SQL is bad design.  SQL is designed specifically for data manipulation using database tables, so it's the ideal way to do process data... directly on database tables.

  • How to install adobe reader to my site [removed] so that pdf file can be read directly in my site instead of getting downloaded ?

    How to install adobe reader to my site [spam link removed] so that pdf file can be read directly in my site instead of getting downloaded ?

    Adobe Reader is installed on the client side, not on the web server.
    Viewing PDFs online is a browser setting.
    Please do not post any irrelevant links!

  • How to Divert the changes to cdhdr table instead of dbtablog?

    Hai everybody.
    I am new to this forum. i got a job in abap recently. The below is my requirement.I want solution for this one. Anybody plz help me.
    I am having ztransaction.
    The change logs already were captured in DBTABLOG for table ZWPRFRUND (in transaction ZWPG).
    The only report which is currently used to get the change logs is RSVTPROT
    Now my requirement is,
    we need to display the change logs in the form of ALV.
    We should divert the changes to CDHDR table instead of DBTABLOG, then we can use the RSSCD100 to display change logs.
    The Important items for the change LOG needed in case of changes to table in “ZWPG” are,DATE ,TIME,USER,FIRST NAME,FILED NAME,OLD VALUE,NEW VALUE
    The above fields need to be displayed in the grid. In the above list “FIELD NAME” denotes any field of the table in the transaction in “ZWPG”
    Thanks & Regards,
    Sujatha.T.

    Check out my post in this thread:
    How to record add-on table change logs?
    You need to define a change document type and generate relevant code for this.
    Andrew

  • Update the functional area (AUFK-FUNC_AREA) directly in the table AUFK

    Hello,
    The OSS note 150959 gives a report, which directly updates the table field AUFK-PRCTR (profit center). Have you ever tried the same thing with the Functional Area (I am afraid to cause database incoherencies, if I do this) ?
    We have to do this both for production and maintenance orders.
    Thank's a lot for your answer.
    Best regards,
    Holger

    Hello Rajesha,
    We have to make a mass update of all  production and maintenance orders in our system.
    So we have to write a program, which is doing this.
    In order to avoid the direct update of the table AUFK, we will write a batch input.
    Best regards,
    Holger

  • Logical sql firing larger aggregate table instead of smaller one

    Hi
    When we process a request containing one particular column alone along with some time dimension say month or year, the logical sql is firing larger aggregare table instead of smaller aggregate table. Please, help us in resolving this issue.
    The OracleBI version we are using is 10.1.3.4.1
    Thanks.

    Hi,
    Try posting in the OLAP forum.
    OLAP
    Thanks, Mark

  • #datasync error - could that come from merging on fields from fact tables instead of dimensions tables?

    I'm reporting out of two universes published by Epic
    1. Warehouse - Patient
    2. Warehouse - Transactions
    I wanted to join two queries based on the primary key for a hospital encounter. Following the tutorial seemed pretty straightforward until I got to displaying data from a merged query.
    The table displayed results from Query1, but adding fields from Query2 wiped out all the data in the table, leaving only #datasync in each field.
    My workaround to get fields from both queries displayed (see screenshot)
    1. Merge queries on *two* fields - primary key of hospital encounter and primary key of patient
    2. Create new variable
    3. Make variable type Detail
    4. Associate variable with hospital encounter key from Query1
    5. Set formula equal to a field from Query2
    I'm not sure why this workaround works or if what I'm experiencing is a symptom of something larger. Could this workaround be needed because I am merging on fields from a fact table instead of fields from a dimension table?
    Thanks in advance

    You have defined merged dimension on 'company code-Key' which is common in both the Bex-queries.
    You are able to bring the merged dimension and other objects from  Query_ One to report block without any issue but when adding objects from Query_Two you are getting the error #DATASYNC.
    In this case objects from Query_One are got sync with the merged dimension object without any issue because they got added first to it.
    Similarly when you add merged dimension and objects from Query_Two you find no issue, because objects from Query_Two go sync first.
    Once objects from a query(Query_One/Query_Two) got added to a merged dimension, when we try adding objects from other query we get #DATASYNC error. This is because data in the other query is not able to sync with the initial result set, this is a know behavior.
    There are two workarounds:
    1) Merging all common dimension/characteristic objects: Only merged dimensions data will sync with the initial query,  un-merged dimensions/characteristic objects will still give #DATASYNC error.
    2) Create detail objects/attribute objects at report level for all uncommon characteristic/dimension objects from query_two referring to merged dimension. Then add these newly created detail/attribute objects to the table block that is having initial query objects with merged dimension, with this you see result set of query_two in the table block  not #DATASYNC error.
    ~ Manoj

  • Is direct GL account entry possible via EDI invoic message type?

    Is direct GL account entry possible via EDI invoic message type? Is there a field in Invoic Idoc that matches the direct GL entry field. Some vendors may have surcharge other than tax and unplanned delivery.

    This functionality is not available as standard. However, from release 470, you can use customer exit EXIT_SAPLMRMH_015 for direct posting to the G/L account or material account.
    Please have a look at attached note 427137.

  • Re : When to Use tables instead of Cursors in Stores Procedures

    Hello All,
    Hope all is well. I know this is very broad questions and requires more specifics. All, I am trying to understand from very high level is to what are some of the instances when one would prefer to have physical/temp tables instead of using cursors in SP. Generic Pointers would really be helpful.
    Thanks in advance,
    Sam

    You are comparing apples and oranges here.
    A cursor is a work area where oracle stores the procession information when it executes a multi-row query.
    Lets say you have a sql query like this
    select * from empWhen such a query is executed oracle allocates a work area where the processing information of the query is stored. This
    is called a cursor. You can explicitly define a cursor like this.
    cursor c_emp
    is
    select * from empIn this case you are giving a name to the work area allocated by oracle. Now you can use this name c_emp to access the
    result set sequentially.
    On the other hand a Table is an oracle Object. It is a logical representation of your physical data.
    Data in a table can be manipulated meaning, you can insert, update or delete it. Data in a table is persistent.
    So i don't think a comparison between this two is appropriate.
    Thanks,
    Karthick.

  • How we can attach search help directly to the table field / structure field

    Hi All,
       Can you please let me know the step by step procedure of How we can attach search help directly to the table field / structure field.
    Regards,
    jaya

    Hi Jaya,
    1. Create a search help using SE11.
    2. Include this search help in the field of table in SE11. There is a tab in the table defination where you can specify the search help.
    Even you can specify search help at data element level, screen field level.
    Reward points if useul.
    Regards,
    Atish

  • How to record Itunes songs direct to a Stick instead of a CD, How to record Itunes songs direct to a Stick instead of a CD

    I want to record itunes songs from my files direct to a Stick instead of a
    CD.....How is this done ?"  Is there a command for it I can't find ???
    Thanks for any help I get.....My new car has a USB input so if I can
    put music on a USB stick, it will help with storage, etc....

    Insert the stick into the USB port on your computer, and open it so it looks like a window.
    Highlight the tracks you want in iTunes, and drag them to that window. 
    This procedure will put copies onto the stick without changing anything in your library.
    (If you normally run iTunes in full-screen mode, make it smaller so that you can do the drag-n-drop.)

  • Powerpivot charting: Trying to create a chart in PowerPivot but it creates a table instead.

    I do click the ICON for charting but the application seems to ignore the request and creates the table instead.  I have uninstalled and reinstalled several times but it has not made a difference.

    Hello,
    Please take a look at the following articles to create a PivotChart from PowerPivot data:
    Create a PivotChart from PowerPivot Data (Tutorial):
    http://technet.microsoft.com/en-us/library/gg413426.aspx
    How to: Create A Pivotchart From PowerPivot Data:
    http://www.youtube.com/watch?v=AJB4iB6wXgc
    Regards,
    Elvis Long
    TechNet Community Support

  • Tables created via SQL...

    There is a way to show information stored in a table creadted via SQL in the SBO Print Forms ?

    Hello!
    yes, this will work as such, but might not give you the
    correct values as there is no link between the table and the layout! Usually, it pulls simply the first value in the table.
    Or, you might be lucky that it works now, but not after an upgrade.
    Be careful when adding field with "ALT", if you encounter problems at any stage, you will not receive any support!
    When adding fields via "ALT", check if you can create manual links between the table and the layout via "next segment" and "link to".
    Kind regards

  • Update a database table column via EO

    Hi,
    I want to update a database table column via EO, but somehow the table column is not updated. Could you help if I miss anything?
    Here is my code:
    View SQL:
    select
    ,GoalSheetHeaderEO.srp_goal_header_id
    ,XL.MEANING
    ,GoalSheetHeaderEO.status_code
    ,GoalSheetHeaderEO.start_date GS_START_DATE
    ,GoalSheetHeaderEO.end_date GS_END_DATE
    ,GoalSheetHeaderEO.PERIOD_YEAR
    ,GoalSheetHeaderEO.LAST_UPDATED_BY
    ,GoalSheetHeaderEO.LAST_UPDATE_DATE
    ,GoalSheetHeaderEO.LAST_UPDATE_LOGIN
    ,'N' CHECKED
    from
    xxg2c_srp_goal_headers_all GoalSheetHeaderEO
    ,cn_comp_plans_all comp
    ,jtf_rs_salesreps rs
    ,jtf_rs_resource_extns rse
    ,xxg2c_lookups xl
    ,shr_strct_nodes nod
    ,g2c_goal_shr_emp_assignments_v emp
    CO:
    if (pageContext.getParameter("Update") != null){
    am.invokeMethod("updateGoalSheet");
    AM:
    public void deleteGoalSheet(){
    OAViewObject vo = (OAViewObject)getGoalSheetResultGAVO1();
    GoalSheetResultGAVORowImpl row = (GoalSheetResultGAVORowImpl) vo.first();
    while (row != null)
    if (selectFlag != null)
    if (selectFlag .equals("Y"))
    //row.setAttribute("GsStatusCode",Constants.GOAL_SHEET_STATUS_CODE_DEL);
    row.setStatusCode(Constants.GOAL_SHEET_STATUS_CODE_DEL);
    row = (GoalSheetResultGAVORowImpl) vo.next();
    getTransaction().commit();
    EO:
    public void setStatusCode(String value) {
    if (value.equals(Constants.GOAL_SHEET_STATUS_CODE_DEL)){
    String currentStatus = getStatusCode();
    if(!(currentStatus.equals(Constants.GOAL_SHEET_STATUS_CODE_INPROG)
    ||currentStatus.equals(Constants.GOAL_SHEET_STATUS_CODE_RDYAUD))){
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(),
    getPrimaryKey(),
    "StatusCode",
    value,
    "xxg2c goaling",
    "DEBUG -- need message name"
    setAttributeInternal(STATUSCODE, value);
    thanks
    Lei

    Hi Vikram,
    It is just a type error. The delete is a soft delete to change the status to 'DEL'.
    And also the view object is hybrid view object.
    Complete View Object SQL:
    select
    nod.node_id
    ,nod.version_id
    ,emp.status_name
    ,rs.SALESREP_ID
    ,rse.source_name
    ,rse.source_email SRP_EMAIL_ID
    ,rse.source_number SRP_EMPLOYEE_NUMBER
    ,comp.name
    ,GoalSheetHeaderEO.srp_goal_header_id
    ,XL.MEANING
    ,GoalSheetHeaderEO.status_code
    ,GoalSheetHeaderEO.start_date GS_START_DATE
    ,GoalSheetHeaderEO.end_date GS_END_DATE
    ,GoalSheetHeaderEO.PERIOD_YEAR
    ,GoalSheetHeaderEO.LAST_UPDATED_BY
    ,GoalSheetHeaderEO.LAST_UPDATE_DATE
    ,GoalSheetHeaderEO.LAST_UPDATE_LOGIN
    ,DECODE(GoalSheetHeaderEO.PERIOD_YEAR,(SELECT PERIOD_YEAR FROM GL_PERIODS WHERE PERIOD_SET_NAME = 'Fiscal Year' AND SYSDATE BETWEEN YEAR_START_DATE AND END_DATE),DECODE(GoalSheetHeaderEO.STATUS_CODE,'AUTH','copy_enabled','copy_disabled'),'copy_disabled') COPY_FLAG
    ,DECODE(GoalSheetHeaderEO.SRP_GOAL_HEADER_ID,null,'create_enabled',DECODE(GoalSheetHeaderEO.status_code,'AUTH','create_enabled','create_disabled')) CREATE_FLAG
    ,'N' CHECKED
    from
    xxg2c_srp_goal_headers_all GoalSheetHeaderEO
    ,cn_comp_plans_all comp
    ,jtf_rs_salesreps rs
    ,jtf_rs_resource_extns rse
    ,xxg2c_lookups xl
    ,shr_strct_nodes nod
    ,g2c_goal_shr_emp_assignments_v emp
    public void updateGoalSheet(){
    OAViewObject vo = (OAViewObject)getGoalSheetResultGAVO1();
    GoalSheetResultGAVORowImpl row = (GoalSheetResultGAVORowImpl) vo.first();
    while (row != null)
    if (selectFlag != null)
    if (selectFlag .equals("Y"))
    //row.setAttribute("GsStatusCode",Constants.GOAL_SHEET_STATUS_CODE_DEL);
    row.setStatusCode(Constants.GOAL_SHEET_STATUS_CODE_DEL);
    row = (GoalSheetResultGAVORowImpl) vo.next();
    getTransaction().commit();
    thanks for the help.
    Lei

Maybe you are looking for

  • IPOD OK in Windows, Diagnostics in iTunes can see it, but it's not listed.

    Hello, I have a 5th Gen iPOD and use iTunes V8.1.0.52 (latest) in Windows Vista on a PC. When I connect the iPod to the PC, Windows recognised it as disk F, and iTunes starts up automatically. However, the device does not appear in the iTunes Source

  • Trying to add a External Hard drive can some one help

    Hey, I got a hardrive docking station so that I could transfer over important files from my old hard drive to my new one.. But when I go to disk managment to try and set it up, it sees it, but says that the disk is Unkown & Unreadable.. I tried right

  • Can Quicktime be set to record on Voice activation?

    Can Quicktime or Quicktime Pro be set up to be Voice Activated, and stay on during a sleep mode to moniter suroundings? Is there any other Programs that would serve the purpose?? bobt

  • Multi Table GL Import

    We are trying to use a custom table for importing/posting journals in GL. Is it sufficient to enter the custom table name in GL_INTERFACE_CONTROL? Or any other changes necessary? Thanks Raghu.

  • Ho regarding authorization group...

    hi all...    i need to create authorization group for the report programs.....i tries in se54 but this is for only tables..how can we create the authorization group for the report programs....pls guided me in this