| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Java Stored Procedure and ClassCastException
I am getting a ClassCastException error message when executing my Java Stored Procedure. After numerous times reviewing my code, I still cannot determine the cause of this problem. Assistance needed!
My code is as follows:
import java.sql.*; import java.math.*; import java.io.*;
public class LineItem {
public static BigDecimal logTransaction (STRUCT l) throws SQLException,
ClassCastException {
//Get the attributes of the customer object. Object[] attribs = l.getAttributes();
BigDecimal keyFinancial = (BigDecimal)(attribs[0]);
BigDecimal keyItem = (BigDecimal)(attribs[1]);
String subsubsystem = (String)(attribs[2]);
BigDecimal amount = (BigDecimal)(attribs[3]);
String userID = (String)(attribs[4]);
BigDecimal keyTransaction = (BigDecimal)(attribs[5]);
BigDecimal keyTxnAffinity = (BigDecimal)(attribs[6]);
BigDecimal keyItemAffinity = (BigDecimal)(attribs[7]);
String paymentType = (String)(attribs[8]);
BigDecimal microNumber = (BigDecimal)(attribs[9]);
String cardType = (String)(attribs[10]);
String cardNumber = (String)(attribs[11]);
String nameOnCard = (String)(attribs[12]);
Date expirationDate = (Date)(attribs[13]);
String productAccCode = (String)(attribs[14]);
BigDecimal unit = (BigDecimal)(attribs[15]);
return keyFinancial;
}
}
begin
dbms_output.enable(1000000);
logtxn.key_financial := 111; logtxn.key_item := 1; logtxn.subsystem := 'TEST'; logtxn.amount := 1.99; logtxn.userID := 'abc1'; logtxn.key_transaction := 12345; logtxn.key_txn_affinity := 1; logtxn.key_item_affinity := 2; logtxn.payment_type := 'CC'; logtxn.micro_number := 123456; logtxn.card_type := 'VISA'; logtxn.card_number := 789011212; logtxn.name_on_card := 'Herman Munster'; logtxn.expiration_date := '01-DEC-01'; logtxn.product_acc_code := 'LITTER'; logtxn.unit := 1;
hold2 := LOG_TRANSACTION(logtxn);
dbms_output.put_line('AND THE ANSWER IS : ' || hold2);
end;
/
Thanks,
Kevin Received on Sat Jul 21 2001 - 18:51:51 CDT
![]() |
![]() |