SQL Exception: Invalid column index while calling stored proc from CO.java
Hello all,
I am getting a "SQL Exception: Invalid column index" error while calling stored proc from CO.java
# I am trying to call this proc from controller instead of AM
# PL/SQL Proc has 4 IN params and 1 Out param.
Code I am using is pasted below
==============================================
OAApplicationModule am = (OAApplicationModule)oapagecontext.getApplicationModule(oawebbean);
OADBTransaction txn = (OADBTransaction)am.getOADBTransaction();
OracleCallableStatement cs = null;
cs = (OracleCallableStatement)txn.createCallableStatement("begin MY_PACKAGE.SEND_EMAIL_ON_PASSWORD_CHANGE(:1, :2, :3, :4, :5); end;", 1);
try
cs.registerOutParameter(5, Types.VARCHAR, 0, 2000);
cs.setString(1, "[email protected]");
cs.setString(2, s10);
//Debug
System.out.println(s10);
cs.setString (3, "p_subject " );
cs.setString (4, "clob_html_message - WPTEST" );
outParamValue = cs.getString(1);
cs.executeQuery();
txn.commit();
catch(SQLException ex)
throw new OAException("SQL Exception: "+ex.getMessage());
=========================================
Can you help please.
Thanks,
Vinod
You may refer below URL
http://oracleanil.blogspot.com/2009/04/itemqueryvoxml.html
Thanks
AJ
Similar Messages
-
Java.sql.SQLException: Invalid column index Query: while using ROWNUM
hi ,
i am getting the invalid column index query error while executing following query .i m able to run it properly without using rownum but when i append rownum i m getting error.i m using apache queryrunner for execution of query.
java.sql.SQLException: Invalid column index Query: select * from (
SELECT
TO_CHAR(A.REQ_FOR_RATING_ID) RFQID,
TO_CHAR(F.COV_PLAN_ID) COVPLANID,
B.FIRM_NAME FIRMNAME,
B.PRIMARY_ZIP_CD ZIP,
A.PRODUCR_CD PRODUCERCD,
A.PRODUCR_NAME PRODUCER,
H.COV_NAME COVDESP,
C.SALE_OFFC_CD SALEOFFCCD,
C.USR_OFFC_NAME USROFFC,
C.USR_NAME USR,
C.USR_REP_CD USRREPCD,
to_char((SELECT TO_CHAR(COUNT(EMP_NBR)) COUNT FROM ROSTR_DATA WHERE ROSTR_ID = F.ROSTR_ID)) AS count,
TO_CHAR(B.SIC_CD) SICCD,
F.INDSTRY_TYPE_IND INDTYPEIND,
TO_CHAR(F.MANL_SIC_FCTR_NBR) MANSICFACTOR,
TO_CHAR(F.UW_OVERD_SIC_FCTR_NBR) UWOVERDSICFACTOR,
TO_CHAR(G.AREA_FCTR_NBR) STRAREAFACTOR,
G.COV_ID COVID,
F.PLAN_APPRVL_STATUS_CD PLANAPPRVLCD,
F.PLAN_PROGRS_STATUS_CD PLANPROGRESSSTATUSCD ,
F.PLAN_SALE_ASSMNT_CD PLANSALEASSMTCD,
F.CREATD_DT CREATEDDT,
NVL(to_char(F.PLAN_RELSED_DT),' ') PLANRELSEDDT,
TO_CHAR(F.PLAN_RELSED_BY_ID) PLANRELSEDBYID,
TO_CHAR(F.PROPOSD_EFF_DT) PROPOSDEFFECTIVEDT,
TO_CHAR(A.GRACE_PERIOD_NBR) GRACEPERIOD,
A.RNWL_15_MONTH_IND FIFTEENMONTHRNWLIND ,
I.CO_DESC_TXT COMPANYNAME ,
NVL(to_char(F.PLAN_APPRVL_DT),' ') approvedDt,
(Select U.USR_NAME from USR_DETL U WHERE U.USR_ID = F.PLAN_RELSED_BY_ID) as planRelsedByName,
(Select U.USR_NAME from USR_DETL U WHERE U.USR_ID = F.PLAN_APPRVR_ID) as approvedByName,
'' createdByName,
ROWNUM rnum
FROM
REQ_FOR_RATING A,
FIRM B,
USR_DETL C,
SALE_OFFICE D,
QUOTE_SCENRIO E,
QUOTE_COV G,
COV_PLAN F,
COV_LKUP H,
CO_LKUP I
WHERE
A.FIRM_ID = B.FIRM_ID AND
A.SALE_REP_ID = C.USR_ID AND
C.SALE_OFFC_CD = D.SALE_OFFC_CD AND
A.REQ_FOR_RATING_ID=E.REQ_FOR_RATING_ID AND
E.QUOTE_SCENRIO_ID=G.QUOTE_SCENRIO_ID AND
G.QUOTE_COV_ID=F.QUOTE_COV_ID AND
G.COV_ID=H.COV_ID AND
I.CO_CD = F.CO_CD AND
TO_CHAR(F.CREATD_DT,'YYYYMMDD') > TO_CHAR(TO_DATE('07/16/2007', 'MM/DD/YYYY HH24:MI:SS'),'YYYYMMDD') AND
TO_CHAR(F.CREATD_DT,'YYYYMMDD') < TO_CHAR(TO_DATE('10/16/2007', 'MM/DD/YYYY HH24:MI:SS'),'YYYYMMDD')
and rownum <=?) where rnum >=? Parameters: [07/15/2007 00:00:00, 10/15/2007 23:59:59, 1117, 1]That's a SQL fault, not a JDBC/Java fault.
-
I wrote a small test jsp which gets a DB connection using Oracle 816 type
4 JDBC driver.
I have a procedure in the database defined as
SQL> desc one
PROCEDURE one
Argument Name Type In/Out Default?
ID NUMBER IN/OUT
My jsp code does the following...
sqltext="{ call one(?) }";
CallableStatement cstmt = con.prepareCall(sqltext);
cstmt.setInt(1, 23);
cstmt.execute();
System.err.println("cstmt.getInt(1) = " + cstmt.getInt(1));
/* Exception thrown here */
java.sql.SQLException: Invalid column index: prepare_for_new_get
at oracle.jdbc.dbaccess.DBError.check_error(Compiled Code)
at oracle.jdbc.driver.OracleStatement.prepare_for_new_get(Compiled
Code)
at oracle.jdbc.driver.OracleStatement.getLongValue(Compiled Code)
at oracle.jdbc.driver.OracleStatement.getIntValue(Compiled Code)
at oracle.jdbc.driver.OracleCallableStatement.getInt(Compiled Code)
at com.altro.es.jsp._testproc._jspService(Compiled Code)
at weblogic.servlet.jsp.JspBase.service(Compiled Code)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled
Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at weblogic.servlet.JSPServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled
Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
Does anyone know the why the exception is thrown?
Thanks in advance!!
Tejash
nullRegister the parameter, bcoz u declared it
as IN OUT type.
cstmt.registerOutParameter(1,Types.INTEGER).
ATB
MOHANE -
Java.sql.SQLException: Invalid column index in database adapter
I have a query that works fine if I run the sql in a JDeveloper SQL editor, but I get a "java.sql.SQLException: Invalid column index" error if I paste it in a database adapter. If I put this query in the adapter:
select <column>
from <table>
where <column> in (select
trim( substr (txt,
instr (txt, ',', 1, level ) + 1,
instr (txt, ',', 1, level+1)
- instr (txt, ',', 1, level) -1 ) )
as token
from (select ','||#bindVariable||',' txt
from dual)
connect by level <=
length(#bindVariable)-length(replace(#bindVariable,',',''))+1)I get the error. But if I just put the sub query in the adapter as:
select
trim( substr (txt,
instr (txt, ',', 1, level ) + 1,
instr (txt, ',', 1, level+1)
- instr (txt, ',', 1, level) -1 ) )
as token
from (select ','||#bindVariable||',' txt
from dual)
connect by level <=
length(#bindVariable)-length(replace(#bindVariable,',',''))+1the error goes away. Does anyone know what might be causing this?
Thanks in advanceHi,
Could you please make sure your binding style(Oracle Positional,Oracle named..etc) of the Seeded VO and Custom Vo are same.
This is the option you will get when you are extending your vo. So make sure that both are same.
You can refer the below link too
VO extension leads to "Invalid column index" exception
Thanks
Bharat -
Hi All,
The Actual query to perform is below.
SELECT name,number from emp WHERE CASE WHEN :1='T' AND term_date IS Not NULL THEN 1 WHEN :1='A' AND term_date IS NULL THEN 1 WHEN :1='ALL' THEN 1 ELSE 1 END = 1;
I have tried in DB adapter like below as a parameter for :1 as #vInputParam
SELECT name,number from emp WHERE CASE WHEN #vInputParam='T' AND term_date IS Not NULL THEN 1 WHEN #vInputParam='A' AND term_date IS NULL THEN 1 WHEN #vInputParam='ALL' THEN 1 ELSE 1 END = 1;
Getting Error code :17003 .java.sql.SQLException: Invalid column index error.
Please suggest me on using ':' bind character in DB adapter Select Query SOA11g.
Can someone help me on this please?
Thanks,
HariHi,
Could you please make sure your binding style(Oracle Positional,Oracle named..etc) of the Seeded VO and Custom Vo are same.
This is the option you will get when you are extending your vo. So make sure that both are same.
You can refer the below link too
VO extension leads to "Invalid column index" exception
Thanks
Bharat -
Hi,
I am using Jdeveloper 10.1.2.3 and created a ADFBC JSP struts application. I have an entity based viewobject which we have modified, enhance over the years. Some where along this way a bug was introduced in the viewobject that has the following exception
JBO-30003: The application pool (pkgEmpContExp.amEmpContExpSnLocal) failed to checkout an application module due to the following exception:
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.SQLStmtException, msg=JBO-27122: SQL error during statement preparation. Statement: SELECT statement here
## Detail 0 ##oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation
## Detail 0 ##java.sql.SQLException: Invalid column index
The viewobject query on its own has no indexes. It does have a lot of transient attributes which are populated with Preparestatements and callablestatements.
If you want I can give the whole stacktrace.
This always occurs after we insert into this table and we click on another link. If we clear the browser cache, it works properly.
Can anyone please guide me in resolving this issue.
Thanks in advanceHi,
any chance the database table has been changed with the change not being reflected in the ADF BC model?
Frank -
500 Internal Server Error - java.sql.SQLException: Invalid column index
500 Internal Server Error
java.sql.SQLException: Invalid column index at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:174) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:239) at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:851) at com.stardeveloper.servlets.db.InsertServlet.doPost(InsertServlet.java:88) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)
This is the connection part of the java code
// connecting to database
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("host:port:sid, userName, password");
String sql;
sql = "INSERT INTO USERSS(user_id, username) VALUES (?,?)";
ps = con.prepareStatement(sql);
stmt = con.createStatement();
// inserting records
if(proceed) {
ps.setString(1, user_id);
ps.setString(2, username);
ps.executeUpdate();
desc userss;
Name Null? Type
USER_ID NOT NULL NUMBER(5)
USERNAME VARCHAR2(15)
Index_Name table_name
USERSS_PK1 USERSS
when I try to insert values, it is inserting, but at the end I am getting the above error. I am using JDeveloper 10g and database [Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production]I suggest you should alter the JDBC Driver and select one for Oracle 9i.
Which version is your JDev10g? -
Calling stored proc from java using ref cursor
Hi All,
We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
Following is the PL/SQL proc �
procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
begin
open v1 for
SELECT lrn_exp_id, crs_name FROM emp_crs
WHERE personid = persid;
end;
Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
The java code is �
Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
stmt.registerOutParameter(1,OracleTypes.CURSOR);
stmt.setString(2,emplId);
stmt.execute();
OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
ResultSet rs = tstmt.getCursor (1);
When I run the program, I get the following error (at stmt.execute()):
[Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?These may help
http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial -
Calling stored proc from java to return ref cursor
Hi All,
We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
Following is the PL/SQL proc ?
procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
begin
open v1 for
SELECT lrn_exp_id, crs_name FROM emp_crs
WHERE personid = persid;
end;
Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
The java code is ?
Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
stmt.registerOutParameter(1,OracleTypes.CURSOR);
stmt.setString(2,emplId);
stmt.execute();
OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
ResultSet rs = tstmt.getCursor (1);
When I run the program, I get the following error (at stmt.execute()):
[Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?These may help
http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial -
Call stored proc from inside sp
I am trying to call a stored proc from inside a stored proc and the stored proc needs to return a ref_cursor. I am trying to loop over the returned ref_cursor, but my problem is that when I compile the sp it says the ref_cursor is not a procedure or is undefined. Can anyone please tell me why I am getting this error? Refer to the code below!
create or replace
PROCEDURE TCS_GetPartReferenceData
contracts IN VARCHAR2
, showInWork IN INTEGER
, userClock IN VARCHAR2
, intMaxResults IN INTEGER
, ret_cursor OUT SYS_REFCURSOR
) AS
p_cursor SYS_REFCURSOR;
BEGIN
TCS_GETDRNSFORCONTRACTS(contracts
, showinwork
, userClock
, intmaxresults
, p_cursor);
for r in p_cursor loop
dbms_output.put_line(r.puid);
end loop;
END TCS_GetPartReferenceData;Probably you want sth. like
CREATE OR REPLACE PROCEDURE tcs_getpartreferencedata (contracts IN VARCHAR2,
showinwork IN INTEGER,
userclock IN VARCHAR2,
intmaxresults IN INTEGER,
ret_cursor OUT sys_refcursor)
AS
BEGIN
tcs_getdrnsforcontracts (contracts,
showinwork,
userclock,
intmaxresults,
ret_cursor);
END tcs_getpartreferencedata;
var cur refcursor
exec tcs_getpartreferencedata(contracts_value,showinwork_value,userclock_value,intmaxresults_value, :cur)
print curfill in appropriate values for the parameters _value .... -
Can i call stored proc from VOImpl, not from AM?
Hi,
i know how to invoke proc from bb defined in AM...
in VOImpl i have a method getSelectedRows()
which gets me rows selected in table by user.
how can i invoke stored proc from there?
Edited by: grodno on Jan 31, 2013 3:35 AMHi,
its exactly the same code. The only missing link you have is the access to the transaction. In a Viewimpl file just call this.getApplicationModule() to get access to an application module.
The method can also be exposed on a client interface (same as for AM)
Frank -
Problem with special charecter while calling a BAPI from Webdynpro JAVA.
Hi Experts,
I am calling a BAPI from Webdynpro JAVA. I am passing a special charecter u2018 as input to BAPI. But I am getting a # as input in R/3.. Can any one explain why it is getting changed?
Any inputs regarding this issue are appreciated.
Thanks,
Kasinath.Hi,
I had same problem before..For this I have created function module in backend for removing #. It was for converting Stream to ITF text.
CONVERT_STREAM_TO_ITF_TEXT.
Try this.
Thanks,
Prajakta -
SQL exception involving column index
Hi. When I try to access a database with my servlet I get this exception:
Caught SQL Exception: java.sql.SQLException: Column Index out of range ( 0 > 178).
All my columns I use in my SQL statement seems fine. Any ideas?Sorry sir, here is the rest of the code and the exact exception I get is what I already mentioned in my first posting, so. Hope this makes sense to you.
try
out.println("Thank you! The test has been completed.");
String filename = valuecook + ".html";
Document document = new Document();
HtmlWriter writer = HtmlWriter.getInstance(document,new FileOutputStream("C:/jakarta-tomcat-4.0.6/webapps/ROOT/" + filename));
document.open();
catch (DocumentException de) {
System.err.println(de.getMessage());
catch (IOException ioe) {
System.err.println(ioe.getMessage());
catch (SQLException sqlEx)
out.println("Caught SQL Exception: " + sqlEx.toString() + "<br>");
// now close the statement and connection if they exist
if (stmt != null)
try
stmt.close();
catch (SQLException sqlEx)
out.println("Could not close: " + sqlEx.toString() + "<br>");
if (conn != null)
try
conn.close();
catch (SQLException sqlEx)
out.println("Could not close: " + sqlEx.toString() + "<br>"); -
Error while calling stored procedure from Java
Hi Guys,
How are you everybody? I hope everything is goin fine on your side. I have one issue in PL/SQL while calling below stored procedures from Java.
Problem Description: We have a stored procedure PROCEDURE BULK_INSERTS (
V_SESSION_ID_TAB IN T_SESSION_ID_TAB_TYPE,
V_SERVICE_TYPE_TAB IN T_SERVICE_TYPE_TAB_TYPE,
V_SERVICE_LOCATION_TAB IN T_SERVICE_LOCATION_TAB_TYPE,
V_SERVICE_CALL_NAME_TAB IN T_SERVICE_CALL_NAME_TAB_TYPE,
V_SERVICE_CALL_START_TIME_TAB IN T_SERVICE_CALL_ST_TAB_TYPE,
V_SERVICE_CALL_END_TIME_TAB IN T_SERVICE_CALL_ET_TAB_TYPE,
V_SERVICE_CALL_DURATION_TAB IN T_SERVICE_CALL_DUR_TAB_TYPE,
V_STATUS_TAB IN T_STATUS_TAB_TYPE,
V_NOTES_TAB IN T_NOTES_TAB_TYPE
) and we are getting ora errors while calling this stored procedure from java.
All tab types are declared locally, at package level.
Here is error which occur while calling this sp:
{call BULK_PKG.BULK_INSERTS(?,?,?,?,?,?,?,?,?)}
And the parameter types we are using are:
SESSION_ID - NUM_TAB_TYPE
SERVICE_TYPE - VAR_TAB_TYPE
SERVICE_LOCATION - VAR_TAB_TYPE
SERVICE_CALL_NAME - VAR_TAB_TYPE
SERVICE_CALL_START_TIME - DATE_TIME_TAB_TYPE
SERVICE_CALL_END_TIME - DATE_TIME_TAB_TYPE
SERVICE_CALL_DURATION - NUM_TAB_TYPE
STATUS - VAR_TAB_TYPE
NOTES - VAR_TAB_TYPE
And the Exception stack trace is:
ERROR (com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServi
ceCallDAO.java:143)@ExecuteThread: '252' for queue: 'weblogic.kernel.Default') {Error attempting to save collected ESC data}
java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:98)
at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.doBulkInsert(ExternalServiceCallDAO.java:220)
at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServiceCallDAO.java:138)
Please help my guys out of this. I will really appreciate all suggestions and advices.
Thank you everybody.I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
ORA-06512: at line 12
Here is example for my test procedure:
declare
v_session_id_tab SESSION_ID_TAB_TYPE;
v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
v_status_tab STATUS_TAB_TYPE;
v_notes_tab NOTES_TAB_TYPE;
begin
v_session_id_tab(1) := 1;
v_service_type_tab(1) := 'db';
v_service_location_tab(1) := 'local';
v_service_call_name_tab(1) := 'Name of call';
v_service_call_start_time_tab(1) := SYSDATE;
v_service_call_end_time_tab(1) := SYSDATE;
v_service_call_duration_tab(1) := 100;
v_status_tab(1) := 'Z';
v_notes_tab(1) := 'NOTES';
BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
v_service_call_duration_tab, v_status_tab, v_notes_tab);
end;
I declare all types at schema level.
Please give your comments.
Thank you -
Use 'default' keyword in call string while calling stored proc?
I am calling following sql server stored procedure from java code using my jdbc driver for sql server: CREATE PROCEDURE test_findTbInfo (
@paramIn_Str varchar(10),
@paramOut_Int int OUT,
@paramIn_Int int = 20
AS
begin
set @paramOut_Int = @paramIn_Int * 100
end
If I make a call like this:
CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , , ? ) }");
cs.setString(1, "test_tab");
cs.setInt(2, 4);
cs.execute();
It works without any error. But this is not a right behavior. !! The second parameter as you see is passed like an optional parameter. But in stored proc it is NOT an optional param and so if the value not passed it should fail...
Now if I change the code to
CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , default, ? ) }");
it works correctly. Gives error that "Procedure 'test_findTbInfo' expects parameter '@paramOut_Int', which was not supplied." which is correct.
So is it a normal practice to use 'default' keyword while calling sql server stored procedures having optional parameters in jdbc ????
Anyone knows ??? As far as I know "call test_findTbInfo(? , , ? )" works fine except in some cases and also it forces users to put all optional parameters at the end of parameter list in stored proc.
Please let me know whether I should go with 'default' throuout for sql server stored proc while calling using my jdbc driver.
Amit{?= call <procedure-name>[<arg1>,<arg2>, ...]}The question mark in the above is the result parameter
that must be registered.
That is not the same as an OUT argument.Yes that is true. The result value and OUT parameters are different but they both MUST be registered as per jdbc API
"The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here."
Anyway, my original question still stays as it was. If there are some optional IN parameters in stored procedure
e.g.
PROCEDURE test_findTbInfo (
@paramIn_Int int = 20,
@paramOut_Int int OUT
how do you call this?
CallableStatement cs = conn.prepareCall(" { call test_findTbInfo( , ? ) }");
cs.registerOutParameter(1, Types.INTEGER);
cs.execute();
or
CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(default, ? ) }");
Also note that I am intending to use ONLY sql server driver for this.
The first as well second seem to work. Except that second way is seems reliable. I just wanted a second opinion on that...
Amit
Maybe you are looking for
-
Hi Experts, I have one strange problem, we are runing classic scenario and PR is created in R/3 system for each shopping cart. I am unable to change item short text, UOM, price etc of these PR using ME52N in R/3 system . But if i create manually PR i
-
I just signed up for icloud. I previously had itunes on my old computer.When I went to sign up to icloud it told me my password was wrong so I changed it. When I went to sign into icloud (after installed) It told me I have to log in using my Apple
-
How do I change the value of the Order By field in an MP3 file?
good day Guys, I'm new here in the forum and I have a question that is "breaking" the order of my songs and my head too ... How do I change the value of the Order By field in an MP3 file? for example, in the photo below, the song "The Bad Touch" is c
-
Dual Monitor Causing System Problems?
Hi, I'm new to this site, so I hope this is where I ask this question! My design group switched to G5/Cinema Display screen from old g4 setups mid 2005. I retained my Mitsubishi Diamond Pro 2020u monitor to use as a secondary display for pallettes, e
-
Need to add a simple logo / overview of brand to page (newbie)
Hi there - I am trying to add a new logo / overview for a company on the Partnerships page of http://cornerstonebuilding.com/ but I can't figure out how to do that in code or in design mode. Any guidance would be greatly appreciated.