Hiding store procedure body
Hi Sir,
We have written a lot of the stored procedures in the database.
Is there any way that we can hide the stored procedures body from allowing other people from viewing the source code?
Please advise.
Thanks.
There is the application WRAP to do that. I never used it so I do not know how to use it. Check the documentation or technet.
Similar Messages
-
Get the body of the store procedure
Hi All,
THe store procedure is created successfully and I don't know how to get the definition of the store procedure. In MSSQL server I used "sp_helptext <store procedure name>" but I don't know how to get text(description) of the store procedure in ORACLE. Your help is greatly appreciated.
Thanks,
JPHi all,
I ran the following statement to get the body of the store procedure:
select text from user_source where name = <store procedure>
and the long text(body of store procedure) is returned back. This store procedure is created with the error message return back as "Warning: Procedure created with compilation errors". So I were wondering why the store procdure is in user_source although the creation of this store procedure is returned an error message as mentioned above. Is there anyway that we can find out if the store procedure is created with the compilation errors.
Thanks,
JP -
How to get a recordset in vb to access a oracle store procedure.
I have a store procedure(sproc) that needs to be called from a VB Application. I was being told that I would have to create a PL/SQL table in my store procedure for the VB Developer to access information from my store procedure. This is beacasue he wants it as a record set. Is that the way to get info for a VB front end. My sproc is a very basic one
My sproc looks like
create or replace PROCEDURE SP_TBLINFO
(ID out TBLINFO.id%type,
ACCOUNT_NUMBER out TBLINFO.account_number%type)
AS
CURSOR TBLINFO_CURSOR IS
SELECT * FROM TBLINFO;
V_TBLINFO_CURSOR TBLINFO_CURSOR%ROWTYPE;
BEGIN
OPEN TBLINFO_CURSOR ;
Loop
FETCH TBLINFO_CURSOR INTO V_TBLINFO_CURSOR;
EXIT WHEN TBLINFO_CURSOR %NOTFOUND;
ID := V_TBLINFO_CURSOR.id;
ACCOUNT_NUMBER:= V_TBLINFO_CURSOR.account_number;
END LOOP;
CLOSE TBLINFO_CURSOR ;
END SP_TBLINFO;
Thanks.Use a REF_CURSOR, something like the following:
create or replace package SP_TBLINFO as
CURSOR TBLINFO_CURSOR IS SELECT * FROM TBLINFO;
create type TBLINFO_CURSOR_TYPE is TBLINFO_CURSOR%ROWTYPE;
procedure PROC_TBLINFO(Info out TBLINFO_CURSOR_TYPE);
end;
create or replace package body SP_TBLINFO as
PROCEDURE PROC_TBLINFO
(Info out TBLINFO_CURSOR_TYPE)
AS
BEGIN
OPEN ACCOUNT_NUMBER as SELECT * FROM TBLINFO ;
END SP_TBLINFO;
END;
Then bind it in OO4O as ORATYPE_CURSOR. -
Permission problem calling a java object from a store procedure
When I run my store procedure
CREATE OR REPLACE PACKAGE BODY confirms_write_to_file
AS
FUNCTION translate(in_en_var in VARCHAR2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'translate.translatePath(java.lang.String) return java.lang.String';
PROCEDURE write_to_file(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
IS
file_handle UTL_FILE.FILE_TYPE;
file_location VARCHAR2(50);
BEGIN
file_location := translate(in_en_var);
dbms_output.put_line ('opened file location' ||file_location);
END write_to_file;
END confirms_write_to_file;
I get the following error:
exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
SQL> exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
Exception java.security.AccessControlException: the Permission
(java.io.FilePermission <<ALL FILES>> execute) has not been granted by
dbms_java.grant_permission to
SchemaProtectionDomain(RIMS|PolicyTableProxy(RIMS))
opened file locationProcess problem
PL/SQL procedure successfully completed.
When I try to to grant myself the permissions
begin
dbms_java.grant_permission('rims','java.io.FilePermission','*','execute');
dbms_java.grant_permission('rims', 'java.lang.RuntimePermission', '*','writeFileDescriptor' );
end;
I get the following Error:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.findAll(PolicyTableManager.java)
at oracle.aurora.rdbms.security.PolicyTableManager.find(PolicyTableManager.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.activate(PolicyTableManager.java
at
oracle.aurora.rdbms.security.PolicyTableManager.grant(PolicyTableManager.java)
begin
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
ORA-06512: at "SYS.DBMS_JAVA", line 0
ORA-06512: at line 2
My java code is as follows
import java.io.*;
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
int bufSize = 4096;
byte buffer[] = new byte[bufSize];
String path = null;
Process p = null;
int len = 0;
try
p = rt.exec("echo "+envar);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
path = new String(buffer);
p.waitFor();
catch(Exception e)
System.out.println("Exception "+e);
return "Process problem ";
return path;Tony,
I answered this very same question that you posted at the JavaRanch forum.
Good Luck,
Avi. -
What is wrong in my store procedure
Hi all,
I confuse on in ,out inout in store procedure , I got eroor at
Formal parameter '@AccessionNumber' was defined as OUTPUT but the actual parameter not declared OUTPUT
I use sql server 2000 and ms type 4 driver,
my test store procedure is
drop proc test_select
go
create proc test_select
(@AccessionNumber int,
@NewNum varchar(20))
AS
begin
begin transaction
select FieldNumber, Name, HiTiter, SubType, Storage,SampleRegion, SampleYear
from STData.dbo.ViruName00
where AccessionNumber=@AccessionNumber
and NewNum=@NewNum
if @@error <>0 or @@rowcount !=1
begin
rollback
return
end
commit transaction
endand my test servlet is
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
* TryJdbc.java
* This servlet demonstrates using JDBC
public class displayT1 extends HttpServlet {
CallableStatement cs =null;
ResultSet rs = null;
Connection conn = null;
* We want to initialized the JDBC connections here
public void init()
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
catch( Exception e )
e.printStackTrace();
* This responds to an HTTP GET request.
public void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
try{
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433","test","1234");
conn.setCatalog("STData");
//we made it!
out.println("connection established sucessfully!");
// register int OUT parameter
cs = conn.prepareCall("{call test_select(?,?)}");
cs.setInt(1, 1);
cs.setString(2, "00-1");
cs.registerOutParameter(1, Types.INTEGER);
cs.registerOutParameter(2, Types.VARCHAR);
ResultSet rs = cs.executeQuery();
out.println("<html>");
out.println("<body bgcolor=\"#d2eeff\">");
out.print("<table border=\"1\" width=\"37%\"> "); //create an html table
out.print("<tr>");
out.print("<h2> Customers on the flight</h2>");
out.print("</tr>");
out.println("<tr><td>Name</td>");
out.println("<td>SubTYpe</td></tr>");
while(rs.next()) {
out.print("<tr>");
out.print("<td>"+ rs.getInt(1) +"</td>");
out.print("<td>"+ rs.getString(2) +"</td>");
out.print("</tr>");
}// end while
out.print("</table>");
out.print("</body></html>");
out.close();
while(rs.next()) {
String Name=rs.getString("Name");
out.print(""+Name+"");
out.print("</body></html>");
out.close();
}catch(SQLException e) {
e.printStackTrace(out);
finally {
try {
if(rs != null)
rs.close();
rs = null;
if(cs != null)
cs.close();
cs = null;
if(conn != null)
conn.close();
conn = null;
catch (SQLException e) {}
public void doPost(HttpServletRequest Request, HttpServletResponse Response)
throws ServletException, IOException {
public String getServletInfo()
return "A Simple Servlet";
}and my AccessionNumber is first column, and NewNum is second column.
appreciate any help!
Thank you!HI all,
html + bean + jsp call store procedure still not work, I got empty output!!
what is wrong ?
public String getString(){
return string;
public void setString( String string ) {
this.string =string; }
public String getMyType(){
return myType;
public void setMyType( String myType ) {
this.myType =myType; }
try {
cs = db.prepareCall("{call select_all(?,?)}");
cs.setString(1, myType);
cs.setString(2, string);
ResultSet rs = cs.executeQuery();
fieldNumberList.clear();
nameList.clear();
hiTiterList.clear();
subTypeList.clear();
storageList.clear();
sampleRegionList.clear();
rowCount = 0;
while (rs.next()) {
fieldNumberList.add(rs.getString("FieldNumber"));
nameList.add(rs.getString("Name"));
hiTiterList.add(rs.getString("HiTiter"));
subTypeList.add(rs.getString("SubType"));
storageList.add(rs.getString("Storage"));
sampleRegionList.add(rs.getString("SampleRegion"));
rowCount++;
anyRecords = true;
}//end while
}//end trythe following code work in servlet
cs = conn.prepareCall("{call select_all(?,?)}");
cs.setString(1, myType);
cs.setString(2, string);
ResultSet rs = cs.executeQuery();
thank you! -
hi..
can any body guide me about store procedure in oracle 9i.
if possible please tell me the scripts also.
thanks in advance.Stored procedures are more than adequately dealt with in the PL/SQL User's Guide. Find out more.
if possible please tell me the scripts also.What scripts did you have in mind? Stored procedures are used for implementing application-specific logic so your question doesn't really make any sense.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Can't execute Sybase store procedure
Hi All,
I'm trying to execute sybase store procedure, but somehow the procedure not executing. if any body what's the problem? I'm using JBoss server
Code:
public void deleteRigMapSP(String pMappingID, String rigid, String date,String pPhysicalDel, String database) throws DataAccessException {
GregorianCalendar val = new GregorianCalendar();
DateFormatter dateform = new DateFormatter();
String deletiondate = dateform.convertGregorianToString(val);
query = new StringBuffer("EXECUTE spRR_STAT_DeleteMapping ");
query.append("'"+pMappingID + "',");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append("'"+deletiondate + "',");
query.append(pPhysicalDel);
System.out.println("query: "+query);
try {
getDBConnection(ServiceLocator.getInstance().getDataSource(database));
CallableStatement cs = dbConnection.prepareCall(query.toString());
if (cs.execute()) {
System.out.println("deleted");
} else {
System.out.println("not deleted");
When I try to execute the method it's run fine, but it not executing the procedure.
Any help will be greately appreciated.How do you know it's not executing? Maybe you're in manual transaction mode and you're not committing the transaction before you close the connection and it gets rolled back.
And why on earth are you using CallableStatement if you're embedding the parameters into the SQL query rather than using placeholders and the setXXX() methods?
Alin. -
Call Store Procedure in SQL Server
How can I call an Oracle Store Procedure in a SQL Server procedure?
Make sure you're calling the stored procedure with the same parameters at the same database. If that's not the case then send the procedure body and how you are calling it from code and DB .
"If there's nothing wrong with me, maybe there's something wrong with the universe!" -
ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?
ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?
I have a store procedure:
CREATE OR REPLACE PACKAGE BODY PK_HR1
IS
FUNCTION FUNC04
RETURN CUR_RESULT
IS
X_CUR CUR_RESULT;
BEGIN
OPEN X_CUR FOR
select mako, tenko, diachiko from kho;
RETURN X_CUR;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END FUNC04;
END PK_HR1;
In the entities class, I have a NamedStoredProcedureQuery:
@Entity
@NamedStoredProcedureQuery(name="Kho.FUNC04",
resultClass=Kho.class,
procedureName="PK_HR1.FUNC04" )
public class Kho implements Serializable {
In session bean, i have a method
public class SessionEJBBean implements SessionEJB, SessionEJBLocal
public void test() throws Exception{
try {
//code here ...
List<Kho> listKho = em.createNamedQuery("Kho.FUNC04").getResultList();
System.out.println("aaaa");
} catch (Exception ex) {
ex.printStackTrace();
} finally {
I try running, but always show errror
this errors:
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'FUNC04' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN PK_HR1.FUNC04(); END;
Query: ReadAllQuery(jp.co.mfr.sgs.bean.Kho)
help help me?You need to use a CallableStatement for this.
--olaf -
Call store procedure wich have parameter from html
Hi all,
I have search function, which will allow users to select all database.
I want to use stor procedure to handle this part , if it is a sample select procedure than just using
CallableStatement cs = conn.prepareCall("{call SHow_SubType}");
ResultSet rs = cs.executeQuery();but if the store procedure have parameter
like
union
select FieldNumber, Name, HiTiter, SubType, Storage,SampleRegion, SampleYear
from yunnan.dbo.ViruName04
where SubType like'%@SubType%'
and Name like'%@Name%'How can I call this stored procedure in my bean
I have
public String getName() {
return name;
public void setName(String _name) {
name = _name;
.....thankyouHi ram,
I try every hard, but still can't got result.
my code is
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
* TryJdbc.java
* This servlet demonstrates using JDBC
public class displayT extends HttpServlet {
CallableStatement cs = null;
ResultSet rs = null;
Connection conn = null;
* We want to initialized the JDBC connections here
public void init()
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
catch( Exception e )
e.printStackTrace();
* This responds to an HTTP GET request.
public void doGet(
HttpServletRequest req,
HttpServletResponse response)
throws IOException, ServletException {
String string= req.getParameter("string").trim();
String Type =req.getParameter("myType").trim();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
try{
conn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;selectMethod=cursor","test","1234" );
DatabaseMetaData md = conn.getMetaData();
//select a database
conn.setCatalog("HKData");
//we made it!
out.println("connection established sucessfully!");
CallableStatement cs = conn.prepareCall("call SHow_SubType(?,?)}");
cs.setString(1, "Dk");
cs.setString(2,"H5");
// register int OUT parameter
cs.registerOutParameter( 1, java.sql.Types.VARCHAR);
cs.registerOutParameter( 2, java.sql.Types.VARCHAR);
ResultSet rs = cs.executeQuery();
rs = (ResultSet)cs.getObject(1);
while(rs.next()) {
// String Name=rs.getString(2);
// out.print(""+Name+"");
// out.print("br");
System.out.println(rs.getString(1));
out.print("</body></html>");
out.close();
cs = null;
conn.close();
conn = null;
catch(NullPointerException sqle)
sqle.printStackTrace();
catch(Exception ex)
ex.printStackTrace();
System.out.println("error in finding class "+ex);
public void doPost(HttpServletRequest Request, HttpServletResponse Response)
throws ServletException, IOException {
public String getServletInfo()
return "A Simple Servlet";
}what is the psooible mistake , I use SQL2000.
Thank you -
EA 2.1. Can't edit another users store procedures.
I can't edit store procedures of another users in 2.1 ea version but i can compile it.
In 1.5.5 i can edit the same store procedure.
DB version 10g
thanks.I tried the following:
create user attest2 identified by xxxxxx;
grant connect to attest2;
grant create procedure to attest2;
grant alter any procedure to attest2;
grant create any procedure to attest2;
grant execute any procedure to attest2;
Now using SQL Developer 2.1 RC1 i can log in with attest2, i can see other users and all their packages, i can open the package and body, the cursor is in the editor but i can't type a thing. The compile button is active and working, but editing is blocked. Creating a procedure under attest2 schema and editing it there works fine.. Using a user with dba privileges also works fine.
No problem in editing other users' procedure with SQL Developer 1.5.4.
I have pretty much the same configuration as the original poster - XP SP3. Database 10.2.0.4
Andres -
Store procedure doesn't return resultset
hi guys
i m stuck in a prob.I am using "com.microsoft.jdbc.sqlserver.SQLServerDriver"
when i call a normal query it run fine but when i try to call a store procedure it gives no result set was produce, is it a problem with driver but if i use jdbsodbc driver it work fine.
code:-
pStmt= conn.prepareStatement("{call insertOpacResultsTemp(?,?,?,?,?)}");
pStmt.setString(1,sUserID);
//and other parameters
Resultset=pStmt.executeQuery();
plz guys help me outHello Amit,
Oracle Stored Procedure
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
create or replace package test_package as
type my_cursor is ref cursor;
procedure test_procedure (name in varchar2,sys_cursor out my_cursor);
end test_package;
create or replace package body test_package
as
procedure test_procedure (name in varchar2,sys_cursor out my_cursor)
as
l_sys_cursor my_cursor;
begin
open l_sys_cursor
for select * from krm_system
where parameter_id = name;
sys_cursor:= l_sys_cursor;
end test_procedure;
end test_package;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Java code for getting result set
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
public class StoredProcTester{
public static void main(String args[]){
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:isorcl","user_id","password");
CallableStatement cstmt = conn.prepareCall("{call test_package.test_procedure(?,?)}");
cstmt.setString(1,"MAX_MEMORY");
cstmt.registerOutParameter(2,OracleTypes.CURSOR);
cstmt.execute();
ResultSet rs = (ResultSet)cstmt.getObject(2);
while(rs.next()){
System.out.println("ID\t" + rs.getString(1));
}catch(Exception e){
e.printStackTrace();
} -
How to call store procedure from an oci program
Hello,
I work on Oracle 8.1.7 under AIX.
I must call from an OCI C++ program a store procedure that have an result set as param out.
I'm not sure how can I call the procedure/function. I want to execute this statement and fetch the results.:
" CALL Department.get_all (:1) " is this OK?
" Call department.GetAll() into :1 "
I have seen some example from an PL/SQL block but that's not ok for me.
what i have done:
i have created an package
create or replace package department as
type cursor_type is ref cursor;
procedure get_emp( i_deptno in number, rs out cursor_type );
procedure get_all( rs out cursor_type );
function GetAll return cursor_type;
end department;
create or replace package body department as
procedure get_emp ( i_deptno in number, rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp
where deptno = i_deptno;
end;
procedure get_all ( rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp;
end;
function GetAll return cursor_type
as
l_cursor cursor_type;
begin
open l_cursor for select ename, empno from emp;
return l_cursor;
end;
end;Hi,
I am new to OCI facing the same problem you have mentioned, If you have found out how to solve it , can you post the answer for the same.
Thanks
Mani -
how to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server?
Does any body can tell me about this?
thanks
[email protected]Hi
Did you succeed to execute the procedure?
How ?
Thanks
Shimon Zerbib -
Is it possible to have union on a store procedure and an sql within an application like
create or replace
PACKAGE BODY MyStoredProc AS
PROCEDURE DeparmentName (ColumnA IN VARCHAR2,
wPO OUT curUsr) IS
BEGIN
OPEN wPO FOR
exec MyStoredProcedure 1
union
SELECT distinct departmentName
FROM "schemaNAME".Department d
WHERE d.ColumnA='5000'
END;Hi Suzie,
please take a look at [url https://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0]Understanding Ref Cursors.
The entry "1. What is a ref cursor and how is the data fetched" shows some examples of ref-cursors. How they may work or may fail.
(pointer to data not* container of data, ...)
The next entry "2. How can we use a ref cursor in a SQL query?"
describes how they can be used in SQL.
The last entry "3. What is
the point of ref cursors?" helps when to use or not to use ref-cursors.
Bye
stratmo
Added:*
Sadly I don't know java.
If you are looking for a "parametrized view" then ...
create or replace
Package Pipeline_Func_Replace
As
Gcc_Context Varchar2(32767) := NULL;
Function Get_Context Return Varchar2 ;
procedure Set_Context(Pic_Context In Varchar2);
function Set_Context(Pic_Context In Varchar2) return integer;
End Pipeline_Func_Replace;
create or replace
Package Body Pipeline_Func_Replace
as
function get_context
return varchar2
as
begin
return gcc_context;
end get_context;
procedure set_context(pic_context in varchar2)
as
begin
gcc_context := pic_context;
end set_context;
function set_context(pic_context in varchar2)
return integer
as
begin
set_context(pic_context);
return 1;
end set_context;
end pipeline_func_replace;
create or replace view restricted_emps
as
select a.*
from hr.employees a
where a.manager_id = Pipeline_Func_Replace.get_context; -- the parameter
-- one can set the context with
select Pipeline_Func_Replace.set_context('101') from dual;
-- or with
begin
Pipeline_Func_Replace.set_context(pic_context => 101);
end;
/... is a possibility.
Edited by: stratmo on Dec 20, 2012 11:58 PM
Maybe you are looking for
-
How do I create an Apple ID for children under13?
I bought my daughter an iPad mini for Christmas, but it won't let me create her ID. How do infix thus?
-
Hi experts, I'm looking for a list of relevent Tables that are commonly used in the FI side, with particular emphasis on AR, i.e, with respect to the day-to-day and periodic operations of an organization. It would be of great help if some one can pr
-
Displaying std field in enable mode after throwing error msg
Hi experts, I have a requirement where i need to check the value enterred in standard field (final grade) of infotype 0022 and need to throw error message, when the user click save button in PA30. But the problem is, if i throw Error message, that f
-
Unable deleting microsoft account.
Heya, I'm having problem in deleting microsoft Id of the previous user, n so I'm unable downloading apps from the nokia store! Get me solution regarding this.
-
Hi gurus, how to create bapi for creation of customer and the coding. can you help me for step to step process please its urgent.