Is it possible to execute a stored procedure from application express?
I have created a pl/sql application now I would like to give it a front end, I am new to application express.
My application depends on running a couple of pl/sql procedures that modify data.
What I need is my user to be able to execute the procedures from the application in a browser, is it possible to run a pl/sql procedure from an application express application in a browser?
how would I go about doing this?
thank you very much.
Ramiro
You sure can.
If you want to run a PL/SQL procedure/package/function from the URL, create a specific DAD entry just for that (Oracle) user, and give that user EXECUTE permissions on the procedure. Then just use the new DAD with the procedure name, like http://myserver.somewhere.com/MyNewDAD/Schema_Owner.MyPackage.MyProcedure?InParameter=MyParameter)
Of course, the above line will need heavy modification on your end, but I do this in my app, but I actaully pass it through a javascript attached to a button which then opens it in a new window.
If instead, all you want to do is execute a procedure with ApEx as part of a validation or process or something, select the PL/SQL 'Region' (or process, whatever it is you want to do), and then write it as an anonymous block:
begin
MyProcedure;
end;
Bill Ferguson
Similar Messages
-
Error ORA-04031 while executing a stored procedure from Pro C++ code
I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
Does anyone know why it is happening and any possible solutions?
TIA
Srithaj.One thing that can be done is to flush the shared pool before starting the application.
alter system flush shared pool;
Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
null -
Error while executing a stored procedure from forms6i
When I execute a STORED PROCEDURE from ORACLE DB 10g this procedure works perfectly fine.
But when I execute the same from the FORMs 6i I get the following error:
PDE-PLU022 Don't have access to the stored program unit
XMLPARSERCOVER in schema CARE.
where XMLPARSERCOVER is the class and
CARE is the schema.
Regards,
Jignesh SI have tried this with both the owner of the schema and the intended user, -from both forms and directly.
All rights was granted on the stored procedure. Since posting I have found that one of the tables that the procedure might insert into, was not explicitly granted to the intended user, and after rectifying that the error message went away.
-however, the procedure now silently "finishes" without any evidence that it ever ran, if invoked from the forms application. When invoked from SQL Plus (or JDev, or Toad) it runs as expected.
I have no public synonym for the procedure, -is that necessary?
The stored procedure in question is implemented in java, and published as a stored procedure. It does rather heavy lifting, when running, using a view against another server , updating local tables and quite a lot of data validation/cleansing, and logging. All recourses are within the same schema.
Any ideas? -
Execute a stored procedure from a JSP.(Help...)
How can I execute a stored procedure from a JSP.
Wich tags I need to use ???
I'm using the oracle thin JDBC.
please help me.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mario Bellido ([email protected]):
How can I execute a stored procedure from a JSP.
Wich tags I need to use ???
I'm using the oracle thin JDBC.
please help me.<HR></BLOCKQUOTE>
I just try a simple call with a data tag just like this (see category.jsp in the onlineorder example provided with Jdev 3.2.3):
<!-- Tutorial - ApplicationModule Tag -->
<%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
<jbo:ApplicationModule configname="OnlineOrders.OnlineOrdersModule.LocalConfig" id="OnlineOrdersModule" username="BC4J" password="BC4J" />
<!-- Tutorial - DataSource Tag -->
<jbo:DataSource id="category" appid="OnlineOrdersModule" viewobject="CategoryView" ></jbo:DataSource>
<jbo:ExecuteSQL appid="OnlineOrdersModule" >
insert into tablejsp values ('testtable')
</jbo:ExecuteSQL>
<jbo:ExecuteSQL appid="OnlineOrdersModule" >
call testjsp()
</jbo:ExecuteSQL>
<jbo:Commit appid="OnlineOrdersModule" />
testjsp is a stored PL/SQL procedure without arguments.
null -
Is it possible to execute a stored procedure using the JDBC adapter?
Hi all,
Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
If yes, then please let me know how (may be with an example)
Thanks.Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
JDBC Receiver
For writing data to an SQL database you also need to define a strict data type. The general format is like this:
<ns:MT_RECORDSET>
<STATEMENT>
<TABLE_NAME ACTION="">
<TABLE/>
<ACCESS>
<FIELD1/>
<FIELD2/>
<FIELDn/>
</ACCESS>
<KEY>
<ID compareOperation=""/>
<FIELDx compareOperation=""/>
</KEY>
</TABLE_NAME>
</STATEMENT>
</ns:MT_RECORDSET>
This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
MT_RECORDSET is the name of the Message Type used.
For the value of the attribute ACTION you can choose from the following values:
UPDATE : updates the given fields in the table with their new values
INSERT : insert the given fields as a new row in the table
UPDATE_INSERT : insert rows in the table when update is not possible
DELETE : deletes given fields from the table
SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
EXECUTE : execution of a stored SQL procedure
SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
The attribute compareOperation can have the following values:
EQ : equal
NEQ : not equal
LT : less than
LTEQ : less than or equal to
GT : greater than
GTEQ : greater than or equal to
LIKE : used to compare strings -
Executing a stored procedure from an Ifs Program
I have a need to execute a stored procedure in another schema
within the same database, and I need to receive an OUT parameter
to continue processing. The oracle.ifs.server.sql.IfsConnection
is not in my class path. Can someone tell me which jar file to
adde to my classpath to have this funcitonality that IFS claim.
Regards,
JeffGuys I need help with this one as soon as possible.
-
Execute Oracle Stored Procedure from Excel
Is it possible to execute an Oracle Stored Procedure from Microsoft Excel and return the result of the Oracle Store Procedure into the excel spreadsheet.
Yes. You can use Oracle Objects for OLE to accomplish this. It comes with Excel examples and an online help file with many more examples.
-
Incorrect Update Count by executing a stored procedure from Java
Hi Guys,
I am calling a stored procedure from the java program which is modifying the rows of a table. Now I want to know how many rows have been modified by executing the stored procedure. I am writing the following code for the purpose:
OracleCallableStatement stmt =
(oracle.jdbc.driver.OracleCallableStatement)con.prepareCall("{callsp_um_setForumID(?,?)}");
stmt.setInt(1,101);
stmt.setInt(2,666);
n = stmt.executeUpdate();
System.out.println(n + " row(s) updated");
This procedure is actually modifying the table(When I query the databse it has modified 1 row). But it is returning a value 0 and is printing "0 row(s) updated".
Is there a way by which I can find out the number of rows updated by executing the stored procedure?
Thanks
Sachin
[email protected]I'm no expert on this, but I have a similar call where I fetch
an Oracle REF CURSOR from a call to a stored function. If you
fetch the cursor as an Object from your CallableStatement, you
can then cast it to a ResultSet e.g.
mystatement.executeUpdate();
ResultSet rs = (ResultSet) mystatement.getObject(1);
Then you should be able to loop through your ResultSet as usual.
Good luck!
Chris -
Execute oracle stored procedure from C# always returns null
Hi,
I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
Below are the SP, and the code used from .Net to call it, if that can help.
Oracle SP:
CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
v_status VARCHAR2(5) := NULL;
BEGIN
BEGIN
SELECT CHECK_NO_EXISTENCE(to_char(l_number))
INTO v_status
FROM DUAL;
EXCEPTION WHEN OTHERS THEN
v_status := NULL;
END;
DBMS_OUTPUT.PUT_LINE(v_status);
END CHECK_CONTRNO_EXISTENCE;
C# Code:
string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
OracleConnection conn = new OracleConnection(connStr);
OracleParameter param1 = new OracleParameter();
param1.ParameterName = "v_status";
param1.OracleType = OracleType.VarChar;
param1.Size = 5;
param1.Direction = ParameterDirection.Input;
OracleParameter param2 = new OracleParameter();
param2.ParameterName = "l_number";
param2.OracleType = OracleType.Number;
param2.Direction = ParameterDirection.Input;
param2.Value = 006550249;
OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(oraParams);
conn.Open();
object result = cmd.ExecuteScalar();
conn.Close();Hi,
Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
See if this helps.
Cheers,
Greg
create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
is
retval varchar2(50);
begin
myoutvar := myinvar;
retval := 'the return value';
return retval;
end;
using System;
using System.Data;
using Oracle.DataAccess.Client;
public class odpfuncparams
public static void Main()
OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
con.Open();
OracleCommand cmd = new OracleCommand("myfunc", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
retval.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(retval);
OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
inval.Direction = ParameterDirection.Input;
inval.Value="hello world";
cmd.Parameters.Add(inval);
OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
outval.Direction = ParameterDirection.Output;
cmd.Parameters.Add(outval);
cmd.ExecuteNonQuery();
Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
con.Close();
} -
Executing a stored procedure from a java program
Hi.. how can i call a oracle stored procedure from a java
program. the OSP has four IN parameters and one OUT parameter(a
cursor). when i try this way.. i get an error
con = DriverManager.getConnection(url, "stored", "stored");
CallableStatement cs =
con.prepareCall(
"{call stored_proce_1(?,?,?,?,?)}");
cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.setString(2, "14541");
cs.setString(3, "gen");
cs.setInt(4, 0);
cs.setInt(5, 5);
ResultSet rs =cs.getResultSet();
while(rs.next()){
System.out.println(rs);
appreciate ur help.
qsI'm no expert on this, but I have a similar call where I fetch
an Oracle REF CURSOR from a call to a stored function. If you
fetch the cursor as an Object from your CallableStatement, you
can then cast it to a ResultSet e.g.
mystatement.executeUpdate();
ResultSet rs = (ResultSet) mystatement.getObject(1);
Then you should be able to loop through your ResultSet as usual.
Good luck!
Chris -
Execute APEX stored procedure from outside APEX
I am looking at developing an application in APEX, but there needs to be a batch component that I would like to call from our corporation's scheduler. Is there a way for me to call an APEX stored procedure from a 3rd party scheduling software?
We use this method on all other oracle databases here, but are new to using APEX.
Thank you,
TrevorThis applicaiton is for the internal administration of an External database.
So there is an external web application that will have a user sign in, and request some transactions. These requests need to be brought inside our firewall to the APEX tables, where our admin staff will access the requests via this internal administrative applicaiton. It will tie into our Customer Information System, giving our staff all the data they need in one application. Requested transactions, and customer information. Once processed, the status of each transaction will be pushed back out to the external database for our customers to view.
The transfer of data, along with some other logic, is written in PL/SQL stored procs. To keep within our devlopement guidleines, I would like to kick them off using our existing scheduler. That way I only have one internal database to worry about. -
Error while executing java stored procedure from a pl/sql procedure
We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NoClassDefFoundError
Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
Any pointers would be of great help!
Thanks in advanceHi Uday,
My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
is thrown to indicate that an exception occurred during
evaluation of a static initializer or
the initializer for a static variable
Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
1. Complete error message and stack trace you are getting.
2. The section of your java code that you think is causing the problem.
3. Oracle database version you are using.
Good Luck,
Avi. -
Error executing a stored procedure from SSIS using the MERGE statement between databases
Good morning,
I'm trying to execute from SSIS a stored procedure that compares the content of two tables on different databases in the same server and updates one of them. To perform this action, I've created a stored procedure in the destination database and I'm
comparing the data between tables with the MERGE statement. When I execute the procedure on the destination database the error that I obtain is:
"Msg 916, Level 14, State 1, Procedure RefreshDestinationTable, Line 13
The server principal "XXXX" is not able to access the database "XXXX" under the current security context."
Some things to take in account:
1. I've created a temporary table on the same destination database to check if the problem was on the MERGE statement and it works fine.
2. I've created the procedure with the option "WITH EXECUTE AS DBO".
I've read that it can be a problem of permissions but I don't know if I'm executing the procedure from SSIS to which user/login I should give permissions and which.
Could you give me some tip to continue investigating how to solve the problem?
Thank you,
VirgilioRead Erland's article http://www.sommarskog.se/grantperm.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to execute an stored procedure from the Report Region
Have stored procedure "LER_KRONOS_PAYCODE_HOURS_P" compiled and ready.
(previously tested)
Region Source:
DECLARE
v_SITE_ID VARCHAR2(8);
v_SDATE VARCHAR2(8);
v_EDATE VARCHAR2(8);
v_LEVEL3 VARCHAR2(60);
BEGIN
v_SITE_ID :=P4_SITES_LOV;
v_SDATE :=P4_SDATE;
v_EDATE :=P4_SEDATE;
v_LEVEL3 :=P4_LEVEL3;
EXECUTE LER_KRONOS_PAYCODE_HOURS_P(v_SITE_ID,v_SDATE,v_EDATE,v_LEVEL3);
END;
Error When run the page:
ORA-06550: line 11, column 12: PLS-00103: Encountered the symbol "LER_KRONOS_PAYCODE_HOURS_P" when expecting one of the following: := . ( @ % ; immediate The symbol ":=" was substituted for "LER_KRONOS_PAYCODE_HOURS_P" to continue.You need the execute keyword only when you run it directly from sqlplus.. that will tell sqlplus to append the keyword begin and end after the procedure call.
Example.
SQL > exec proc1 (input1);
will tell sqlplus to run it as a block.. saying
sql> Begin
proc1(input1);
end;Inside the procedure , in your code, you dont need the execute keyword.
But, why do you want to execute a procedure inside the source for a report region..? -
Issue when calling Stored procedure from application
Dear all,
Oracle DB version: 11.2.0.3
OS : RHEL 5.9 64-bit version
We are trying to execute one of the stored procedure (belonging to oracle DB schema) from our Dotnet application(recites in application server) but it takes more than 30 seconds to fetch the records. The stored procedure is called from application. When we try the same procedure from SQL developer or TOAD it completes within a second. Could anyone suggest on the issue?
Note: we are calling a remote DB view from our DB.
No. of records in the view : 49484929 rows
Thanks in advance,
Imran KhanThanks Billy for the reply. The following is the function of the .net application which calls the procedure:
public DataSet ResourceMonitor(String Date, String DateTime, String starttime, String endtime, String Assstarttime, String Assendtime)
try
cLog.StartMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
Database dbResourceMonitor = null;
DataSet Resourceset = new DataSet();
dbResourceMonitor = DatabaseFactory.CreateDatabase();
DbCommand dbCommand = dbResourceMonitor.GetStoredProcCommand("SP_RESOURCEMONITOR1");
dbResourceMonitor.AddInParameter(dbCommand, "P_Date", DbType.String, Date);
dbResourceMonitor.AddInParameter(dbCommand, "P_DateTime", DbType.String, DateTime);
dbResourceMonitor.AddInParameter(dbCommand, "P_Starttime", DbType.String, starttime);
dbResourceMonitor.AddInParameter(dbCommand, "P_Endtime", DbType.String, endtime);
dbResourceMonitor.AddInParameter(dbCommand, "P_AssStarttime", DbType.String, Assstarttime);
dbResourceMonitor.AddInParameter(dbCommand, "P_AssEndtime", DbType.String, Assendtime);
//dbCommand.Parameters.Add(BuildRefCursorParameter("DEPRECSET"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET1"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET2"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET3"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET4"));
return Resourceset;
catch (Exception ex)
cLog.LogMessages(this, ex.Message, cLog.eWiproMessageTypes.ErrorType);
throw ex;
finally
cLog.EndMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
The stored procedure SP_RESOURCEMONITOR1 has the following DDL:
CREATE OR REPLACE PROCEDURE SP_RESOURCEMONITOR1
( P_Date IN VARCHAR2,
P_DateTime IN VARCHAR2,
P_Starttime IN VARCHAR2,
P_Endtime IN VARCHAR2,
P_AssStarttime IN VARCHAR2,
P_AssEndtime IN VARCHAR2,
P_Mode IN NUMBER,
RECORDSET1 OUT SYS_REFCURSOR,
RECORDSET2 OUT SYS_REFCURSOR,
RECORDSET3 OUT SYS_REFCURSOR,
RECORDSET4 OUT SYS_REFCURSOR
)AS
BEGIN
OPEN RECORDSET1 FOR
Select ROLEMASTER.ROLEID,ROLEMASTER.ROLENAME as ResourceGroup,departmentmaster.DEPARTMENTNAME,departmentmaster.departmentid from Rolemaster
INNER JOIN departmentmaster ON Rolemaster.DEPTID=departmentmaster.DEPARTMENTID
WHERE 1=1 AND sysdate >=Rolemaster.START_DATE AND sysdate<=Rolemaster.END_DATE AND Upper(RoleMaster.Rolename) not like '%HIGHLOADER%' AND displayinlist=1
ORDER BY ROLENAME;
OPEN RECORDSET2 FOR
select ROM.ROLENAME as ResourceGroup, fn_get_resource_status(p_starttime, p_endtime,RM.Resourceid,RM.DeptID) AS Status,upper(RM.Resourceid)as Resourceid,RM.RoleID,RM.DeptID,TRIM(RM.RESOURCENAME) AS RESOURCENAME,'Detail'As Details,'ResChng'As ResChng,'Calender' As Calender FROM ResourceMaster RM
--INNER JOIN DEPARTMENTMASTER DM ON RM.DEPTID = DM.DEPARTMENTID
INNER JOIN ROLEMASTER ROM ON RM.ROLEID = ROM.ROLEID
where --UPPER (DM.DEPARTMENTNAME) IN ('DISPATCH','TRANSPORT','TRANSPORT RAMP')
RM.DEPTID in (select DEPARTMENTID from DEPARTMENTMASTER where displayinadmin=1 and active=1) ;
if (P_Mode =2) THEN
OPEN RECORDSET3 FOR
select * from mobility_attendance_info_v where TRANSACTIONDATE >= TO_DATE(Substr(p_starttime,1, 9) ,'dd-MON-rr') - 1 order by staffno,TRANSACTIONDATETIME Desc;
END IF;
OPEN RECORDSET4 FOR
select rsa.*,planning.flightno,'' As StTime,SUBSTR(rsa.depdt,11,5) as EndTime from resourceallocation rsa inner join planning ON rsa.planningid = planning.planningid
where TO_TIMESTAMP(rsa.DEPDT,'dd-MON-rr HH24:MI')>=TO_TIMESTAMP(P_DateTime,'dd-MON-rr HH24:MI') ;
END SP_RESOURCEMONITOR1;
The view mobility_attendance_info_v is a called from a remote DB. Hope it's quite clear.
Regards,
Imran Khan
Maybe you are looking for
-
I have a 6th generation iPod Nano. I almost exclusively use it as an FM radio and as a pedometer -- so far I have not loaded any songs onto it for listening, nor do I intend to in the future. Here's my problem: When my Nano runs out of juice, I have
-
How to convert my personal DVDs to be edited in Final Cut Pro 7?
Hi guys, I am working on a project that need to edit my personal DVDs in Final Cut Pro 7, but what i need to do first is rip the DVD to a Final Cut Pro 7 compatible format, to which format should i convert the DVD? I am using iSkysoft iMedia Converte
-
How can one actually tell one is on ADSL2
In Dec 2010 I got the - your area is being upgraded, and then - your area has been upgraded fatser speeds blah blah email I naturally assumed that I had been move to ADSL2 and my hub reported - G.992.5 Annex A, which I understand is ADSL2 However -
-
Hi All Business senario: we need to create two profit centers under one company code and at each profit center level we need P/L account .......... and we need A/R and A/P balances as well from the balance sheet. could anybody send me the configurati
-
I have a macbook, it is operating at 10.4.8 I have done everything I can think of. I have upgraded in imovie, i have updated all system updates, as well as the new firmware. However, once i did all of this i noticed that i could not get video through