PL/SQL, synonyms to packages and name resolution

I have some question about name resolution in PL/SQL. First, I need to describe situation, because it is quite complicated.
There are three schemas: A1, B1 and O. A1 and B1 are containing proprietary software and I cannot modify objects there (but I can modify configuration tables, so in this way I can call any package from anyhere). O schema is my own schema. A1 and B1 schemas are in one "module", there are also A2 and B2 schemas in second "module" and AN and BN in n-th "module".
In normal situation, A1 schema contains synonym to package B1.PKG (on B1 schema) and uses it to call B1.PKG with DEFINER rights. The same for every "module".
I need to extend some functionality of B.PKG by buliding some kind of "wrapper" on my own O schema. It is only one MY_PKG and should be used by every "module". In this place I need some kind of magic :)
I want to place package MY_PKG with AUTH_ID CURRENT_USER clause on my O schema and use A1..AN schema to call it. Package MY_PKG have to call package placed on one of B1..BN schemas, so I need to create synonym on O schema for package, for example, B1.PKG just to compile the MY_PKG package.
Now, I call MY_PKG package from A1 schema and I expect MY_PKG will use synonym to B1.PKG placed on A1 schema, instead of using synonym on my O schema. That's not happening. MY_PKG still uses synonym on O schema, so it ruins whole concept :)
Actually, I use some set of packages that already work properly in that way, but there is some difference. In my other packages I use SQL and synonyms to tables and views placed on _one_ A schema. I use those synonyms only for compiling. When packages are calling from A1..AN schemas, they use proper objects on proper A1..AN schema. In this case I try to do the same, but with package instead of tables and view. I find it difficult probably because SQL and PLSQL resolves names in other way.
Here is the question, is it possible to make such thing as decribed above? Of course, I can use execute immediate to run proper packages directly from O schema, but I don't want :)
Sorry for my bad english, I hope you understand whole concept.
DB version: 11.2.0.3

The documentation is pretty clear that invoker rights applies only to certain statements...
Using PL/SQL Subprograms
SELECT, INSERT, UPDATE, and DELETE data manipulation statements
The LOCKTABLE transaction control statement
OPEN and OPEN-FOR cursor control statements
EXECUTEIMMEDIATE and OPEN-FOR-USING dynamic SQL statements
SQL statements parsed using DBMS_SQL.PARSE()
So clearly static PL/SQL references will not be resolved in this way.
I can't actually remember (I have found AUTHID CURRENT_USER to be very rarely useful) but you may be able to get around this by executing dynamic PL/SQL blocks but given the potential downsides of dynamic SQL and PL/SQL you almost certainly don't want to.

Similar Messages

  • Why apps don't need to be granted for synonyms of packages and procedures?

    Normally, When a user create a synonym of other schemas' package or procedure, it requires to be authorized to execute via 'grant' by owner before the user can call it.
    But on one of our environment of EBS 12.1.1(vis), apps user don't need to be granted. Just need to make synonym and then can call the synonym. while on another environment of EBS 12.1.1(product), it still need to be granted. I notice that apps user in the two diffierent environment has many different database roles. Is any role associated with this? Does anybody know the reason?
    Thanks in advance!
    Jing
    Edited by: user12954958 on Aug 25, 2010 11:44 PM

    Hi Jing;
    Please check below thread which is posted Hussein Sawwan
    Re: apps & applsys password
    aaps,applsyspub,applsys
    Re: apps & applsys password
    Regard
    Helios

  • Package/Class name resolution issue

    Hey guys!
    I have an application called Infused. I also have a package called Managers with a class called DataManager which extends HTTPService.
    In a function in DataManager I need to call a public function that exists in Infused.
    Now, if the application is called Infused, then it's default class must be called Infused too, right?
    But when I called Infused.loginResult(evt) I get the error: Access of possibly undefined method loginResult through a reference with static type Class.
    I assumed the applications class would be in the global namespace and accessible. Am I wrong? And if so how can I call the function?
    Also, in the applications main class I have a number of functions called xxxResult which I need to call depending on a string that is passed in to the class request function. So the request function may receive 'login', and so the function to call in Infused would be 'loginResult'.
    How can I call the function based on this string? I know I could do Class[functionName]() if the function where in the same class, but will the answe to my first question lead to the obvious solution for the second?
    I am a PHP5 OOP developer learning Flex, so please forgive my dumbassness
    Thanks for any help.
    Paul.

    But when I called Infused.loginResult(evt) I get the error: Access of
    possibly undefined method loginResult through a reference with static
    type Class.
    You can't call instance methods like that. You'd need to make the method static, or alternately, call Infused(Application.application).loginResult(evt). After you make either change, you should be able to use the ['functionName']() approach.
    Keep in mind, though, that you're coupling your DataManager to your application with this approach. This might be fine for a small app, but take a look at Mate (or some of the other MVC frameworks) to see how to reduce or avoid this sort of coupling.

  • 10.1.3.0 install on solaris em  url fails and name resolution fails

    Hi
    I wondered if anybody would know this. I installed 10.1.3.0 app server on solaris and my hosts file is ok I can resolve mymachine.domain.com. The install is a clean 10.1.3.0 install. I have the 9.2.0.7 db installed elsewhere on the box.
    Opmnctl tells me that my oc4j and http instances are alive (home) and i can get to the first http page.
    http://<ipaddress>:7777
    with no problems but when i click on the link on the rhs redirection to the http://<ipaddress>:7777/em url fails so i cannot get the console up.
    Question is why is the em not responsiong but it appears to be running and installed ok.
    Question 2 is why does the em link resolve to localhost when i go to the em.
    Hosts file looks ok and seems to resolve with ping. Machine is on network but not in any dns.
    Has anybody got any suggestions? There is absolutely 0 error messages in the logfiles.
    I have installed other servers in the past without any issues at all at other places on other machines.
    Thanks

    If you check the logs of ons, you can check which IP opmn is bound to. This might end up being localhost, instead of public. This might have to do something with this EM issue. By adding <ipaddr request="$PUBLIC_IP" remote="$PUBLIC_IP" /> to opmn.xml this can be solved (please do check the documentation for the exact syntax!!!!)
    Could you also check what servername is defined in your httpd.conf, this might have something to do with the resolving thing (also check useCaconicalName parameter)

  • Creating Packages and Namespace for Webdynpro Java applications in NWDS

    Hi Experts,
    I am working on a stand alone application and using NWDS for the same. This application consist of some Webdynpro Java apps, Dictionary perspective DC's and BPM applications.
    I need to create a package and name space for all the applications. I have read some documents on creating SC in SLD and using it in NWDI. But since I am working on NWDS i am not able to see the SC.
    May be I am not following a correct procedure. Can some one provide a basic document or can tell me steps in short that i need to follow, for Name space and package creation and how to use them in NWDS.
    I am working on CE7.1 ehp1.
    Regards
    Pranav

    HI,
    This blog expalins how to Setup and configure NWDI System land scape:
    /people/bhavana.gupta/blog/2007/01/23/installation-and-configuration-of-netweaver-development-infrastructure-was-64
    NWDI Post installation:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/419b479b-0801-0010-f8a1-c26208b4b209
    http://help.sap.com/saphelp_nw70/helpdata/en/44/60dc1943c2311ce10000000a155369/frameset.htm
    Complete NWDI Resources:
    NWDI Resources [original link is broken]
    Thanks
    SrinivaS

  • Name Resolution:Package vs schema

    I have two schema
    1.userA
    2.userB
    In userA I have function test1 & test2
    In userB I have a package userA which has a function test1;
    userB is granted permission to execute test1 and test2 in userA
    grant execute on userA.test1 to userB;
    grant execute on userA.test2 to userB;
    Now I am logged in as userB and execute the following
    select userA.test1(3) from dual;
    Function in package userB is executed;
    select userA.test2(3) from dual;
    It gives the error userA.test2 invalid identifier...
    Now here is my inference..
    When SQL encounters an identifier it first searches for packages...If a package is found all further resolutions are based on that package..So it never finds test2..
    Is this right?I needed confirmation on this
    thanks in advance

    From the "Oracle® Database PL/SQL User's Guide and Reference 10g Release 2 (10.2)" Appendix B section titled "Differences in Name Resolution Between PL/SQL and SQL"
    The name resolution rules for PL/SQL and SQL are similar. You can avoid the few differences if you follow the capture avoidance rules. For compatibility, the SQL rules are more permissive than the PL/SQL rules. SQL rules, which are mostly context sensitive, recognize as legal more situations and DML statements than the PL/SQL rules.
    * PL/SQL uses the same name-resolution rules as SQL when the PL/SQL compiler processes a SQL statement, such as a DML statement. For example, for a name such as HR.JOBS, SQL matches objects in the HR schema first, then packages, types, tables, and views in the current schema.
    * PL/SQL uses a different order to resolve names in PL/SQL statements such as assignments and procedure calls. In the case of a name HR.JOBS, PL/SQL searches first for packages, types, tables, and views named HR in the current schema, then for objects in the HR schema.

  • Find all Package and their related Procedure Names using a specifc Table

    I have 25 Packages
    Each Package holds 30-35 Procedures
    I need to find out all Packages and Procedures
    Each Procedure handles 5 - 20 Tables as Per The Need of Business Rule.
    I need All Package and Related Procedure Names Where a Specific Table Name Appears(DBA_SOURCE doesn't serve purpose.)
    Early Reply Appreciated.
    Thanks and Regards,

    I tried the solution provided to me, but unfortunately the issue remains the same.
    I was Advised to Execute the SQL utldtree.Sql, and then Execute deptree_fill.
    The output is given by a Table DEPTREE (Columns are: .'NESTED_LEVEL', 'TYPE', 'SCHEMA', 'NAME' and 'SEQ#')
    The output I am getting From the Table DEPTREE is as follows -
    Column TYPE value is PACKAGE; Column NAME Value is ACTUAL PACKAGE NAME
    Column TYPE value is PACKAGE BODY; Column NAME Value is ACTUAL PACKAGE NAME
    This repeats till the count the TABLE Name is found in the same PACKAGE
    Desired Output should be -
    Column TYPE value PACKAGE; Column NAME Value ACTUAL PACKAGE NAME
    Column TYPE value PACKAGE BODY; Column NAME Value ACTUAL PACKAGE BODY NAME
    This should repeat till the count the TABLE Name appears in different PACKAGE BODY of the same PACKAGE
    Warm Regards,

  • Extracting package and procedure name in code

    In my exception processing I need to log the package and procedure name that got the exception. How do I obtain these two names without manually coding the names?
    Thanks in anticipiation

    A better option is to get the package name and the line numberA still better option is to utilize pl/scope (when you are in 11g (not sure about 10g)):
    SQL> alter session set plscope_settings='identifiers:all'
    Session altered.
    SQL> set serverout on
    SQL> create or replace package pkg
    as
       procedure p1;
       procedure p2;
    end pkg;
    Package created.
    SQL> create or replace package body pkg
    as
       procedure get_scope (obj varchar2, line int)
       as
       begin
          for c in (select rpad (lpad (' ', 2 * (level - 1)) || name, 20, '.') || ' ' || rpad (type, 20) || rpad (usage, 20) identifier_usage_contexts
                    from user_identifiers t
                    where level != 1
                    start with line = get_scope.line and object_name = obj
                    connect by usage_id = prior usage_context_id)
          loop
             dbms_output.put_line (c.identifier_usage_contexts);
          end loop;
       end get_scope;
       procedure p1
       as
       begin
          null;
       end p1;
       procedure p2
       as
       begin
          get_scope ($$plsql_unit, $$plsql_line);
       end p2;
    end pkg;
    Package body created.
    SQL> exec pkg.p2
      P2................ PROCEDURE           DEFINITION         
        PKG............. PACKAGE             DEFINITION         
        PKG............. PACKAGE             DECLARATION        
    PL/SQL procedure successfully completed.

  • "There are errors in one or more PL/SQL packages and functions"

    Hi all,
    first of all - my configuration:
    - OWB 10.0.3.0
    - one Server HP-UX
    - two oracle database instances (plato and platodev)
    My problem:
    when i try to start "Deployment Manager" and try to connect to the platodev instance i get the RTC-5260 and ORA-01017.
    I have no problems to connect to the second instance "plato".
    The output of service_doctor is as followed:
    ===================
    SQL> @service_doctor
    There are errors in one or more PL/SQL packages and functionsPlatform properties have been loaded correctly
    Platform location has been seeded correctly
    NLS messages have been loaded correctly
    The platform service is available
    There is a problem accessing the service startup script from the databaseserver
    Here is the detailed error message which contains the name of the startscript file:-
    The runtime property 'service_command' either does not exist orcannot be read successfully
    oracle.jdbc.driver.OracleSQLException: ORA-00942:
    table or view does not exist
    Please verify that the disk containing the file is visible to thedatabase server
    Please verify that the database server account has access rights on thefile
    There is a problem with the repository connection information used tostart the service
    Here is the detailed error message which contains the connectioninformation passed to the service:-
    Cannot retrieve the repository owner host, port, service-name fromwithin the database server
    Please verify that this information is accurate
    If this information is correct, then please use the'set_repository_password.sql' script to reset the stored password
    PL/SQL procedure successfully completed.
    ================================0
    I did not change the password.
    Can anyone help me?
    I appreciate your help.
    Thank you

    Solved!
    It was a wrong entry in wb_rt_service_nodes column service_name.

  • Will dynamic Excel commands in a C# Edit Script run ok as a SSISDB Package and a SQL Server Agent Job?

    I've seen some conflicting things in terms of dynamic Excel commands running in a SSISDB Package and a scheduled SQL Server Agent Job...things like that it's not supported...that it won't work...etc...
    It's a pretty simple script...to open up a .xlsx file and save it as a .xls file. I am trying to be proactive here and the reason I did it this way is because I could not source the .xlsx file and then I couldn't use OLE DB sourcing because I think the .xlsx
    file wants you to use Microsoft.ACE.OLEDB.12.0 and that entails installing the 64-bit Microsoft Access Database Engine and I cannot do that because our network version of Microsoft Office 2010 is 32-bit and in order to install the 64-bit Microsoft Access Database
    Engine 2010 it's prompting me to uninstall Microsoft Office 2010 and that is not possible.
    Ugh!
    So I'm hoping that I can promote and deploy this current SSIS Package to Production and create a SQL Server Agent Job that will successfully run this and its dynamic Excel commands.
    Do you know of any hurdles with this? Any anomalies...struggles...
    Thanks for your review and am hopeful for a reply.
    Here's the C# Script...which works perfectly client side...
    string StrFileName = (Dts.Variables["User::FileName"].Value.ToString());
    StrFileName = Path.GetFileNameWithoutExtension(StrFileName);
    string StringSourceFile = (Dts.Variables["User::FilePath"].Value.ToString()) + StrFileName + ".xlsx";
    string StringDestinationFile = (Dts.Variables["User::FilePath"].Value.ToString()) + StrFileName + ".xls";
    // This initiates the Excel Application
    Microsoft.Office.Interop.Excel.Application excelApplication = new Microsoft.Office.Interop.Excel.Application();
    // This Opens the Source .xlsx File from Emdeon ePaySmart
    Workbook workbook = excelApplication.Workbooks.Open(StringSourceFile, XlUpdateLinks.xlUpdateLinksNever, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    // This will Save the Source .xlsx Emdeon ePaySmart File as a .xls File...note xlFileFormat.xlExcel5
    workbook.SaveAs(StringDestinationFile, XlFileFormat.xlExcel8, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    // This will Close the Source
    workbook.Close(false, Type.Missing, Type.Missing);
    // This shuts down the Excel Application
    excelApplication.Quit();

    This should work if you use a proxy to run this package in the Agent; see:
    http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Arthur
    MyBlog
    Twitter

  • SQL 2012 SSIS package runs from the command line (dtexec.exe) and completes right away ...

    Hi
    I’m upgrading our SSIS packages from SQL 2005 to SQL 2012 .
    Everything is working fine in Visual Studio, but when I’m submitting dtexec.exe it’s finishing right away in the command line (the actual execution takes long time). 
    It looks to me that as the return code doesn’t pass properly.
    As I have depending tasks how I can make sure all jobs will be executed in the proper order.
    (We never had this issue in SQL 2005)
    C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn>dtexec.exe /ISSERVER "\"\SSISDB\Direct_Prod\Direct_SSIS_Package
    \DD_Load_Customer.dtsx\"" /SERVER TORSQLSIS01 /ENVREFERENCE 2
    Microsoft (R) SQL Server Execute Package Utility
    Version 11.0.2100.60 for 32-bit
    Copyright (C) Microsoft Corporation. All rights reserved.
    Started:  10:21:55 AM
    Execution ID: 21138.
    To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report
    Started:  10:21:55 AM
    Finished: 10:21:56 AM
    Elapsed:  0.766 seconds

    As per MSDN /ENVREFERENCE argument is used only by SQL Server Agent
    see
    https://msdn.microsoft.com/en-us/library/hh231187.aspx
    below part is what it says
    /Env[Reference] environment reference ID
    (Optional). Specifies the environment reference (ID) that is used by the package execution, for a package that is deployed to the Integration Services server. The parameters configured to bind
    to variables will use the values of the variables that are contained in the environment.
    You use /Env[Reference] option together with the /ISServer and the /Server options.
    This parameter is used by SQL Server Agent.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Sql developer doesn't show any packages and procedure.

    Hi All,
    I am perty new here and I am facing a strange problem in SQL DEVELOPER. I have one schema and it has packages and functions created in it, but when I click
    packages or functions in sql developer it says table or views does not exist. however, I can see those packages and procedures from sql plus and oracle enterprise manager. you swift reply would be highly appriciated
    hare krishna
    Alok

    Which version of sqldeveloper?
    Which version of Oracle?
    This sounds like an old bug where sqldeveloper checked for 'select any table', but you actually need 'select any dictionary'

  • Find monitor instance name , device name , resolution and frequency of multiple monitors (VGA and HDMI)

    hi,
    In my system multiple monitors are connected (VGA and  HDMI). In need to know the
    monitor instance name , device name , resolution and frequency of each monitor.. any solution?
    i used wm class 'WmiMonitorConnectionParams'  to determine Video output technology connection type and InstanceName.
    But i didn't get the device name , resolution and frequency of each monitor.??
    There are other wmi class like :
    WmiMonitorBrightnessEvent 
    WmiMonitorConnectionParams 
    WmiMonitorRawEEdidV1Block 
    WmiMonitorListedFrequencyRanges 
    WmiMonitorDigitalVideoInputParams 
    WmiMonitorAnalogVideoInputParams 
    WmiMonitorID 
    WmiMonitorBrightnessMethods 
    WmiMonitorBasicDisplayParams 
    WmiMonitorColorCharacteristics 
    WmiMonitorDescriptorMethods 
    WmiMonitorListedSupportedSourceM… 
    WmiMonitorBrightness 
    WmiMonitorColorXYZinCIE 
    WmiMonitorSupportedDisplayFeatures
     WmiMonitorBasicDisplayParams
     Win32_VideoController
    Win32_VideoConfiguration
    Win32_VideoSettings Win32_DisplayControllerConfiguration
    Win32_DisplayConfiguration
    But unable to determine monitor having  its corresponding values? please help me to find a solution .
    is there any other method to get multi monitor details?
    thank  you

    Hi sumith,
    I read some documents about WmiMonitorConnectionParams class, it should be able to get the video putput technology by the D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY enumeration.
    D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY enumeration
    So what happens when you are using WmiMonitorConnectionParams class? What prevent you? Anyway, please see a example of using WmiMonitorConnectionParams class, maybe you could get some hints on it.
    http://stackoverflow.com/questions/10085900/querying-wmi-for-d3dkmdt-video-output-technology
    Best regards,
    Shu Hu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • PL/SQL Packages and Types Reference

    I need information about the owa_ packages. It should be in PL/SQL Packages and Types Reference, but in the 9i Documentation there is nothing about these packages and i cant find this Documentation for 10g on OTN.
    Who can help me???

    Here is the 9.2 doc:
    http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adgweb.htm#1005885
    Tom Best

  • SubVersion in SQL Developer - how to link to packages and procedures

    My question is this - I am starting out using SubVersion in Oracle and it seems pretty straightforward to use as a source control for files that are stored in a Windows directory, that is the only way I have used it so far.
    Am I able to use it to control packages and procedures that I have saved as part of my database, ie the procedures are part of a package and the package appears within the Packages section of the appropriate connection in SQL Developer.
    I hope this makes sense.
    Cheers,
    JabJam

    Hi JabJam,
    So far, everyone is correct. SQL Developer just uses a file-based source control system (e.g., SVN), which means updating database object definitions via scripts under version control, or somehow exporting the new definition to a script so it can be version controlled after the fact. And wouldn't it be nice if the database objects could be version controlled directly. With the database developer having control over when any changes are committed for shared use in the database. Similar to using the SVN plug-in for an IDE like Eclipse for a given programming language in a shared development environment.
    But what would your DBA have to say about that? Don't most DBAs require scripts for deploying code or structural changes?
    In Oracle, definitions (DDL) are committed automatically. Anyone granted access sees them. Since you probably don't do development directly against a production database, eventually scripts (either manual or generated) will be needed for deployment to QA or production. Few mechanisms currently exist to work against an active database without other authorized users also seeing these changes.
    For DDL, the closest thing would be the fairly recent edition-based redefinition feature in 11g (R2, I think). For DML, the OWM (Oracle Workspace Management) feature would be loosely analogous.
    This is not a simple issue. Version control via an extension for Subversion provides essential basic support. Going beyond that might mean watching the evolution of edition-based redefinition, but DBAs would probably require scripts for that too.
    Regards,
    Gary
    SQL Developer Team

Maybe you are looking for

  • Photo gallery in as3

    I'm making photo gallery where photos will be loaded from external xml file but i have problem. I want to add an effect when photo is changing like on this site: http://www.studiomelon.pl/index.html#/1/  Could somebody help me with that? I am noob in

  • How to make a christmas newsletter with pictures

    how do I make a christmas newsletter with pictures all around.  I want to arrange the pictures.  the collage does it but I want to place them.

  • 32L4300 mystery video port, any clue what cable?

    Anyone here with a model 32L4300 or any of that related series. On the left side of the set,  the very top input, above the HDMI is a port labeled IN ViDEO 1 (audio). The input is unusual. It's partly plastic (yellow) and it does not look like any ot

  • Need help, iTunes bugging

    When i try to play music on iTunes my music plays 2 or 3x faster than it should. Does anyone know how to fix this?

  • Change HTML Color

    Hi, I am trying to change the html page color from flash - I use the "getURL" method - It works fine within GoLive but when I display it in any browser I get: " javascript:document.body.bgColor='#773707'" in the address bar and the color does not cha