-1

i have an oracle database schema with functions, stored procedures and packages. i want to allow some developers to access my tables read only so i create a user with READ ONLY access to my tables. i want to grant them EXECUTE on my stored procedures and functions but NOT allowing them to view its source (code). when i grant EXECUTE on my functions or stored procedures, they can easily DESCRIBE (in SQL developer or TOAD) and view from all_source. how do i prevent them from viewing my PL/SQL sources?

angkong
  • 1
  • 1
  • Does this answer your question? [Encrypt decrypt PL SQL Packages in oracle](https://stackoverflow.com/questions/60414731/encrypt-decrypt-pl-sql-packages-in-oracle) – mustaccio Jan 18 '21 at 17:55

1 Answers1

3

One way that I can see for this type of access is to use the package.

Create package specification and body with your procedure and grant execute on your package to other user.

Having execute rights, other user will be able to execute the procedure of the package and will be able to see only package specification and not the body (the actual code)

Popeye
  • 35,427
  • 4
  • 10
  • 31
  • tq nice. how about function? i have several functions and i don't want them view the source, is it possible? – angkong Jan 18 '21 at 16:23
  • 1
    @angkong - that is exactly what Popeye's answer does. "Package specification" means that you are declaring the functions; the package **body**, which is not visible to users, has the *implementation* (code) for the functions you declared. An outside user can see that your package has a function `multiply (x number, y number) return number`, but they don't have access to the body, to see how you implemented it. They can still call the function if they need it in their code, but they can't see (much less modify) your code. –  Jan 18 '21 at 16:58
  • 1
    Perhaps you are confused by the term "package" (as "opposed to" functions). A package is a package of functions (and procedures, and perhaps data types you need to define too). –  Jan 18 '21 at 16:59
  • got it @mathguy, thank you for the advice. – angkong Jan 18 '21 at 17:30