Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error in Calling an Oracle Stored Procedure in Java

Posted on 2004-10-13
5
Medium Priority
?
622 Views
Last Modified: 2008-01-09
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)

0
Comment
Question by:expert_mentos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Expert Comment

by:justinbillig
ID: 12298641
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
 
LVL 11

Accepted Solution

by:
cjjclifford earned 400 total points
ID: 12299314
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question