DB Adapter calling PL/SQL Procedure gives error
Created partner link, calling pl/sql procedure with one in variable and one out variable. Invoke works fine. Assigning pl/sql return value to output is causing run time error. "Rebuild" and "Deploy" works file.
Here is the error:
Assign_2
[2007/08/03 14:18:06]
Error in evaluate <from> expression at line "93". The result is empty for the XPath expression : "/ns3:OutputParameters/ns3:OUT_STATUS_CODE".
oracle.xml.parser.v2.XMLElement@ba1893
Copy details to clipboard
[2007/08/03 14:18:06]
"{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.
- <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
- <part name="summary">
<summary>
empty variable/expression result.
xpath variable/expression expression "/ns3:OutputParameters/ns3:OUT_STATUS_CODE" is empty at line 93, when attempting reading/copying it.
Please make sure the variable/expression result "/ns3:OutputParameters/ns3:OUT_STATUS_CODE" is not empty.
</summary>
</part>
</selectionFailure>
Any input would be appreciated..
Thanks.
Thanks, it works.
In the “Assign Variables”
Changed from:
<copy>
<from variable="Invoke_1_ASNDBTest103_OutputVariable"
part="OutputParameters" query="/ns3:OutputParameters/ns3:OUT_STATUS_CODE"/>
<to variable="outputVariable" part="payload"
query="/ns2:ASNReturnStatus102"/>
</copy>
Changed to:
<copy>
<from variable="Invoke_1_ASNDBTest103_OutputVariable"
part="OutputParameters" query="/ns3:OutputParameters"/>
<to variable="outputVariable" part="payload"
query="/ns2:ASNReturnStatus102"/>
</copy>
So far so good, but one question, compiler gives warning…but everything works well.
Warning(97):
[Error ORABPEL-10041]: Trying to assign incompatible types
[Description]: in line 97 of "C:\HOME\jdevOAExt3\jdevhome\jdev\mywork\ASNTest101\BPELProcess1\bpel\BPELProcess1.bpel", <from> value type "{http://xmlns.oracle.com/pcbpel/adapter/db/APPS/XRX_BPEL_INSERT_ASN_TMP102/}OutputParameters anonymous type" is not compatible with <to> value type "{http://www.thiscompany.com/ns/sales}ASNReturnStatus102".
[Potential fix]: Please make sure that the return value of from-spec query is compatible with the to-spec query.
Also, instead of direct variable to variable copy, used expression to variable copy and it works. You can avoid the warning from the compiler.
Does not work ==> bpws:getVariableData('Invoke_1_ASNDBTest103_OutputVariable','payload','/ns3:OutputParameters/ns3:OUT_STATUS_CODE')
Works ==> bpws:getVariableData('Invoke_1_ASNDBTest103_OutputVariable','payload','/ns3:OutputParameters’)
So, why the compiler warning?
Similar Messages
-
Calling PL/SQL Procedures from Java
Hello,
I want to know, if it is possible to call PL/SQL Procedures from
SQLJ(which uses htp.print from the Package web toolkit ).
Though, it is possible to call normal procedures but if I want
to call PL/SQL procedures with htp.print then I get I error.
For example:
#sql{Call html_test()};
Can you give me a advice?
Your help is much appreciated!
M|llerOracle's htp packages are develop to be work with
mod_plsql/OAS/OWS webserver.
If you are trying to use htp packages first need to instanciate
some enviroment vars for htp packages, for example first you has
to call to owa.initialize procedure, populate owa.cgi array and
so on.
If you need more information about how this toolkit works you
could get the source of DB Prism at
http://www.plenix.com/dbprism/ this open source framework
includes backward compatibility with mod_plsql application and
then includes settings of this values from Java code.
Best regards, Marcelo. -
Call PL/SQL procedure from JDeveloper
Is that possible to call PL/SQL procedure from JDeveloper?
What's the setup and coding requirements?
Thanks for any input.This is the Code:_
package oracle.e1.bssv.J594101;
import java.util.Hashtable;
import javax.naming.NamingException;
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.sql.*;
public class CallSQLProcedure3 {
public CallSQLProcedure3() {
public static void main(String[] args) {
// try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.rmi.RMIInitialContextFactory");
// env.put(Context.PROVIDER_URL,
"ormi\\://localhost\\:23891/current-workspace-app");
// env.put(Context.PROVIDER_URL,
"ormi://localhost:23791/E1Services-LOCALDEV");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791");
// env.put(Context.PROVIDER_URL,
"ormi://localhost\\:23791/current-workspace-app");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
Context ctx3 = null;
try {
ctx3 = new InitialContext(env);
} catch (NamingException e) {
// TODO
// Context ctx = null;
try {
// NamingEnumeration n= ctx3.list("ormi://localhost:23791");
// System.out.println(n.hasMore());
Hashtable h = ctx3.getEnvironment();
// while(h.elements().hasMoreElements())
System.out.println(" name " +
h.elements().nextElement().toString());
// InitialContext initialContext = new InitialContext();
// javax.sql.DataSource ds =
(javax.sql.DataSource)initialContext.lookup("jdbc/DBConnection1DS");
// javax.sql.DataSource ds =
(javax.sql.DataSource)ctx3.lookup("jdbc/DBConnection1DS");
// javax.sql.DataSource ds =
(javax.sql.DataSource)ctx3.lookup("jdbc/OracleDS");
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx3.lookup("jdbc/DBConnection1DS");
java.sql.Connection conn;
try {
conn = ds.getConnection();
} catch (SQLException e) {
// TODO
// ctx = new InitialContext();
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
// Hashtable h = envCtx.getEnvironment();
// while(h.elements().hasMoreElements())
// System.out.println(" name " + h.elements().nextElement().toString());
DataSource ds2 = (DataSource)envCtx.lookup("DBConnection1DS");
// Connection conn;
// try {
// conn = ds.getConnection();
// } catch (SQLException e) {
// TODO
// } catch (NamingException e) {
// // TODO
// DataSource dataSource = null;
// } catch (NamingException ne) {
// try {
// dataSource = (DataSource)ctx.lookup("jdbc/DBConnection1DS");
// } catch (NamingException e) {
// e.printStackTrace();
// String myError1="Error occured with Initial Context";
Connection conn2;
try {
conn2 = ds2.getConnection();
// conn = ds.getConnection();
} catch (SQLException e) {
// TODO
} catch (NamingException e) {
// TODO
e.printStackTrace();
System.out.println("Error looking up " +e);
This is the Error:_
error message from executing a code ds.getConnection();
D:\oracle\jdevstudio10133\jdk\bin\javaw.exe -client -classpath
D:\e812\ETDV812\Java\classes;D:\oracle\jdevstudio10133\webservices\lib\jaxrpc-api.jar;D:\oracle\jdevstudio10133\webservices\lib\wsclient.jar;D:\oracle\jdevstudio10133\webservices\lib\wsserver.jar;D:\oracle\jdevstudio10133\webservices\lib\wssecurity.jar;D:\oracle\jdevstudio10133\webservices\lib\wsdl.jar;D:\oracle\jdevstudio10133\webservices\lib\orasaaj.jar;D:\oracle\jdevstudio10133\webservices\lib\saaj-api.jar;D:\oracle\jdevstudio10133\webservices\lib\orawsdl.jar;D:\oracle\jdevstudio10133\webservices\lib\orawsrm.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxr_api.jar;D:\oracle\jdevstudio10133\webservices\lib\orajaxr.jar;D:\oracle\jdevstudio10133\webservices\lib\relaxngDatatype.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxb-impl.jar;D:\oracle\jdevstudio10133\webservices\lib\jaxb-libs.jar;D:\oracle\jdevstudio10133\webservices\lib\xsdlib.jar;D:\oracle\jdevstudio10133\webservices\lib\mdds.jar;D:\oracle\jdevstudio10133\jlib\jaxen.jar;D:\oracle\jdevstudio10133\jlib\oraclepki!
.jar;D:\oracle\jdevstudio10133\jlib\ojpse.jar;D:\oracle\jdevstudio10133\jlib\osdt_core.jar;D:\oracle\jdevstudio10133\jlib\osdt_cert.jar;D:\oracle\jdevstudio10133\jlib\osdt_xmlsec.jar;D:\oracle\jdevstudio10133\jlib\osdt_wss.jar;D:\oracle\jdevstudio10133\jlib\osdt_saml.jar;D:\oracle\jdevstudio10133\jlib\repository.jar;D:\oracle\jdevstudio10133\jlib\ojmisc.jar;D:\oracle\jdevstudio10133\j2ee\home\lib\http_client.jar;D:\oracle\jdevstudio10133\j2ee\home\jazncore.jar;D:\oracle\jdevstudio10133\j2ee\home\oc4jclient.jar;D:\oracle\jdevstudio10133\rdbms\jlib\xdb.jar;D:\oracle\jdevstudio10133\diagnostics\lib\ojdl2.jar;D:\e812\ETDV812\ini\sbf;D:\e812\System\Classes\Base_JAR.jar;D:\e812\System\Classes\BizLogicContainer_JAR.jar;D:\e812\System\Classes\BusinessLogicServices_JAR.jar;D:\e812\System\Classes\Connector.jar;D:\e812\System\Classes\EventProcessor_JAR.jar;D:\e812\System\Classes\Generator_JAR.jar;D:\e812\System\Classes\JdbjBase_JAR.jar;D:\e812\System\Classes\JdbjInterfaces_JAR.jar;D:\!
e812\System\Classes\JdeNet_JAR.jar;D:\e812\System\Classes\Maf2Base_JAR
.jar;D:\e812\System\Classes\mafsecurity.jar;D:\e812\System\Classes\Metadata.jar;D:\e812\System\Classes\MetadataInterface.jar;D:\e812\System\Classes\PMApi_JAR.jar;D:\e812\System\Classes\SBFFoundation_JAR.jar;D:\e812\System\Classes\Spec_JAR.jar;D:\e812\System\Classes\System_JAR.jar;D:\e812\System\Classes\SystemInterfaces_JAR.jar;D:\e812\System\Classes\castor.jar;D:\e812\System\Classes\log4j.jar;D:\e812\System\Classes\xerces.jar;D:\e812\System\Classes\xml-apis.jar;D:\e812\System\Classes\Rijndael.jar;D:\e812\System\Classes\ManagementAgent_JAR.jar;D:\e812\System\Classes\commons-logging.jar;D:\e812\System\Classes\commons-codec-1.3.jar;D:\e812\System\Classes\commons-httpclient-3.0.jar;D:\e812\System\Classes\jmxremote.jar;D:\e812\System\Classes\jmxremote_optional.jar;D:\e812\System\Classes\jmxri.jar;D:\e812\System\Classes\rmissl.jar;D:\e812\misc\ojdbc5.jar;D:\e812\misc\mssqlserver.jar;D:\e812\misc\msutil.jar;D:\e812\misc\msbase.jar;D:\e812\misc\db2java.zip;D:\e812\misc\jt400.jar;D:\!
e812\misc\sqljdbc.jar;D:\oracle\jdevstudio10133\lib\xmlparserv2.jar;D:\oracle\jdevstudio10133\lib\xml.jar
oracle.e1.bssv.J594101.CallSQLProcedure3
name com.evermind.server.rmi.RMIInitialContextFactory
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/bcel/generic/Instruction
at
oracle.oc4j.sql.spi.ConnectionHandle.getConnectionHandle(ConnectionHandle.java:725)
at
oracle.oc4j.sql.spi.ManagedConnectionImpl.getConnectionHandle(ManagedConnectionImpl.java:273)
at
oracle.oc4j.sql.spi.ManagedConnectionImpl.getConnection(ManagedConnectionImpl.java:255)
at
com.evermind.server.connector.ApplicationConnectionManager.createConnectionHandle(ApplicationConnectionManager.java:1786)
at
com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1472)
at
oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238)
at
oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
at
oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:272)
at
oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:200)
at
oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:142)
at
oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:127)
at
oracle.e1.bssv.J594101.CallSQLProcedure3.main(CallSQLProcedure3.java:70)
Process exited with exit code 1. -
Got Call pl/sql procedure in C#
Hi Experts,
I tried to call a pl/sql procedure TEST_COMP from a .NET app in C# and got the following error, but the same code worked in VB, any advice?
Thanks,
James
ORA-06550: line 1, column 7:
PLS-00201: identifier 'UTIL_PKG.TEST_COMP' must be declared
ORA-06550: line 1, column 7:
UTIL_PKG is the name of package, I logged in as the owner of the package.
Here is the C# code, that gets an error:
string cmdString = "UTIL_PKG.TEST_COMP";
OracleCommand cmd = new OracleCommand(cmdString,con);
cmd.CommandType = CommandType.StoredProcedure;
try
cmd.ExecuteNonQuery();
catch (Exception ex)
Console.WriteLine(ex.Message);
Here is the VB code that works:
Dim cmdString As String = "UTIL_PKG.TEST_COMP"
Dim cmd As OracleCommand = New OracleCommand(cmdString)
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
Try
cmd.ExecuteNonQuery()
Catch ex As Exception
Console.WriteLine(ex.Message)Double post:
Re: Got PLS-00201 error when call ps/sql procedure from .NET app in C#
The bottom line is it should work in both. So either you aren't telling us all the details, or something has changed and you don't even know it. -
How to Call PL/SQL Procedure
Hi
I am trying to call PL/SQL Procedure in OCI but i didn't get success, Please answer,
Thank you in advance
nullHere is a very short sample. Hope it helps
char SQLStatemen[] ="BEGIN spFoo (:P_Name);END;";
/* Initialize everything */
OCIBindByName (CommandHandler, &OCIBindName, ErrorHandler, (text *) ":P_Name", -1, (dvoid *) Name, strlen(Name) +1, SQLT
_STR, (dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT) == OCI_ERROR);
OCIStmtExecute (ServiceContext, CommandHandler,ErrorHandler, 1, 0, (OCISnapshot *) NULL,(OCISnapshot *) NULL, OC
I_DEFAULT);
/* if P_Name is an out parameter, at this point, it has the value it got from the database */
/* logoff and close everything */ -
How to call pl/sql procedure/function from XML
Hi,
I have a requirement to call pl/sql function/procedure from the RTF template. How can I do this?Hi,
I have got the same requirement. We need to call the store PL/SQL procedure from the XML template to generate the fixedwidth files. Could you tell me if you are able to call PL/SQL procedure from XML template?
Thanks,
Ram -
Calling PL/SQL procedures from a Windows CMD script
Hello,
I am writing a Windows CMD script. From this script I want to call procedures from a PL/SQL package which selects, inserts or deletes rows from the database.
How do I go about logging into the database from the cmd script and calling PL/SQL procedures from there?
Does anyone have any examples of such scripts? Thanks in advance.No, it is not a job that needs to be scheduled.
The script will be used when needed to select info from a certain table and also to insert or delete certain info into/from this table (so, it is just simple sql statements which I have put into a package), but I'm sure how to log into the database and execute the procedures from this package in a cmd script. -
Calling PL/Sql Procedure in Jdeveloper 11g
Hi All,
How to call PL/Sql Procedure in Jdeveloper 11G. Here my procedure prints some statements in procedure using "dbms.output.put_line" . Here I want to call that procedure using button (or) ImageLink and print all the statements in pl/sql procedure in Jdeveloper Environment.
Can anybody help on this .
Thanks in Advance .
Edited by: u41411 on Sep 28, 2009 7:18 AMHer is what I use to call Oracle DB procedure:
procCall = "BEGIN " + YOUR_PROC_NAME + "(); END;";
returned = am.getTransaction().executeCommand(procCall);
where am is my application Module
Hope this help.
Jack -
Calling PL/SQL Procedure In Another Schema Gives Unexpected Result
I have a SQL Script that does this:
conn pnr/<password for user pnr>;
set serveroutput on;
exec vms.disable_all_fk_constraints;
SELECT owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R';
and the disable_all_fk_constraints procedure that is owned by user 'vms' is defined as:
create or replace
procedure disable_all_fk_constraints is
v_sql VARCHAR2(4000);
begin
dbms_output.put_line('Disabling all referential integrity constraints.');
for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type='R') loop
dbms_output.put_line('Disabling constraint ' || rec.constraint_name || ' from ' || rec.table_name || '.');
v_sql := 'ALTER TABLE ' || rec.table_name || ' DISABLE CONSTRAINT ' || rec.constraint_name;
execute immediate(v_sql);
end loop;
end;
When I run the SQL script, the call to vms.disable_all_fk_constraints disables the FK constrains in the 'vms' schema, whereas I wanted it to disable the FK constraints in the 'pnr' schema (the invoker of the procedure). I know that I could make this work by copying the disable_all_fk_constraints procedure to the 'pnr' schema and calling it as "+exec disable_all_fk_constraints;+" from within the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.
What can I do?
Thank youYou have two issues to solve.
First you need to write a packaged procedure that works with INVOKER rights. The default is DEFINER rights.
The difference is excatly what you need. Usually the package has the rights from the schema where it is defined (=Definer rights). In your case schema VMS. Whereas you need the privileges from the user that calls the package (PNR).
=> Check out the documentation for INVOKER rights
The second problem is that the view "user_constraints" will not give the results you expect when called from inside a procedure in another schema. An alternative could be to use the view DBA_CONSTRAINTS with a filter on the owner (where owner = 'PNR'). Not sure if there are other working possibilities. Well you could create a list of constraint names that you want to disable, instead of creating the list dynamically.
And you could have another potential disaster creeping up upon you. If you run this thing, then at this moment you don't have any referential integrity anymore. You can't be sure that you can create the FKs again after this action. This is EXTREMLY DANGEROUS. I would never ever do this in any kind of production or test database. I would be very careful when I do it on a development database. -
Error during calling PL/SQL procedure
Hi,
Error occurs while calling the oracle PL/SQL procedure from Java using Callable Statement.
Below is my code
cs = conn.prepareCall("{call prc_ins(?, ?, ?, ?, ?, ?,?)}"); cs.setString(1, strAryCols[11]);
cs.setString(2, strAryCols[5]);
cs.setString(3, strAryCols[8]);
cs.setString(4, strAryCols[10]);
cs.setString(5, strAryCols[7]);
cs.setString(6, "ER");
cs.registerOutParameter(7, Types.VARCHAR);
cs.execute();
I receive the following Error Message
Error in Inserting: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'PRC_INS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Can somebody help?
Regards,
RPS15RPS15 wrote:
Hi,
Error occurs while calling the oracle PL/SQL procedure from Java using Callable Statement.
Below is my code
cs = conn.prepareCall("{call prc_ins(?, ?, ?, ?, ?, ?,?)}"); cs.setString(1, strAryCols[11]);
cs.setString(2, strAryCols[5]);
cs.setString(3, strAryCols[8]);
cs.setString(4, strAryCols[10]);
cs.setString(5, strAryCols[7]);
cs.setString(6, "ER");
cs.registerOutParameter(7, Types.VARCHAR);
cs.execute();
I receive the following Error Message
Error in Inserting: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'PRC_INS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Can somebody help?
Regards,
RPS15Most of the times I see people calling stored procedures which return an output parameter, the SQL looks like this:
{? = call blah(?, ?, ...)}
[http://www.google.com/search?hl=en&q=prepareCall+call+registerOutParameter] -
403 Forbidden error calling PL/SQL Procedure from URL
I am getting a 403 Forbidden browser error when calling a PL/SQL procedure from the URL, as in this:
http://<server.port>/apex/SCHEMA.procedure_name/f?p_param1=394&p_param2=2, etc
We are upgrading from HTMLDB 2.0 to APEX 4.0.2. I do not believe the upgrade has anything to do with it, c/o the upgraded app works fine in another APE 4.0.2 environment.
The upgrade is to new machines, new DB and new app server, Oracle Web Tier, Oracle HTTP server deployment.
The dads.conf entries are fine, all standard:
Alias /i/ "/apexd01/app/oracle/product/http/Oracle_WT1/ohs/images/"
Alias /c/ "/apexd01/app/oracle/product/http/Oracle_WT1/ohs/custom_htmldb/"
<Location /pls/apexd>
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
PlsqlDatabaseConnectString dbserver.us.com:1521:SERVER.US.COM ServiceNameFormat
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDefaultPage apex
PlsqlDatabasePassword apexpwd
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Allow from all
</Location>
The GRANT EXECUTE ON procedure TO PUBLIC is there.
A call to the same procedure via a process in an APEX page works fine - the procedure is OK.
The call from javascript, which sets up the call from the URL, is the one that fails with the 403 Forbidden error.
The same app works fine in another APEX 4.0.2 environment, so I know it is not the JS; It has to be some configuration setting in this environment.
I do NOT have access to the app server.
I have asked that they compare the httpd.conf, and all underlying conf files, to check for differences.
In order for me to be more specific, and hopefully speed up the troubleshooting process, can anyone suggest what other settings to look at?
Thank you - KarenHello,
Good catch, but the difference in URL is in fact the difference in my env to theirs. My typo in not correcting my example to match the dads.conf entry of /pls/apexd. My env uses /apex/. Just saves on my typing.
As an update, I asked the DBA to double-check, and yes, the www_flow_epg_include_mod_local function IS there.
www_flow_epg_include_mod_local is an APEX function.
So now we are trying adding procedures to it. I'll let you know if it works.
My previous question remains - why would I need to do this in one env, and not another,
given that the DB GRANTs are there.
Is there a particular app server setting that wil block execution of PL/SL procedures from the URL?
My guess is, there is some difference in configuration settings for the app server, somewhere in the httpd.conf chain.
Since I do not have access to those files, I cannot do a diff myself, as I would have if I the issue was on my machine.
I am in a situation where I can suggest what to do, but that's it. I agree, it's hard to troubleshoot in this situation.
I am being asked "what setting do I need to change?" without the benefit of access to what is there,so I am doing the best I can, without diverting from my work for a deep-dive refresher session on httpd.conf settings.
So, if anyone is aware of some setting that would block execution of a PL/SQL proc from the URL, please let me know,
and of course, if adding a proc to www_flow_epg_include_mod_local works, I'll be happy. Just still curious.
Thank you - K -
Returning Multiple Rows From DBAdapter Calling PL/SQL Procedure
Oracle XE 10g Express Edition
JDeveloper 11.1.1.2.0
WebLogic Server 11g
Guys,
I have a table of orders, which I need to interrogate, and pass back any matching rows which meet certain criteria (e.g. status = 'OPEN').
However, rather than create a DBAdapter using an Operation Type of "Peform an Operation on a Table/Select", I need to use an Operation Type of "Call a Stored Procedure or Function".
I therefore need the procedure to return all the matching rows, rather than a single row.
I have looked at declaring return parameters for the procedure of the following types:
RECORD - is good because it allows me to return the elements of the row with their correct datatypes, but does not meet my needs because it will only support the return of a single row.
VARRAY - good because it can contain many row elements, but not good because it only supports a single row return, and also because all elements of the VARRAY must be of the same data type.
TABLE - good because it can contain many rows, but bad because each row can contain only two elements - the index element and the data element.
I think I could first define a RECORD (to hold a row), and then define a TABLE, with the data element being the RECORD, but I have found JDeveloper very fussy indeed when dealing with 'non-standard' data types in the DBAdapter.
Apologies if I am missing something obvious, but can anyone suggest a way of doing this?
Many thanks in advance.
Edited by: user2541290 on 17-Feb-2010 02:48Hi, I've been able to create process that seems to work. My platform is a but different but I don't think this is important for your question.
Here is the PL/SQL code. Just make Db Adapter for Calling stored procedure and it returns all rows!
Be aware of possible limitations on how manyrows you could return in one select! This can have severe impact on performance.
Succes.
Jos Baan
CREATE OR REPLACE PACKAGE lab2_multiple_rows IS
-- Author : 801455
-- Created : 18-2-2010 8:05:52
-- Purpose :
-- Public type declarations
TYPE rrows IS RECORD(
mutdat DATE,
opmerking VARCHAR2(20));
TYPE trows IS TABLE OF rrows INDEX BY BINARY_INTEGER;
-- Public constant declarations
-- Public variable declarations
-- Public function and procedure declarations
FUNCTION retrows RETURN trows;
END lab2_multiple_rows;
CREATE OR REPLACE PACKAGE BODY lab2_multiple_rows IS
-- Private type declarations
-- Private constant declarations
-- Private variable declarations
-- Function and procedure implementations
FUNCTION retrows RETURN trows IS
lrows trows;
lidx binary_integer := 1;
BEGIN
FOR rsql IN (SELECT t.* FROM jba_transactions t ORDER BY t.mutdat)
LOOP
lrows(lidx).mutdat := rsql.mutdat;
lrows(lidx).opmerking := rsql.opmerking;
lidx := lidx + 1;
END LOOP;
RETURN(lrows);
END;
BEGIN
-- Initialization
NULL;
END lab2_multiple_rows;
Edited by: Baan, Jos on 18-feb-2010 8:53 -
Jdbc NullPointerException calling pl/sql procedure from java
Hi.
Getting the following exception calling a plsql procedure from jdbc.
- Jdbc version is 10.2.0.2, but it also happens running several other variants, including 10.1.0.5.0.
- Application is running in Weblogic 8.1.3 (8.1 SP 3).
The procedure call itself has 2 in/out parameters which are tables (actually just 1 dimensional arrays), which I'm suspecting has something to do with the problem. I can successfully call this procedure using a plsql developer tool with the same bind parameters.
Any ideas?
Exception encountered while executing PL/SQL procedure MVT_Web_Inquiry.ShowInquiry:
java.lang.NullPointerException at oracle.jdbc.driver.T4CTTIiov.processRXD([Loracle.jdbc.driver.Accessor;I[B[C[SILoracle.jdbc.driver.DBConversion;[B[B[[Ljava.io.InputStream;[[[B[[Loracle.jdbc.oracore.OracleTypeADT;Loracle.jdbc.driver.OracleStatement;[B[C[S)[Loracle.jdbc.driver.Accessor;(T4CTTIiov.java:139)
at oracle.jdbc.driver.T4C8Oall.receive()V(T4C8Oall.java:521)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(ZZZZ)V(T4CCallableStatement.java:215)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(Z)V(T4CCallableStatement.java:1119)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()V(OracleStatement.java:1278)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal()I(OraclePreparedStatement.java:3446)
at oracle.jdbc.driver.OraclePreparedStatement.execute()Z(OraclePreparedStatement.java:3552)
at oracle.jdbc.driver.OracleCallableStatement.execute()Z(OracleCallableStatement.java:5261)
at weblogic.jdbc.wrapper.PreparedStatement.execute()Z(PreparedStatement.java:70)
at
[snip]OK... I figured it out.
Apparently, this error happens when you forget to register the output part of an in/out parameter. I would have hoped for better error messaging, but oh well.
-ed- -
How to call Pl/sql procedure from form ?
Hi all,
I need to call a procedure from form after the user has pressed the button to invoke the sql procedure, can anyone please advise me on how to do it ?
Thanks.
LimHi,
Thanks for your reply.
yes, I have include in when-button-pressed trigger as
AIC_PROC_AR_CCID_UPD;
Below is my procedure :-
CREATE OR REPLACE PROCEDURE AIC_PROC_AR_CCID_UPD(errbuf out Varchar2,
retcode out Number ) is
VAR_BUF VARCHAR2(240);
Cursor C1 is
SELECT CONCATENATED_SEGMENTS ACCT,
SEGMENT5 SEG5
FROM AIC_GL_COA AGC
WHERE AGC.CODE_COMBINATION_ID IS NULL;
Rec1 C1%RowType;
BEGIN
FOR Rec1 IN C1 LOOP
BEGIN
UPDATE AIC_GL_COA A SET ( DESCRIPTION, CODE_COMBINATION_ID, SEGMENT5 )=
( SELECT FFVT.DESCRIPTION, GLA.CODE_COMBINATION_ID, GLA.SEGMENT5
FROM GL_CODE_COMBINATIONS_KFV GLA,
FND_FLEX_VALUES_TL FFVT,
FND_FLEX_VALUES FFV
WHERE GLA.CONCATENATED_SEGMENTS = REC1.ACCT
AND FFV.FLEX_VALUE = REC1.SEG5
AND FFV.FLEX_VALUE_ID = FFVT.FLEX_VALUE_ID
AND FFV.FLEX_VALUE_SET_ID = 1002673 )
WHERE A.SEGMENT5 = REC1.SEG5 ;
EXCEPTION
WHEN NO_DATA_FOUND THEN
FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'NO RECORD UPDATE !!');
END;
END LOOP;
COMMIT;
RETURN;
END;
However, when I try to compile it, error prompt :-
Error 306 at line 1, column 1
wrong number or types of arguments in call to 'AIC_PROC_AR_CCID_UPD'
Error 0 at line 1, column 1
statement ignored.
By the way, my form 6i is running at client site and connection to procedure in unix server. Will this is ok ?
Thanks
Rgds
Lim -
Calling PL/SQL procedure that returns boolean in java
Hi All,
Was not sure weather to post this on Java forum threads or PL/SQL forum threads. So posting at both locations.
I have to call a PL/SQL procedure from java. This PL/SQL has IN/OUT parameters as well as return a Boolean value.
The procedure definition is as follows:
FUNCTION GET_NEXT(O_error_message IN OUT VARCHAR2,
IO_item_no IN OUT ITEM_MASTER.ITEM%TYPE,
I_item_type IN ITEM_MASTER.ITEM_NUMBER_TYPE%TYPE)
return BOOLEAN;
END ITEM_NUMBER_TYPE_SQL;
And the java function I am using is as follows:
This is in the ADF Application module impl code
public String callNextItem(){
CallableStatement callableStmt = null;
String rmsUser = getDBTransaction().getConnectionMetadata().getUserName();
String callableStatement = "begin ? := ITEM_NUMBER_TYPE_SQL.VALIDATE_FORMAT(?,?,?); end;";
System.out.println("callableStatement "+callableStatement);
try{
callableStmt = getDBTransaction().createCallableStatement(callableStatement,0);
callableStmt.registerOutParameter(1, Types.*BIT*);
callableStmt.registerOutParameter(2, Types.VARCHAR);
callableStmt.registerOutParameter(3, Types.VARCHAR);
callableStmt.registerOutParameter(4, Types.VARCHAR);
callableStmt.setBoolean(1, false);
callableStmt.setString(2, "");
callableStmt.setString(3, "");
callableStmt.setString(4, "UPC-A");
callableStmt.executeUpdate();
System.out.println("STATUS : " + callableStmt.getString(3));
System.out.println("ERROR : " + callableStmt.getString(2));
String status = "";
getDBTransaction().commit();
System.out.println("commited ");
callableStmt.close();
return status;
}catch(SQLException e){
System.out.println("Error:" +e);
throw new JboException(e);
But this function never works. Throws "not valid expression type" error.
I have called several PL/SQL procedures before, only difference being
they never used to return any value. Particularly I feel the cause of the
error is the Boolean type that is returned from the procedure.
If you have any idea, please help.http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#34_05
Maybe you are looking for
-
How to generate PDF copy of invoice list
Hi All, I need a favor from you in helping to generate a PDF copy to invoice list . I observed that spool is not generated for this print output of invoice list but output successfully triggered. we have z report (zretrieval ) to generated the PDF
-
Acrobat 9 Standard - Using Network Drives
Three technical writers here at work use Acrobat 9.1.1 Standard. We all work/edit/save/publish on network drives. We are all experiencing unexplainable crashes, including error messages such as, "This document has been corrupted and cannot be repaire
-
Hi chaps and chapesses, been a while. Hope you're all well. Here's one for the pros: I have always worked with the 'everything in one project file' approach. As project file sizes head north of about 125MB, I tend to start to strip the project file o
-
Check current report user security inside CLR code
Hi, I am writing a CLR stored procedure which will be invoked via a SSRS report.This SP will call a web service to fetch secure data. As this data is critical, we are implementing many security measures, one of the measure is to check inside CLR asse
-
Imaging Payables Invoices upon Receipt for attachment to approval workflow
Looking for a solution to image Payable Invoices on receipt. This Invoice image has to flow through the approval workflow as an attachment with the ability to open / print. Would appreciate any help you may be able to provide or insight from any expe