Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java stored procedure in oracle

669410Nov 30 2008 — edited Dec 1 2008
Hi,
This is regarding the java stored procedure.
I have written a java stored procedure for mailing from DB.But it required some grants or extra privileges to be run from the data base.
CAn anyone please specify what are the grants needed for this.

I have to give to following permissions to the java methods....

dbms_java.grant_permission(user,'java.util.PropertyPermission','*','read');
dbms_java.grant_permission(user,'java.net.SocketPermission','*','connect, resolve');
dbms_java.grant_permission(user,'java.io.FilePermission',FilePathName,'read');


Can anyone please specify what are the privileges required to run the above.Because I have tired it with normal priviledges..it's not working.....

I am getting the following error while executing this from the normal user..rather the user that have been created for me....

ORA-29532: Java call terminated by uncaught Java exception: java.lang.SecurityException: policy table update SYS:java.util.PropertyPermission, *
ORA-06512: at "SYS.DBMS_JAVA", line 313
ORA-06512: at line 1



Thanks,
Anirban Datta

Edited by: user5815929 on Nov 30, 2008 8:42 PM
This post has been answered by zhxiangxie on Dec 1 2008
Jump to Answer

Comments

Frank Kulash
Answer

Hi,
Whenever you have a question, please post a little sample data in a usable form (such as CREATE TABLE and INSERT statements), so the people who want to help you car re-create the problem and test their ideas. Also post the exact results you want from the given data, and an explanation (in general terms) of you get those results from that data. Always say which version of Oracle you're using (e.g. 12.2.0.1.0).
See: https://community.oracle.com/tech/apps-infra/kb/articles/4-how-to-ask-questions-in-developer-community-spaces
If col1, col2, col3, ... are NUMBER columns (or any kind of NUMBER expressions) you can find how many of them that are positive numbers like this:

CASE WHEN col1 > 0 THEN 1 ELSE 0 END +
CASE WHEN col2 > 0 THEN 1 ELSE 0 END +
CASE WHEN col3 > 0 THEN 1 ELSE 0 END ...

If all the expressions are 0 or greater (i.e. no NULLs or negative values) then you can use:

SIGN (col1) +
SIGN (col2) +
SIGN (col3) ...

You can reduce the amount of code by unpivoting the columns, but that will make the query slower. Which is more important in this case: concise code or performance?

Marked as Answer by Sainaa · Jan 27 2021
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 29 2008
Added on Nov 30 2008
4 comments
6,339 views