Solved

Error in Calling an Oracle Stored Procedure in Java

Posted on 2004-10-13
5
615 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
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 100 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 80
JList custom Cell Renderer refresh 15 56
more than one jdk and one jre 1 41
Groovy problem when using SOAPUI : DispatchException occurred 7 44
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

776 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