Call stored procedure with OUT parameter
Hello,
I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
Has someone been able to call a stored procedure with an OUT parameter?
Regards,
Nico
Object is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {}
Similar Messages
-
Oracle Stored Procedure with out parameter
Good morning,
Is it possible to use an Oracle stored procedure with out parameters in MII ?
If yes, what is the manipulation to see the values of parameters Out?
Thank youMichael,
This is the MII query template :
DECLARE
STRCOMPTERENDU NVARCHAR2(200);
BEGIN
STRCOMPTERENDU := NULL;
XMII.SP_VALIDATEPROCESSORDERSLIST2 ( STRCOMPTERENDU => [Param.1] );
COMMIT;
END;
and the stocked procedure code
CREATE OR REPLACE PROCEDURE XMII.SP_ValidateProcessOrdersList2(strCompteRendu OUT nVarchar2) IS
tmpVar NUMBER;
debugmode INT;
strClauseSql varchar(2048);
strListPOactif varchar(1024);
dtmTimeStamp DATE;
NAME: SP_ValidateProcessOrdersList
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 18/06/2008 1. Created this procedure.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: SP_ValidateProcessOrdersList
Sysdate: 18/06/2008
Date and Time: 18/06/2008, 18:45:32, and 18/06/2008 18:45:32
Username: (set in TOAD Options, Procedure Editor)
Table Name: (set in the "New PL/SQL Object" dialog)
BEGIN
tmpVar := 0;
debugmode := 0;
-- lecture date systeme pour time stamp
select sysdate into dtmTimeStamp from dual;
if debugmode = 1 then
DBMS_OUTPUT.put_line('SP_ValidateProcessOrdersList');
end if;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,'SP_ValidateProcessOrdersList',ID_LOG_ORDER.nextval);
Commit;
if debugmode = 1 then
DBMS_OUTPUT.put_line('insertion LOG OK');
end if;
strCompteRendu := '0123456-896;0123456-897';
commit;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
ROLLBACK;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,' ',ID_LOG_ORDER.nextval);
COMMIT;
-- Consider logging the error and then re-raise
RAISE;
END SP_ValidateProcessOrdersList2;
Thanks for your help
Alexandre -
Calling Oracle Stored procedure with OUT parameter from ODI
Hi,
I called an oracle stored procedure with following anonymous block in the ODI procedure.
Declare
Status varchar2(10);
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', Status);
End;
I want to capture the OUT parameter STATUS value in a project level variable.
And based on its va;lue I would like to choose between 2 interfaces in my package.
Please help me in doing this.Hi,
For that kind of situation I commoly use:
1) one step with:
create or replace package <%=odiRef.getSchemaName("W")%>.pck_var
Status varchar2(10);
end;
* transaction 9, for instance
2) step
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', <%=odiRef.getSchemaName("W")%>.pck_var.Status);
End;
* transaction 9
3) then, at an ODI variable, use a refresh like:
select <%=odiRef.getSchemaName("W")%>.pck_var.Status from dual
at same logical shema where the package was created.
Does it make sense to you? -
About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000
Hi Guys,
I have a problem call store procedure with a large string.
as i know varchar2 can contain 32767 characters in pl/sql .
But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
why it happened?
I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
How can i solve this problem?
Thanks in advance,
AppCatObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {} -
Calling Stored Procedure with CLOB parameter
Hi,
i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
Is that Limitation of oracle or .Net version
please let me know the solution for that,
Create Procedure Insert_File(P_XMLFILE IN CLOB)
as
begin
insert into instances
values(p_xmlfile);
commit;
end;
regards,
MadanHi Thanks for your reply,
Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
Error has come while calling stored procedure Through .net
Error Details:
Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested -
Error while calling a stored procedure with OUT parameter.
Hi,
I am trying to call a Stored Procedure(SP) with an OUT parameter(Ref Cursor) from a third party tool. It is called using OLE-DB Data provider. In one database the procedure works fine but when I change the database the procedure call is giving following error.
Distribution Object: COM Error. COM Source: OraOLEDB. COM Error message: IDispatch error #3092. COM Description: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST1'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored.
I am not able to find as to why is this happening. Please let me know any clues /help to solve this problem.
Thanks in advance.If you're using Oracle Provider for OLE DB (OraOLEDB) to execute this stored procedure, you need to set PLSQLRSet attribute. This attribute can be set in registry, connection string, or command object. Please refer to User Documentation for more information.
-
How to call oracle stored procedure with OUT parameter?
I create oracle stored procedure in eclipse oepe
PROCEDURE SP_SELECT_ORA (
ID_INPUT IN VARCHAR2,
ID_OUTPUT OUT VARCHAR2,
PASSWD_OUTPUT OUT VARCHAR2,
NAME_OUTPUT OUT VARCHAR2) IS
BEGIN
SELECT EMP_ID, EMP_Passwd, EMP_Name
INTO ID_OUTPUT, PASSWD_OUTPUT, NAME_OUTPUT
FROM family
WHERE EMP_ID = ID_INPUT;
END;
and I try to call the sp in jpa like below,
@NamedNativeQueries({
@NamedNativeQuery(name = "callSelectSP", query = "call SP_SELECT_ORA(?,?,?,?)", resultClass = Members.class)
@Entity
@Table(name="family")
public class Members implements Serializable {
@Id
@Column(name = "EMP_ID")
private String ID;
@Column(name = "EMP_Passwd")
private String Passwd;
@Column(name = "EMP_Name")
private String Name;
==============
@PersistenceContext(unitName="MyFamily")
EntityManager em;
query = em.createNamedQuery("callSelectSP");
query.setParameter(1, ID);
String id_output = null;
String passwd_output = null;
String name_output = null;
query.setParameter(2,id_output);
query.setParameter(3,passwd_output);
query.setParameter(4,name_output);
query.executeUpdate();
member = (Members)query.getSingleResult();
But this query throws exception,
19:55:35,500 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 1465, SQLState: 72000
19:55:35,500 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-01465: invalid hex number
I don't know how. Pls, give me your advice. Thanks in advnace.
Best regardsThank you for your reply, Chris!
I tried this one.
@NamedNativeQueries({
@NamedNativeQuery(name = "callSelectSP", query = "exec SP_SELECT_ORA( ?, :id_output, :passwd_output, :name_output) " , resultClass = Members.class)
@Entity
@Table(name="family")
public class Members implements Serializable
===================
query = em.createNamedQuery("callSelectSP");
query.setParameter(1, ID);
String id_output = null;
String passwd_output = null;
String name_output = null;
query.setParameter("id_output", id_output);
query.setParameter("passwd_output", passwd_output);
query.setParameter("name_output",name_output);
query.executeUpdate();
On Console hibernate shew the sql and ora # like below,
19:59:25,160 INFO [stdout] (http--127.0.0.1-8080-1) Hibernate: exec SP_SELECT_ORA( ?, ?, ?, ?)
19:59:25,192 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 900, SQLState: 42000
19:59:25,192 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-00900: Invalid SQL statement
Pls, inform me your advice. Thanks in advance.
Best regards. -
Execute immediate for stored procedure with out parameter
Hi,
I have problem with dynamically executing the statement hope anyone can help me.
I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
TABLE1_
PROCESS_ID PROC_NAME
1 proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
2 proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
TABLE2_
PROCESS_ID PROC_PARMS
1 100, 'test', :return
2 200, :return1, :return2
Thank You826957 wrote:
Hi,
I have problem with dynamically executing the statement hope anyone can help me.
I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
TABLE1_
PROCESS_ID PROC_NAME
1 proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
2 proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
TABLE2_
PROCESS_ID PROC_PARMS
1 100, 'test', :return
2 200, :return1, :return2
Thank YouSounds like an appalling design and a nightmare waiting to happen.
Why not have your Java just call the correct procedures directly?
Such design smells badly of an entity attribute value modelling style of coding. Notoriously slow, notoriously buggy, notoriously hard to maintain, notoriously hard to read. It really shouldn't be done like that. -
Invoking Stored Procedure with OUT Parameter
I am calling a stored procedure that has a "out" parameter of PL/SQL type (table of varchar2) through toplink API. My procedure executes, performs the updates successfully, but I can not obtain the value of the out parameter. Is the approach followed below incorrect? I could not figure out by looking into examples provided in the documentation:
http://download.oracle.com/docs/cd/B25221_04/web.1013/b25386/building_and_using_application_services009.htm#BCFEFAHC
Java function is given below:
public List removeFromAutoupdSched( List srNumbers, String userName)
if (srNumbers == null || srNumbers.size() == 0)
return null;
List result = null;
try
//Example Stored procedure call with an output parameter
DatabaseLogin login = m_dbSess.getLogin();
Connection conn = (Connection) (java.sql.Connection)login.connectToDatasource(null);
oracle.sql.ArrayDescriptor arrDesc = new oracle.sql.ArrayDescriptor("AUTOUPD_SRLIST_T", conn);
oracle.sql.ARRAY srARR = new oracle.sql.ARRAY(arrDesc, conn, srNumbers.toArray());
StoredProcedureCall procCall = new StoredProcedureCall();
procCall.setProcedureName("SEW_AUTOUPD.PURGE_AUTOUPD_SCHEDULE");
procCall.addNamedArgumentValue("excludeSRlist", srARR);
procCall.addNamedArgumentValue("exclude_by", userName);
procCall.addNamedOutputArgument(
"excludeSR_srlist_status",
"excludeSR_srlist_status",
OracleTypes.ARRAY,
"AUTOUPD_SRLIST_ERRS_T"
ValueReadQuery vq = new ValueReadQuery();
vq.setCall(procCall);
oracle.sql.ARRAY srResultARR = (oracle.sql.ARRAY)m_dbSess.executeQuery(vq);
if (srResultARR != null)
String[] msgs = (String[])srResultARR.getArray();
if (msgs.length > 0)
result = Arrays.asList(msgs);
Iterator iter = result.iterator();
while (iter.hasNext())
System.out.println("msg = " + iter.next());
return result;
catch (Exception exc)
throw new RuntimeException(exc);
PL/SQL Type
create or replace TYPE autoupd_srlist_errs_t IS TABLE OF VARCHAR2(150);
Sample procedure called by toplink:
PROCEDURE purge_autoupd_schedule(
excludeSRlist autoupd_srlist_t,
exclude_by VARCHAR2,
excludeSR_srlist_status OUT NOCOPY autoupd_srlist_errs_t)
IS
pkg sew_log.pkg_name%TYPE default upper('sew_autoupd');
prc sew_log.prc_name%TYPE default upper('purge_autoupd_schedule(excludeSRlist, exclude_by)');
srno NUMBER;
-- cnt NUMBER := 0;
exclude_status VARCHAR2(150);
err_prefix VARCHAR2(50) := 'Unable to exclude from autoupdate, ';
BEGIN
FOR i IN excludeSRlist.FIRST..excludeSRlist.LAST
LOOP
BEGIN
srno := excludeSRlist(i);
-- Update actn_taken column in autoupd_schedule before doing delete.
UPDATE autoupd_schedule SET actn_taken='Removed by engineer', UPD_TIME=systimestamp
WHERE sr_no = srno and engr_itsid = exclude_by;
-- Add SR to exclusion list.
INSERT INTO autoupd_exclude(sr_no, exclude_by, exclude_time) VALUES (srno, exclude_by, systimestamp);
exclude_status := 'Item ' || i || ' - SR ' || srno || ' - ' || 'Excluded from autoupdate.';
excludeSR_srlist_status(i) := exclude_status;
EXCEPTION
WHEN others THEN
-- Add SR to excludeSR_fail if previous steps occurred okay.
-- cnt := cnt +1;
exclude_status := 'Item ' || i || ' - SR ' || srno || ' - ' || err_prefix || substr(sqlerrm,12);
excludeSR_srlist_status(i) := exclude_status;
END;
END LOOP;
EXCEPTION
WHEN others THEN
sew_logger.log(
code => substr(sqlerrm,1,9),
msg => substr(sqlerrm,12),
pkg => pkg,
prc => prc
END;
Any help is appreciated.What happens if you run the stored procedure through pure jdbc (without TopLink)?
I tried a simple example that worked for me:
//defined type in the db
CREATE TYPE "TEST"."VAR_LIST" AS TABLE OF VARCHAR2(150)
//defined stored procedure in the db
CREATE OR REPLACE PROCEDURE "TEST"."VAR_LIST_IN_OUT" (
VARS_IN VAR_LIST,
VARS_OUT OUT NOCOPY VAR_LIST
as
begin
VARS_OUT := VAR_LIST();
FOR i IN VARS_IN.FIRST..VARS_IN.LAST LOOP
VARS_OUT.EXTEND;
VARS_OUT(i) := CONCAT(VARS_IN(i), '_BLAH');
END LOOP;
end;
// Java code
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("VAR_LIST_IN_OUT");
Connection conn = (Connection) ((oracle.toplink.internal.sessions.AbstractSession)getSession()).getAccessor().getConnection();
oracle.sql.ArrayDescriptor arrDesc = new oracle.sql.ArrayDescriptor("VAR_LIST", conn);
oracle.sql.ARRAY srARR = new oracle.sql.ARRAY(arrDesc, conn, new String[]{"A1", "A2", "A3"});
call.addNamedArgumentValue("VARS_IN", srARR);
call.addNamedOutputArgument("VARS_OUT", "VARS_OUT", Types.ARRAY, "VAR_LIST");
ValueReadQuery query = new ValueReadQuery();
query.setCall(call);
Object result = getSession().executeQuery(query);
Object[] array = (Object[])((java.sql.Array)result).getArray();
for(int i=0; i<array.length; i++) {
System.out.println(array);
// System.out:
[TopLink Finest]: 2008.04.25 15:37:16.687--DatabaseSessionImpl(3491657)--Thread(Thread[main,5,main])--Execute query ValueReadQuery()
[TopLink Fine]: 2008.04.25 15:37:16.703--DatabaseSessionImpl(3491657)--Connection(29118152)--Thread(Thread[main,5,main])--BEGIN VAR_LIST_IN_OUT(VARS_IN=>?, VARS_OUT=>?); END;
bind => [oracle.sql.ARRAY@323274, => VARS_OUT] (There is no English translation for this message.)
A1_BLAH
A2_BLAH
A3_BLAH
My stored procedure didn't work (on Oracle 9 db) without output collection initialization: VARS_OUT := VAR_LIST(); and extending: VARS_OUT.EXTEND. -
Problems calling stored procedure with out ref cursors
Hi,
I am calling an oracle stored procedure and having problems. This is the code:
ResultSet cursor1, cursor2, cursor3, cursor4,cursor5,cursor6;
String sql = "BEGIN SYSADM.PKG_SERVICE.SERV_MAIN(:1,:2,:3,:4,:5,:6,:7,:8,:9) \n; END;";
CallableStatement call = null;
try
call = conn.prepareCall(sql);
call.setString(1,blah1);
call.setString(2,blah2);
call.setString(3,blah3);
call.registerOutParameter(4,OracleTypes.CURSOR);
call.registerOutParameter(5,OracleTypes.CURSOR);
call.registerOutParameter(6,OracleTypes.CURSOR);
call.registerOutParameter(7,OracleTypes.CURSOR);
call.registerOutParameter(8,OracleTypes.CURSOR);
call.registerOutParameter(9,OracleTypes.CURSOR);
call.execute();
cursor1 = ((OracleCallableStatement) call).getCursor(4);
cursor2 = ((OracleCallableStatement) call).getCursor(5);
cursor3 = ((OracleCallableStatement) call).getCursor(6);
cursor4 = ((OracleCallableStatement) call).getCursor(7);
cursor5 = ((OracleCallableStatement) call).getCursor(8);
cursor6 = ((OracleCallableStatement) call).getCursor(9);
on the cursor1 = line I get this exception:
06/08/08 15:07:01 java.lang.ClassCastException: com.evermind.sql.FilterCallableStatement
this is a web service running in JDeveloper 10.1.2
DennisDennis,
There is only one "data-sources.xml" file in my JDeveloper 10.1.3. It is in the "\j2ee\home\config" subdirectory.
But the again, I have not used my JDeveloper to create any Web services.
I really think you should try the JDeveloper and ADF forum.
Also, there are several debug properties you can set for OC4J.
Since you say you are using 10.1.2, the following Web page may be helpful:
http://www.oracle.com/technology/tech/java/oc4j/htdocs/oc4j-logging-debugging-technote.html
Good Luck,
Avi. -
Execute procedure with out parameter in sql*plus
HI All,
I am executing an stored proc with OUT parameter from sql*plus.
Getting this error message:
SQL> execute sp1_cr_ln_num('01',0,3);
BEGIN sp1_cr_ln_num('01',0,3); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to
'sp1_cr_ln_num'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Whereas it works fine using Toad. 4th parameter is for output.
Thanks.then you can see the value either using print :var or execute dbms_output.put_line(:var)
-
Calling Stored procedure with Parameters in PowerPivot DataModel
Hi All,
I wanted to call a SQL stored procedure from PowerPivot(Excel) on based on changing slicer's value.
Currently, we can call stored procedure wihtout any parameter from Data Model tab using
Exec stored_proc_name in Table Properties window.
What if I want to call the same procedure with a parameter whouse value will come by changing slicer's value. I meant, changing slicer value will act as a parameter to that stored procedure & it should return updated results.
Is this possible in PowerPivot?Hi Rameshwar,
According to your description, you call a SQL Server stored procedure in PowerPivot data model, now the problem is that you need to pass a parameter to the stored procedure, right?
Based on my research, it seems that we cannot achieve this requirement directly in current version of PowerPivot data model. Here is a similar thread for you reference.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5350228d-bc62-4a3b-a1a6-e847483e2858/powerpivot-for-excel-2013-call-execute-stored-procedure-with-parameters?forum=sqlkjpowerpivotforexcel
If you have any concern about this behavior, you can submit a feedback at
http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
in the following release after official confirmation.
Regards,
Charlie Liao
TechNet Community Support -
Please help to call oracle procedure with out paramter from shell script
Hi
I want to call a process with out parameter from shell script. I am calling process in shell script in below way
function Process_loads {
( echo 'set serveroutput on size 1000000 arraysize 1'
echo "set pagesize 0 term on verify off feedback off echo off"
echo "BEGIN"
echo " dbms_output.put_line('Before Calling The package'); "
echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
echo " dbms_output.put_line('After Calling The package'); "
echo "EXCEPTION "
echo " WHEN OTHERS THEN "
echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
echo " ROLLBACK;"
echo "END;"
echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
Here $error_code is out paramter. All varaibles passed in process are declared with export command.
When executing .sh it gives below error
"sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
Thanks in advanceYou can try this:
From sql*plus
SQL> ed
1 create or replace procedure my_proc(p_id in int, p_result out int)
2 as
3 begin
4 select 10 * p_id
5 into p_result
6 from dual;
7* end my_proc;
SQL> /
Procedure created.
SQL> set serveroutput on
SQL> declare
2 v_r int;
3 begin
4 my_proc(10,v_r);
5 dbms_output.put_line(v_r);
6 end;
7 /
100
PL/SQL procedure successfully completed.
from bash:
testproc.sh:
#!/bin/bash
(echo 'set serveroutput on';
echo 'declare';
echo 'v_r int;';
echo 'begin';
echo 'my_proc(10,v_r);';
echo 'dbms_output.put_line(v_r);'
echo 'end;';
echo '/';) | sqlplus -s u1/u1
Console:
oracle@mob-ubuntu:~$ chmod u+x testproc.sh
oracle@mob-ubuntu:~$ ./testproc.sh
100
PL/SQL procedure successfully completed.With kind regards
Krystian Zieja -
How to call stored procedure with multiple parameters in an HTML expression
Hi, Guys:
Can you show me an example to call stored procedure with multiple parameters in an HTML expression? I need to rewrite a procedure to display multiple pictures of one person stored in database by clicking button.
The orginal HTML expression is :
<img src="#OWNER#.dl_sor_image?p_offender_id=#OFFENDER_ID#" width="75" height="75">which calls a procedure as:
procedure dl_sor_image (p_offender_id IN NUMBER)now I rewrite it as:
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number)could anyone tell me the format for the html expression to pass multiple parameters?
Thanks a lot.
SamHi:
Thanks for your help! Your question is what I am trying hard now. Current procedure can only display one picture per person, however, I am supposed to write a new procedure which displays multiple pictures for one person. When user click a button on report, APEX should call this procedure and returns next picture of the same person. The table is SOR_image. However, I rewrite the HTML expression as follows to test to display the second image.
<img src="#OWNER#.Sor_Display_Current_Image?p_n_Offender_id=#OFFENDER_ID#&p_n_image_Count=2" width="75" height="75"> The procedure code is complied OK as follows:
create or replace
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
v_mime_type VARCHAR2(48);
v_length NUMBER;
v_name VARCHAR2(2000);
v_image BLOB;
v_counter number:=0;
cursor cur_All_Images_of_Offender is
SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
FROM sor_image
WHERE offender_id = p_n_Offender_id;
rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
BEGIN
open cur_All_Images_of_Offender;
loop
fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
v_counter:=v_counter+1;
if (v_counter=p_n_image_Count) then
owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
htp.p('Content-length: '||rec_Image_of_Offender.image_length);
owa_util.http_header_close;
wpg_docload.download_file (rec_Image_of_Offender.image);
end if;
exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
end loop;
close cur_All_Images_of_Offender;
END Sor_Display_Current_Image; The procedure just open a cursor to fetch the images belong to the same person, and use wpg_docload.download_file function to display the image specified. But it never works. It is strange because even I use exactly same code as before but change procedure name, Oracle APEX cannot display an image. Is this due to anything such as make file configuration in APEX?
Thanks
Sam -
Calling Stored Procedure with TestStand to SQL 2000
When I run the Stored Procedure in the query analyzer it returns the recordset fine. I am not specifying any parameters. I am Using TestStand 2.01 and SQL Server 2000. I am using the OPEN SQL STATEMENT step to call the SP. When I run the SP in TestStand I get no data returned. If I run the SQL statment in TestStand I get the data that I am requesting. Does TestStand not support stored procedures.
Hi,
The instructions that I posted were for TestStand 3.0. In version 3.0 you can call stored procedures with input/output paramateres and to support this functionality the data operation step support several new modes.
TestStand 2.0.1 does not support parameters on stored procedures, but it does support calling stored procedures that do not take parameters. To be able to access the data back from the database you need to set the cursor location (in the Advanced tab of the Open SQL Statement step) to Client (http://digital.ni.com/public.nsf/websearch/0EF68BF97AB1A61F86256B8E007D70C0?OpenDocument).
By changing the cursor to Client I was able to succesfully call a stored procedure from TestStand 2.0.1 and to read back the recordse
t return by the database. Please let me know if you are still experiencing dificulties.
Best regards,
Alejandro del Castillo
National Instruments
Maybe you are looking for
-
New Samsung - Intermittent Flicker
Just replaced a Samsung 225BW with a Samsung 245BW. I get intermittent flickering. Remedies tried: 1. Resetting resolution and refresh 2. Consulting Samsung web site 3. Changed cable Are there more settings possibilities? I realize this could be a ba
-
The audio line out on my G5 dual-core has stopped working. There is a tiny amount of output, but not enough to drive the speakers. The headphone jack in front works. Does this mean the sound card is bad? The machine is less than one year old - should
-
False Marketing and very unhelpful Customer Service
I got an email from Best Buy ob February 4 about 3X Rewards Points Promotion. As I was planning on purchasing a 65" TV, I walked into BestBuy store on February 28, 2015 but could not find it available at that time.So, I thought I will purchase $1400
-
sorry for bad english cheers
-
Classpath Behavior with Datasource
If I put this line in my orion-web.xml <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />I get this exception when my application module is checked out JBO-30003: The application pool (website.model.ser