Casting dataVector

Hello,
how can the following code be made generics compatible?
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableExample extends JFrame {
  TableExample() {
    DefaultTableModel dm = new DefaultTableModel() {
      public void setValueAt(Object value, int row, int col) {
/*     Pre-generic accepted code:
     Vector rowVector = (Vector)dataVector.elementAt(row);
The next line gives:
TableExample.java:16: warning: [unchecked] unchecked cast
found   : java.lang.Object
required: java.util.Vector<java.lang.Object>
        Vector<Object> rowVector = (Vector<Object>)dataVector.elementAt(row);
                                                                       ^
The circumflex is actually point at "(row)".
*/     Vector<Object> rowVector = (Vector<Object>)dataVector.elementAt(row);
     if (col == 1) {
       double d= 2.;
       rowVector.setElementAt(d, col);
        } else {
       rowVector.setElementAt(value, col);
}

Hello,
thanks for your reply. Changing Vector<Object> back to Vector will bring the compiler warning again (which I am trying to eliminate). dataVector is a field in the DefaultTableModel class, and I don't know how its declaration can be changed - I rather assume it's impossible, unless I create my own model class.

Similar Messages

  • Error in cast a variable

    these are few lines from my long STORED PROCEDURE actually i am new to oracle 11g please
    declare
    v_s nvarchar2(10);
    p_RN nvarchar2(10);
    begin
    v_s := v_s || cast(p_RN as nvarchar2(10)); - ERROR IS COMING IN THIS LINE
    end;
    error
    ORA-06550: line 5, column 39:
    PLS-00103: Encountered the symbol "(" when expecting one of the following:
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    please somebody help me

    Just a little explanation about the error message.
    ORA-06550: line 5, column 39:
    PLS-00103: Encountered the symbol "(" when expecting one of the following:
    Line 5 column 39 is the starting parenthesis of the "(10)". For using cast you can't add a lenght to the datatype.
    If you change that, then you get a different error message:
    declare
    v_s nvarchar2(10);
    p_RN varchar2(10);
    begin
      v_s := v_s || cast(p_RN as nvarchar2); -- ERROR IS COMING IN THIS LINE
    end;
    Fehler beim Start in Zeile 13 in Befehl:
    declare
    v_s nvarchar2(10);
    p_RN varchar2(10);
    begin
      v_s := v_s || cast(p_RN as nvarchar2); -- ERROR IS COMING IN THIS LINE
    end;
    Fehlerbericht:
    ORA-06550: line 5, column 22:
    PLS-00382: expression is of wrong type
    ORA-06550: line 5, column 3:
    PL/SQL: Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:ORA-06550: line 5, column 22:
    PLS-00382: expression is of wrong type
    This shows that you can't convert/cast a nvarchzar type into another nvarchar type.
    It would work if you cast a number into a varchar2 type for example
    declare
    v_s nvarchar2(10);
    p_RN number(10);
    begin
      v_s := v_s || cast(p_RN as nvarchar2); -- ERROR IS COMING IN THIS LINE
    end;
    anonymer Block abgeschlossen.

  • Error in cast multiset in collections

    DECLARE
    TYPE emp_dept_rec IS RECORD (
    v_sal emp.sal%TYPE,
    v_name emp.ename%TYPE,
    v_deptname dept.DEPTNAME%type
    TYPE emp_dept_tab_type IS TABLE OF emp_dept_rec;
    l_emp_dept_tab emp_dept_tab_type;
    type emp_tab is table of emp%rowtype;
    type l_emp_tab is table of emp%rowtype;
    type dept_tab is table of dept%rowtype;
    type l_dept_tab is table of dept%rowtype;
    cursor e1 is
    select * from emp;
    cursor d1 is select * from dept;
    begin
    OPEN e1;
    FETCH e1
    BULK COLLECT INTO l_emp_tab;
    open d1;
    FETCH d1
    BULK COLLECT INTO l_dept_tab;
    select cast(multiset (select em.sal,em,ename ,dep.DEPTNAME
    from table(l_emp_tab) em,table(l_dept_tab) dep
    where em.deptno=dep.deptno)
    as emp_dept_tab_type)
    into l_emp_dept_tab ;
    end;
    it is giving error as
    ORA-06550: line 43, column 25:
    PL/SQL: ORA-00923: FROM keyword not found where expected
    ORA-06550: line 39, column 5:
    PL/SQL: SQL Statement ignored

    Here is an example.
    SQL> CREATE OR REPLACE TYPE emp_rec IS OBJECT (
      2                      v_sal    NUMBER(7,2),
      3                      v_name   VARCHAR2(35),
      4                      v_empno  NUMBER(4),
      5                      v_deptno NUMBER(2)
      6                      )
      7  ;
      8  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_tab IS TABLE OF emp_rec;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE dept_rec IS OBJECT (
      2                      v_deptno NUMBER,
      3                      v_dname VARCHAR2(50)
      4                      )
      5  ;
      6  /
    Type created.
    SQL> CREATE OR REPLACE TYPE dept_tab IS TABLE OF dept_rec;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_dept_rec IS
      2                     OBJECT (
      3                      v_sal     NUMBER,
      4                      v_name     VARCHAR2(35),
      5                      v_deptname VARCHAR2(30)
      6                      );
      7  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_dept_tab_type IS TABLE OF emp_dept_rec;
      2  /
    Type created.
    SQL> set serverout on
    SQL> DECLARE
      2    l_emp_dept_tab emp_dept_tab_type; --emp_dept_tab_type declared in database
      3    l_emp_tab      emp_tab; --emp_tab declared in database
      4    l_dept_tab     dept_tab; --dept_tab declared in database
      5 
      6    CURSOR e1 IS
      7      SELECT emp_rec(sal, ename, empno, deptno) FROM emp; --Note the type casting here
      8 
      9    CURSOR d1 IS
    10      SELECT dept_rec(deptno, dname) FROM dept; --Note the type casting here
    11  BEGIN
    12    OPEN e1;
    13 
    14    FETCH e1 BULK COLLECT
    15      INTO l_emp_tab;
    16 
    17    OPEN d1;
    18 
    19    FETCH d1 BULK COLLECT
    20      INTO l_dept_tab;
    21 
    22    SELECT CAST(MULTISET (SELECT em.v_sal, em.v_name, dep.v_dname
    23                   FROM TABLE(l_emp_tab) em, TABLE(l_dept_tab) dep
    24                  WHERE em.v_deptno = dep.v_deptno) AS emp_dept_tab_type)
    25      INTO l_emp_dept_tab
    26      FROM DUAL;
    27    FOR i IN 1 .. l_emp_dept_tab.COUNT LOOP
    28      dbms_output.put_line(l_emp_dept_tab(i)
    29                           .v_sal || '--' || l_emp_dept_tab(i)
    30                           .v_name || '--' || l_emp_dept_tab(i).v_deptname);
    31    END LOOP;
    32 
    33  END;
    34  /
    1300--MILLER--ACCOUNTING
    5000--KING--ACCOUNTING
    2450--CLARK--ACCOUNTING
    3000--FORD--RESEARCH
    1100--ADAMS--RESEARCH
    3000--SCOTT--RESEARCH
    2975--JONES--RESEARCH
    800--SMITH--RESEARCH
    950--JAMES--SALES
    1500--TURNER--SALES
    2850--BLAKE--SALES
    1250--MARTIN--SALES
    1250--WARD--SALES
    1600--ALLEN--SALES
    PL/SQL procedure successfully completed.It is just for educational purpose, because the thing you have achieved by so much programming can be done easily by simple join in the table itself.
    user10447332 Newbie
    Handle: user10447332
    Status Level: Newbie
    Registered: Oct 20, 2008
    Total Posts: 227
    Total Questions: 153 (152 unresolved) >
    What a record! and most of the time you don't care to follow/revisit the thread also!.

  • Error in cast to MULTIPART

    Hi, I test the follow Jguru tutorial code for getting atacchements
    Multipart multipart = (Multipart)message.getContent();
    for (int i=0, n=multipart.getCount(); i<n; i++) {
    Part part = multipart.getBodyPart(i));
    String disposition = part.getDisposition();
    if ((disposition != null) &&
    ((disposition.equals(Part.ATTACHMENT) ||
    (disposition.equals(Part.INLINE))) {
    saveFile(part.getFileName(), part.getInputStream());
    But i have a problem of cast in this line
    Multipart mp = (Multipart)message.getContent();
    the error of CastClass is:
    java.lang.String cannot be cast to javax.mail.Multipart
    why????? Please help me
    Thanks

    Most likely you don't have a multipart message. See the msgshow.java
    demo program that comes with JavaMail.

  • Could not type cast in java embedding

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    org.xml.sax.InputSource in = (org.xml.sax.InputSource) getVariableData("Invoke_1_getRoutingAndFrameJumpers_OutputVariable","getRoutingAndFrameJumpersResponse");
    Document doc = db.parse(in);
    In the above code I am trying to type cast the variable getRoutingAndFrameJumpersResponse into org.xml.sax.InputSource so that i can parse.
    I am not getting any error during compilation
    but I am unable to type cast some run time error is coming in the line were I am type casting but I am not able to see the runtime error.
    How can I see the runtime error in java embedding, how to type cast a variable into xml so that I can parse it.

    Hi Arun,
    Could you try using the bpelx:rename extension in an assign activity enables a BPEL process to rename an element through use of XSD type casting.
    <bpel:assign>
    <bpelx:rename elementTo="QName1"? typeCastTo="QName2"?>
    <bpelx:target variable="ncname" part="ncname"? query="xpath_str" />
    </bpelx:rename>
    </bpel:assign>
    Cheers
    A

  • Derive found flag in SQL with where clause using TABLE(CAST function

    Dear All,
    Stored procedure listEmployees
    ==========================
    CREATE OR REPLACE TYPE STRING_ARRAY AS VARRAY(8000) OF VARCHAR2(15);
    empIdList STRING_ARRAY
    countriesList STRING_ARRAY
    SELECT EMP_ID, EMP_COUNTRY, EMP_NAME, FOUND_FLAG_
    FROM EMPLOYEE WHERE
    EMP_ID IN
    (SELECT * FROM TABLE(CAST(empIdList AS STRING_ARRAY))
    AND EMP_COUNTRY IN
    (SELECT * FROM TABLE(CAST(countriesList AS STRING_ARRAY))
    =================
    I have a stored procedure which lists the employees using above simple query.
    Here I am using table CAST function to find the list of employees in one go
    instead of looping through each and every employee
    Everything fine until requirements forced me to get the FOUND_FLAG as well.
    Now I wanted derive the FOUND_FLAG by using rownum, rowid, decode functions
    but I was not successful
    Can you please suggest if there is any intelligent way to say weather the
    row is found for given parameters in the where clause?
    If not I may have to loop through each set of empIdList, countriesList
    and find the values individually just to set a flag. In this approach I can’t use
    the TABLE CAST function which is efficient I suppose.
    Note that query STRING_ARRAY is an VARRAY. It is very big in size and this procedure
    suppose to handle large sets of data.
    Thanks In advance
    Regards
    Charan
    Edited by: kmcharan on 03-Dec-2009 09:55
    Edited by: kmcharan on 03-Dec-2009 09:55

    If your query returns results, you have found them... so your "FOUND" flag might be a constant,...

  • Casting in ABAP Objects

    Why the cast error generates only in Widening cast?

    Hi Shyam,
    WELCOME TO SDN!!!
    Please check this link
    http://abapprogramming.blogspot.com/2007/10/oops-abap-8.html
    The widening cast in this case does not cause an error because the reference airplane actually points to an instance in the subclass lcl_cargo_airplane. The dynamic type is therefore u2018REF TO lcl_cargo_airplaneu2019.
    Here the widening cast produces the MOVE_CAST_ERROR runtime error that can be caught with u201CCATCH ... ENDCATCHu201D, because the airplane reference does not point to an instance in the subclass lcl_cargo_airplane, but to a u201Cgeneral airplane objectu201D. Its dynamic type is therefore u2018REF TO lcl_airplaneu2019 and does not correspond to the reference type cargo_airplane.
    The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be checked statically, only at runtime. The Cast Operator u201C?=u201D (or the equivalent u201CMOVE ... ?TO u2026u201D) must be used to make this visible.
    With this kind of cast, a check is carried out at runtime to ensure that the current content of the source variable corresponds to the type requirements of the target variables. In this case therefore, it checks that the dynamic type of the source reference airplane is compatible with the static type of the target reference cargo_airplane. If it is, the assignment is carried out. Otherwise the catchable runtime error u201CMOVE_CAST_ERRORu201D occurs, and the original value of the target variable remains the same.
    Best regards,
    raam

  • Can not cast from object to int

    Hi All,
    I have the following bunch of code
    Session session;
              session = getSessionFactory().openSession();
              Query query;
              int MaxPageId = 0;
              List list;
              try{
                   query = session.createQuery("select max(emp.id) from EmpBean emp");
                   list = query.list();
                   MaxPageId = (int) list.get(0);
                   return MaxPageId;
              catch(Exception e){
                   System.out.println(e.getMessage());
              return MaxPageId;
    The query executed successfully but when i get the max id in a integer variable by the following statement
    MaxPageId = (int) list.get(0);
    I get the following error "can not cast from object to int"
    Please suggest for the same.
    -Thanks

    Cast to an Integer, not an int, and let autoboxing turn the Integer into an int.
    int maxPageId;
    maxPageId = (Integer) list.get(0);You can't cast objects into primitives.
    Autoboxing isn't casting.
    And use Java naming conventions. Local variables start with a lower-case letter.

  • How to cast a column of a derived column in a view to NULL

    I have a derived column in my view and this column by default is picked up as not null.
    I want to cast it to null how can i do it ?
    Actual column
    column1 varchar(3) not null
    Expected column
    column1 varchar(3)  null
    Mudassar

    Shridar I  havent defined it but the derived column has been picked up as not null which is strange
    CREATE VIEW test
    AS
    SELECT 
    CASE
    WHEN COMPANY_SIZE IS NULL then  'a'
    ELSE 'b' 
    END AS
    column1 ----- added derived column identifier
    ,[Company_Size] AS [CompanySize]
    FROM xyz
    Mudassar

  • Oracle Arrays and getVendorConnection API and Class Cast Exception

    I 've gone through various threads relating to the topic of Oracle Arrays and the getVendorConnecton API call to avoid the class Cast Exception.. i ve used all these but am still facing the problem...
    I would appreciate it if some one could resolve the following queries :
    I am using Weblogic 8.1 SP5 with oracle 8i
    1. I read that the need to use the getVendorConnection API to make pl/sql proc calls with oracle arrays from the WL Server wont be required to avoid classCastException...
    I tried to use the connection from the WL connection pool ..but it didnot work....I used the getVendorConnection API ..which also doesnot seem to work..
    I got the Heurisitc Hazard exception...I used the Oracle 9i driver ie ojdbc14.jar ...after this the exception is not coming but still the code doesnt seem to work...
    the snippet of the code is pasted below :
    ~~~~~~~~~~~~~~~~~~~~~~~code is : ~~~~~~~~~~~~~~~~~~~
    /*below :
    logicalCon is the Connection from the WL connection pool
    JDBCcon is the JDBC connection. */
    <div> try </div>
    <div>{ </div>
    <div>
    <b>vendorConn</b> = ((WLConnection)logicalCon).getVendorConnection();
    </div>
    <div>
    //Calling the procedure
    </div>
    <div>
    //java.util.Map childMap1 = JDBCcon.getTypeMap();
    </div>
    <div>
    java.util.Map childMap1 = <b>vendorConn</b>.getTypeMap();
    </div>
    <div>
    childMap1.put("SST_ROUTE_ENTRY", Class.forName("svm.stport.ejb.StaticRouteEntry"));
    </div>
    <div>
    //JDBCcon.setTypeMap(childMap1);
    <b>vendorConn</b>.setTypeMap(childMap1);
    </div>
    <div>
    // Create an oracle.sql.ARRAY object to hold the values
    </div>
    <div>
    /*oracle.sql.ArrayDescriptor arrayDesc1 = oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", JDBCcon); */
    </div>
    <div>
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", <b>vendorConn</b>); // here if i use the JDBCcon it works perfectly.... <u>^%^%^%</u>
    </div>
    <div>
    code to fill in the sst route entry array....
    .....arrayValues1 */
    </div>
    <div>
    /* oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, JDBCcon, arrayValues1); */
    </div>
    <div>
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, <b>vendorConn</b>, arrayValues1);
    </div>
    <div>
    callStatement = logicalCon.prepareCall( "? = call procName(?, ?, ?)");
    </div>
    <div>
    /* ..code to set the ?s ie array1 */
    </div>
    <div>
    callStatement.execute();
    </div>
    <div>
    }catch(Exceptio e){
    </div>
    <div>
    }</div>
    <div>
    finally </div>
    </div>{</div>
    <div>System.out.println(" I ve come to finally"); </div>
    <div>}</div>
    <div>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~code snippet ends here ~~~~~~~~~~~~~~``
    </div>
    I have observed that the control immediately comes to the finally block after the call to the createDescriptor line above with <u>^%^%^%</u> in the comment. If i use the JDBCCon in this line...it works perfectly fine.
    Any pointers to where anything is getting wrong.
    I have jst set the vendorCon to null in the end of the file and not closed it. Subsequently i have closed the logicalCon. This has been mentioned in some of the thread in this forum also.
    Thanks,
    -jw

    Jatinder Wadhwa wrote:
    I 've gone through various threads relating to the topic of Oracle Arrays and the getVendorConnecton API call to avoid the class Cast Exception.. i ve used all these but am still facing the problem...
    I would appreciate it if some one could resolve the following queries :
    I am using Weblogic 8.1 SP5 with oracle 8i
    1. I read that the need to use the getVendorConnection API to make pl/sql proc calls with oracle arrays from the WL Server wont be required to avoid classCastException...
    I tried to use the connection from the WL connection pool ..but it didnot work....I used the getVendorConnection API ..which also doesnot seem to work..
    I got the Heurisitc Hazard exception...I used the Oracle 9i driver ie ojdbc14.jar ...after this the exception is not coming but still the code doesnt seem to work...
    the snippet of the code is pasted below :
    ~~~~~~~~~~~~~~~~~~~~~~~code is : ~~~~~~~~~~~~~~~~~~~Hi. Show me the whole exception and stacktrace if you do:
    try
    vendorConn = ((WLConnection)logicalCon).getVendorConnection();
    java.util.Map childMap1 = vendorConn.getTypeMap();
    childMap1.put("SST_ROUTE_ENTRY" Class.forName("svm.stport.ejb.StaticRouteEntry"));
    vendorConn.setTypeMap(childMap1);
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR",
    vendorConn);
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, vendorConn, arrayValues1);
    callStatement = logicalCon.prepareCall( "? = call procName(? ? ?)");
    callStatement.execute();
    }catch(Exception e){
    e.printStackTrace();
    finally
    try{logicalCon.close();}catch(Exception ignore){}
    System.out.println(" I ve come to finally");
    /*below :
    logicalCon is the Connection from the WL connection pool
    JDBCcon is the JDBC connection. */
    <div> try </div>
    <div>{ </div>
    <div>
    <b>vendorConn</b> = ((WLConnection)logicalCon).getVendorConnection();
    </div>
    <div>
    //Calling the procedure
    </div>
    <div>
    //java.util.Map childMap1 = JDBCcon.getTypeMap();
    </div>
    <div>
    java.util.Map childMap1 = <b>vendorConn</b>.getTypeMap();
    </div>
    <div>
    childMap1.put("SST_ROUTE_ENTRY", Class.forName("svm.stport.ejb.StaticRouteEntry"));
    </div>
    <div>
    //JDBCcon.setTypeMap(childMap1);
    <b>vendorConn</b>.setTypeMap(childMap1);
    </div>
    <div>
    // Create an oracle.sql.ARRAY object to hold the values
    </div>
    <div>
    /*oracle.sql.ArrayDescriptor arrayDesc1 = oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", JDBCcon); */
    </div>
    <div>
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", <b>vendorConn</b>); // here if i use the JDBCcon it works perfectly.... <u>^%^%^%</u>
    </div>
    <div>
    code to fill in the sst route entry array....
    .....arrayValues1 */
    </div>
    <div>
    /* oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, JDBCcon, arrayValues1); */
    </div>
    <div>
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, <b>vendorConn</b>, arrayValues1);
    </div>
    <div>
    callStatement = logicalCon.prepareCall( "? = call procName(?, ?, ?)");
    </div>
    <div>
    /* ..code to set the ?s ie array1 */
    </div>
    <div>
    callStatement.execute();
    </div>
    <div>
    }catch(Exceptio e){
    </div>
    <div>
    }</div>
    <div>
    finally </div>
    </div>{</div>
    <div>System.out.println(" I ve come to finally"); </div>
    <div>}</div>
    <div>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~code snippet ends here ~~~~~~~~~~~~~~``
    </div>
    I have observed that the control immediately comes to the finally block after the call to the createDescriptor line above with <u>^%^%^%</u> in the comment. If i use the JDBCCon in this line...it works perfectly fine.
    Any pointers to where anything is getting wrong.
    I have jst set the vendorCon to null in the end of the file and not closed it. Subsequently i have closed the logicalCon. This has been mentioned in some of the thread in this forum also.
    Thanks,
    -jw

  • Explicit cast needed to convert java.* to to oracle.*

    Hello,
    I am trying to compile and run the following JSP but keep getting the "Incompatible type for = Explicit cast needed ..." error. The JSP and oracle procedure code are as follows:
    <%@ page language="java" import="java.sql.*" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <HTML>
    <HEAD>
    <TITLE>
    SimpleQuery JSP
    </TITLE>
    </HEAD>
    <BODY BGCOLOR=EOFFFO>
    <TABLE BORDER=1 BGCOLOR="C0C0C0">
    <TH BGCOLOR="white"> <I>Node ID</I> </TH>
    <%
         Connection con = null;
    OracleCallableStatement cstmt= null;
         ResultSet rs = null;
    try {
              String SYSTEM_DB_DRIVER =
    "oracle.jdbc.driver.OracleDriver";
    String SYSTEM_DB_URL =
    "jdbc:oracle:thin:@myserver.com:1521:";
    String SYSTEM_DB_FILE = "CONN_STRING";
    String SYSTEM_DB_USER = "UNAME";
    String SYSTEM_DB_PASSWORD = "PASSWD";
              Class.forName(SYSTEM_DB_DRIVER);
    con = DriverManager.getConnection(SYSTEM_DB_URL +
    SYSTEM_DB_FILE, SYSTEM_DB_USER, SYSTEM_DB_PASSWORD);
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    <<I think I have to pass the p_product_id_in here but not sure how>>
              cstmt.execute();
              rs = ((OracleCallableStatement)cstmt).getCursor(1);
              while(rs.next())
              {%>
         <TR>
         <TD ALIGN=CENTER> <%= rs.getString(1) %> </TD>
         <TD ALIGN=CENTER> <%= rs.getInt(2) %> </TD>
    </TR>
              <%}
                   rs.close();
    cstmt.close();
    con.close();
    catch(Exception e)
    %>
    </TABLE>
    </BODY>
    </HTML>
    The Oracle PL/SQL package.procedure it is calling is:
         PROCEDURE open_rules_dtl (
              prc_rules_dtl_out          OUT     rc_fetch_rule_dtl,
              p_product_id_in          IN          NUMBER )
         IS
              vrc_rules_dtl               rc_fetch_rule_dtl;
         BEGIN
              OPEN vrc_rules_dtl FOR
                   SELECT
                        r.rule_id,
                        r.rule_name,
                        r.rule_objective,
                        r.rule_description,
                        r.clearance_requirement,
                        r.rule_type
                   FROM
                        eaicl_rule r
                   WHERE
                        r.is_old = 'N' AND
                        r.product_id = CHR( p_product_id_in )
                   ORDER BY
                        r.rule_name
              prc_rules_dtl_out := vrc_rules_dtl;
    END open_rules_dtl;
    I keep getting the following error on the webserver:
    [05/Dec/2001:16:56:02] info ( 632): JSP: JSP1x compiler threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Server4\https-wacc\config\..\ClassCache\_jsps\_ss_test5_jsp.java:84: Incompatible type for =. Explicit cast needed to convert java.sql.CallableStatement to oracle.jdbc.driver.OracleCallableStatement.
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              ^
    I'm not sure how to fix it. I also need to pass the p_product_id parameter to the procedure.
    Hope someone can point me in the right direction. Thanks.

    Here's how you do an explicit cast:cstmt = (OracleCallableStatement)con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");

  • Class casting, creating an image and decompiling...

    Hi, I've got a couple of questions:
    1)
    How can I fully decompile classes, so with the implementation of the methods? Is it always possible to fully decompile a class file? When is it and when not?
    2)
    I aks this questions before, but I still haven't got it working, so sorry, but I ask it again :) :
    I want to create my own class, for example cMyClass which extends the java.awt.Image class, which has abstract methods. How do these methods(for example getGraphics etc) have to be implemented?
    3)
    I can't cast a Image to cMyClass... why not?
    Someone told me he did the following:
    Canvas c = new Canvas()
    cMyClass oImage = (cMyClass) c.createImage (100, 100);
    and that this worked... I tried to do this too, and it seemed to work, but it actually didn't!!
    I found out that c.createImage returns a null reference!!! That's why Java was able to cast it to my own cMyClass (not a problem to cast a null to something else), but when I created a Image (by doing a lot of unnessacary difficult stuff), and then tried to cast this Image to cMyClass it throw a ClassCastException or something like that...
    How can I cast the java.awt.Image class to my class anyway?
    3)
    Why can't you create a image like i've done above or even like below:
    Canvas c = new Canvas()
    Image oImage = c.createImage (100, 100);
    Why does this return a null reference?
    Isn't there a better way to create an image?
    4)
    The getWidth and getHeight need a I thought observer...? Why is this? I just want the width and height and don't have an observer or something like that. Is there a way around this?
    I tried getWidth(null) but this returns -1
    Please help! :)

    Hi, I've got a couple of questions:
    1)
    How can I fully decompile classes, so with the
    implementation of the methods? Is it always possible
    to fully decompile a class file? When is it and when
    not?You can always get a dump of the bytecode with 'javap -c'. If you don't want to figure things out yourself, try searching google for a class file decompiler, possibly a de-obfuscator.
    De-compilation is completely possible if the original author wanted that, by including debugging information. Depending on the degree of such information and the amount of code obfuscation, the decompiled code may lack variable names, line numbers, field and method names, class names, and even code structure. Names and line numbers are usually not re-creatable automatically, since the information is simply lost, but you can replace them with your own strings when analyzing an unknown class file (using the correct tools). Re-creating the original code structure may work in some cases, but to me the general case looks rather close to the halt problem (i.e. not solvable).
    Use a de-obfuscator, hope you've got good luck, and analyze the bytecode manually if that doesn't work.
    2)
    I aks this questions before, but I still haven't got
    it working, so sorry, but I ask it again :) :
    I want to create my own class, for example cMyClass
    which extends the java.awt.Image class, which has
    abstract methods. How do these methods(for example
    getGraphics etc) have to be implemented?I don't really understand the problem. 'abstract' means on the language level that your subclass must provide an implementation, i.e. a method body. What that method is expected to do is explained in the javadocs for Image. But in fact you're free to do anything. You could play a sound in the getWidth() method (replace with any method name if you want). Just consider the fact that a lot of code calls getWidth in the hope of getting the width of the image, not playing a sound. So much about the language level.
    On a higher level, a subclass of Image should implement a certain way to describe an image. AFAIK this means that your code must know the size of the image and know how to produce the pixels of the image. I can't tell you in general how you must do this, because it depends on your special case. This boils down to the question, why do you want to write a subclass of 'Image'? What new way of describing and image have you come up with?
    3)
    I can't cast a Image to cMyClass... why not?Simple, and that's certainly not an ALT. Because that specific Image is not a cMyClass. It's probably a BufferedImage or similar that was produced by AWT.
    Please read the specs carefully what casting is about.
    Someone told me he did the following:
    Canvas c = new Canvas()
    cMyClass oImage = (cMyClass) c.createImage (100,
    100);
    and that this worked... I tried to do this too, and it
    seemed to work, but it actually didn't!!
    I found out that c.createImage returns a null
    reference!!! That's why Java was able to cast it to my
    own cMyClass (not a problem to cast a null to
    something else), but when I created a Image (by doing
    a lot of unnessacary difficult stuff), and then tried
    to cast this Image to cMyClass it throw a
    ClassCastException or something like that...
    How can I cast the java.awt.Image class to my class
    anyway?You can't, and if you understood casting then you'd understand that it wouldn't make sense.
    3, 4(don't know)
    Maybe stupid question, but for example the BufferedImage, is this
    completly written in Java?
    How is the link made between the OS+hardware and the Java code? I
    mean, displaying images etc. is very platform dependend not?Look for JNI (Java Native Interface). It's a way to link native (e.g. C) code with Java code.

  • To cast or not to cast?

    In SQL, when one refers to another table to display a value (e.g. a field: (select something from a_table) column_alias) the engine gives to the column an unlimited range of the datatype.
    For example when I 'm getting a varchar2 value it will show up as varchar2(4000).
    So, most of the time if I know the limit of the values I get, I use the following:
    cast ( (select something from a_table) as varchar2(100) ) column_alias
    To me, this has the benefit of not having to limit the datatype when using application development tools (Forms and Reports in my case).
    The question is: Does it really matter (is it beneficial) when it comes to database memory issues to use this manner?
    Thanks in advance.

    MichaelTsilikidis wrote:
    In SQL, when one refers to another table to display a value (e.g. a field: (select something from a_table) column_alias) the engine gives to the column an unlimited range of the datatype.
    For example when I 'm getting a varchar2 value it will show up as varchar2(4000).
    Are you sure about that? Can you demonstrate your claim with an example? Below is an example which says otherwise.
    SQL> desc emp;
    Name                 Null?    Type
    EMPNO                NOT NULL NUMBER
    ENAME                         VARCHAR2(6)
    JOB                           VARCHAR2(9)
    MGR                           NUMBER
    HIREDATE                      DATE
    SAL                           NUMBER
    COM                           NUMBER
    DEPTNO                        NUMBER
    ID                            NUMBER(10)
    SQL> create table t
      2  as
      3  select (select ename from emp where mgr is null) ename
      4    from dual;
    Table created.
    SQL> desc t;
    Name                 Null?    Type
    ENAME                         VARCHAR2(6)
    SQL>

  • Get values from a node and Cast it back to a table

    Hi guys!
    Anyway know if it is possible to get the values from a table(That was binded previously) and cast it back to a table structure so i can manupilate the fields inside...
    My scenario here is to get an input and mass update tis input into the corresponding field in the table...
    Any suggestions are welcome and points will be awarded generously! ")

    Hi Ravikiran,
    In your example you update node node_list with the content of internal table tab_list..
    The content of the node can be retrieved as an itab using:
      tab_list = node_list->get_static_attributes_table( ).
    This method only returns the values static attributes of the node. Dynamic attributes added at runtime using dynamic programming are not returned, since they are managed in a different inside of the context node.
    Best regards,
    Thomas

  • Problem with Cast and table operator

    Hi ,
    Am using Table and cast opertor to fetch the data from a collection using a ref cursor as follows
    OPEN test_cur for
    SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array));
    This works but when i tried to fetch the date using following query and ref cursor then i received ORA-00604 and ORA 01003.
    I used string containg the query like follows
    V_SQL:= ' SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array))';
    OPEN test_cur for V_SQL;
    I want to pass this V_SQL variable to another procedure that will use it to apply some business logic.Please help me how to resolve this problem.

    Hi, Current procedure is as follows but as per new requirement i have to pass the processed data from this procedure to a common procedure that accepts the string containing the query(Say IN_QUERY) and applies the business logic by fetching the data from this query(IN_QUERY)
    CREATE OR REPLACE PROCEDURE GET_USER_INFO_PRC(USER_ID IN NUMBER,
    TEST_CUR OUT COMMOM_PKG.OUT_REF_CUR,
    O_ERROR_CODE OUT NUMBER,
    O_ERROR_LOCATION OUT VARCHAR2,
    O_ERROR_MESSAGE OUT VARCHAR2) IS
    V_TEST_COLLECTION COMMOM_PKG.WI_INS_SEARCH_ARR_OBJ := WI_INS_SEARCH_ARR_OBJ();
    BEGIN
    Some buniess logic is applied on V_Test_collection to fetch the date in this block
    OPEN TEST_CUR FOR
    SELECT FIRST_NAME, LAST_NAME
    FROM TABLE(CAST(V_TEST_COLLECTION AS TEST_ARRAY));
    Exception handler
    END;

Maybe you are looking for