Error in Calling an Oracle Stored Procedure in Java

Hi experts,

I am trying to call an oracle stored procedure in java...   However, I am encountering this error and I have no clue on what might gone wrong...    Hope you could help me...   Thanks in advance...!   =)

java.lang.NullPointerException
        at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java:270)
        at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.j
ava:256)
        at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCDataSet(TTCAdapter.java:
231)
        at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1435)
        at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:888
)
        at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
va:2051)
        at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
a:1961)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2672)
        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:452)
        at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
ement.java:526)
        at ph.com.smart.crm.modules.prepaid.sales.DBAccess.createCRMQuote(DBAcce
ss.java:703)
        at ph.com.smart.crm.modules.prepaid.sales.DBAccess.createQuote(DBAccess.
java:195)
        at ph.com.smart.crm.modules.prepaid.sales.CreateQuoteProcessor.performTa
sk(CreateQuoteProcessor.java:159)
        at ph.com.smart.crm.modules.prepaid.sales.CreateQuoteProcessor.execute(C
reateQuoteProcessor.java:59)
        at ph.com.smart.crm.modules.prepaid.sales.ActionListener.execute(ActionL
istener.java:43)
        at ph.com.smart.common.servlet.CommonServlet.performTask(CommonServlet.j
ava:106)
        at ph.com.smart.common.servlet.CommonServlet.doGet(CommonServlet.java:47
)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
stDispatcher.java:721)
        at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
vletRequestDispatcher.java:306)
        at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:767)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:259)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:106)
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
utor.java:803)
        at java.lang.Thread.run(Thread.java:534)



This is my java code...

strbufSQL = new StringBuffer();
strbufSQL.append(" {CALL CRM_CUSTOMER_TRXN_PKG.INSERT_QUOTE_HEADER(");
strbufSQL.append(" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,");
strbufSQL.append(" ?, ?, ?, ?, ?, ?, ?, ?)}");
            
strSQL = strbufSQL.toString();
            
cstmt = connCRM.prepareCall(strSQL);
            
cstmt.registerOutParameter(19, Types.VARCHAR);
cstmt.registerOutParameter(22, Types.VARCHAR);

cstmt.setString(1, strOrderID);
cstmt.setString(2, strBranchCode);
cstmt.setString(3, strDocOwnerCode);
cstmt.setString(4, strAgentCode);
cstmt.setString(5, strCoordinatorCode);
cstmt.setString(6, strCustomerCode);
cstmt.setString(7, strCustomerName);
cstmt.setString(8, strPromoCode);
cstmt.setString(9, strBlitzCode);
cstmt.setString(10, strTotalQuantity);
cstmt.setString(11, strTotalDiscount);
cstmt.setString(12, strTotalAmount);
cstmt.setString(13, strSubSLOCCode);
cstmt.setString(14, strRemarks);
cstmt.setString(15, strOrderType);
cstmt.setString(16, strInvMoveID);
cstmt.setString(17, "");
cstmt.setString(18, "");
cstmt.setString(20, "");
cstmt.setString(21, strLoginID);

cstmt.execute();
            
strStatus = cstmt.getString(19);
strQuoteHeaderID = cstmt.getString(22);


This is my oracle stored procedure and is running using SQL Navigator or Toad or SQL Plus...

PROCEDURE Insert_Quote_Header(i_quote_code           IN crm_quote_header_tbl.quote_code%TYPE
                    ,i_WC_code             IN crm_quote_header_tbl.WC_code%TYPE DEFAULT NULL
                    ,i_doc_owner_code      IN crm_quote_header_tbl.doc_owner_code%TYPE DEFAULT NULL
                    ,i_agent_code          IN crm_quote_header_tbl.agent_code%TYPE DEFAULT NULL
                    ,i_emp_no      IN crm_quote_header_tbl.emp_no%TYPE DEFAULT NULL
                    ,i_cust_id       IN VARCHAR2
                    ,i_customer_name      IN crm_quote_header_tbl.customer_name%TYPE DEFAULT NULL
                    ,i_promo_code      IN crm_quote_header_tbl.promo_code%TYPE DEFAULT NULL
                    ,i_blitz_code      IN crm_quote_header_tbl.blitz_code%TYPE DEFAULT NULL
                    ,i_quantity      IN VARCHAR2
                    ,i_discount      IN VARCHAR2
                    ,i_quote_amt           IN VARCHAR2
                    ,i_sloc_code      IN crm_quote_header_tbl.sloc_code%TYPE DEFAULT NULL
                    ,i_remarks      IN crm_quote_header_tbl.remarks%TYPE DEFAULT NULL
                    ,i_order_type_code       IN crm_quote_header_tbl.order_type_code%TYPE DEFAULT NULL
                    ,i_inv_doc_id      IN VARCHAR2
                    ,i_quote_source_code  IN crm_quote_header_tbl.quote_source_code%TYPE DEFAULT NULL
                    ,o_quote_header_id    OUT VARCHAR2
                    ,i_service_type_code         IN crm_quote_header_tbl.service_type_code%TYPE DEFAULT NULL
                    ,i_user_id                IN VARCHAR2
                    ,o_Status            OUT VARCHAR2)

expert_mentosAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
cjjcliffordConnect With a Mentor Commented:
To set null arguments, you should use:

cstmt.setNull( i, Types.XYZ )

e.g.

if( strBlitzCode != null ) {
    cstmt.setString(9, strBlitzCode);
}
else {
    cstmt.setNull( 9, Types.VARCHAR );
}
 
0
 
justinbilligCommented:
You have the Wrong TA, this is javascript ( the web scripting language ). Post in community support and ask them to move your Question to the Java TA
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.