Oracle: How to make package body inaccessible to user from viewing - oracle

Is there a way to stop other users from viewing the package body, but can see package spec in Oracle? Other users can have execute privilige but no privilige to view package body.
Wrapping is not a solution as there are good number of unwrapt tools available. It doesn't serve the purpose.
Any help is appreciated.

Related

Not able to see Procedure/Function body in Oracle SQL developer

I am not able to see Procedure/Function body in package view Oracle SQL Developer connected to Oracle 11g.. Any idea how can I see that
You should be able to see the pacakge body if you press the plus (+) button you had right at the name of your pacakge.
If you don’t see it, two things may be happening, you don’t have the permissions (grants) on the user with which you are connected to the database session or the package body doesn’t exist.
To check if the package body exist you could export the definition,
You should also check if you are connected to the right environment

Can you use an already created procedure and an already created function inside of a package?

I am new to PL/SQL and I am trying to create a package that will contain and procedure and function that I have already created and stored into the database. Is there a way to simply use the already created procedure/function or will I simply need to recreate them inside of a package body?
If the procedure/function is already created and deployed on database then you can use these in any Package you create on same schema, no need to recreate them inside you Package.
In case the procedure/function are created on schema different from your Package, all you have to do is to provide the execute privilege on the procedure/function to the schema where you are deploying your Package. Inside the Package just simply call the procedure/function by appending the owner schema in front (owner_schema.function_name(parameter)).
Hope this helps.
Normally, packages are used to provide modularity and ease of update to your work. That is why you have to create the procedures/functions inside the package.
However, this does not mean that you cannot call procedures/functions written outside. You have to create a proc/function and call the outside proc/function inside that, which increases your work.
So, it is always better to keep your work related to one module inside a package.
In short, create procedures/functions inside package.

Getting xAPI statements from an xAPI package

I'm trying to get my head around the workings of an xAPI package authored in Rise which has been supplied to me so I can build a test PoC app.
I can see the functions built into the index.html page, and that things like progress and quiz scores are genrated, but where do I find the end-point for a LRS within the package?
I have incorporated the package into a test app I built, but rather than generate and send statements myself I would like use what comes as part of the package.
If I import and play the package in SCORM Cloud, I get generated statements returned.
The only thing I can see is an entry in the tincan.js file, this.recordStores=[] other than that I'm unsure where to go next, any suggestions?
Generally this kind of package implements a set of guidelines that were released with the 0.9 version of the specification (at the time named the Tin Can API and then later changed to xAPI). Those guidelines provide for a packaging and launch mechanism which is what Rise has implemented. The launch mechanism indicates that the endpoint and authentication credentials will be passed on the query string to the launched content where it can retrieve them. The TinCanJS library used by Rise implements functionality to digest the query string and set up objects, those you find in this.recordStores to communicate with the xAPI LRS identified in the query string parameters.
You have two primary options,
Get the query string parameters directly from the launch URL and
process it yourself, potentially using the same global library objects
(TinCan.LRS) already available to get an LRS object that you can
then interact with as you see fit,
Leverage the object already created for you via the this.recordStores list that is already prepared by the package itself
There are pros/cons to both methods and they largely depend on your familiarity with JavaScript and how flexible you need/want to be.

get apex package prefix name?

is there a way to get the prefix name of a managed package in apex?
I have a SOSL query but the app is in a developer org and in a managed package, if I have a way to get the package name, it would be great, because I don't have to hard code it.
Thanks.
The only way to do this, AFAIK, is to use the Metadata API. You can call describeMetadata() and then evaluate the organizationNamespace (String) value returned in describeMetadataResult.
From within Apex you could do a less elegant try/catch approach with dynamic SOQL/DML, at least to determine if something you suspect is there is actually there. Though this won't tell you what namespace prefix actually IS there like the Metadata API will.
Lacey is correct that you don't need the prefix, though name ambiguity can become a problem. So for example, if you have a custom object Expense__c and have installed an accounting package which includes ACCT__Expense__c, you definitely want to explicitly include the ACCT__ prefix if intending to access the managed package object as opposed to your own.
The UserInfo.isCurrentUserLicensed('nsPrefix') will throw a TypeException if the namespace passed in is not a valid namespace of an installed package (or managed package you're developing). I think this is the closest you're going to get without the metadata API.

function import in entity framework

As the MSDN says
Do one of the following from the Model Browser:
Open the Stored Procedures folder (in the storage model information) and double-click a stored procedure that does not have a corresponding function import.
- OR -
Right-click the Function Imports folder (in the EntityContainer node of the conceptual model information) and then select Add Function Import.
The Add Function Import dialog box appears.
How can I do function import if my db contains hundreds of sps. Should I go to each sp and do the steps above :( .. It makes no sense.
I have a very large Entity Framework model and I use the Huagati DBML/EDMX tools. It was able to bulk add new tables, views and columns that were in the database but not in the EDMX. It saved a lot of manual work. I haven't used it for stored procedures but it looks like it supports it. Even better, they have a free trial so you can always give it a try to see if it will work for you.
Edit: It also sounds like they have made some improvements to this in the latest version of EF - the June 2011 CTP. This blog post states:
There are several new features for the Entity Framework Designer
within Visual Studio:
[...]
When you import stored procedures using the Entity Model Wizard,
you
can now batch import your stored procedures as function imports.
The
result shape of each stored procedure will automatically become a
new
complex type in your entity model. This makes getting started with
stored procedures very easy.
If you don't want to use a CTP, this blog post says they might have the official version out next month.

Resources