Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Posts
    45

    Unanswered: PL/SQL Java issue

    Hi:

    I am getting the error bellow and I don't how to fix it. Can anyone help?

    Thank you in advance.


    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED Employees AS
    import java.io.*;
    import sqlj.runtime.*;
    import sqlj.runtime.ref.*;

    #sql iterator EmpSuper (String empName);

    public class Employees {
    public static String getSuperName(int empID) throws Exception {
    EmpSuper iterEmpSuper;
    int empIDb;
    empIDb = empID;

    #sql iterEmpSuper={ select emp_name as empName
    from employees
    where emp_id in (
    select supervised_by
    from employees
    where emp_id = :empIDb) };
    if (iterEmpSuper.next())
    {
    return iterEmpSuper.empName();
    }
    else
    {
    return "None";
    }
    }
    }


    Warning: Java created with compilation errors.

    LOCAL>show errors;
    Errors for JAVA SOURCE EMPLOYEES:

    LINE/COL ERROR
    -------- --------------------------------------------------------------
    0/0 EMPLOYEES:8: Class EmpSuper not found.
    0/0 EmpSuper iterEmpSuper;
    0/0 ^
    0/0 <no file>: Processing source EMPLOYEES encountered sqlj
    translation failed.

    0/0 Info: 2 errors
    LOCAL>

  2. #2
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Re: PL/SQL Java issue

    Originally posted by alexxx15
    Hi:

    I am getting the error bellow and I don't how to fix it. Can anyone help?

    Thank you in advance.


    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED Employees AS
    import java.io.*;
    import sqlj.runtime.*;
    import sqlj.runtime.ref.*;

    #sql iterator EmpSuper (String empName);

    public class Employees {
    public static String getSuperName(int empID) throws Exception {
    EmpSuper iterEmpSuper;
    int empIDb;
    empIDb = empID;

    #sql iterEmpSuper={ select emp_name as empName
    from employees
    where emp_id in (
    select supervised_by
    from employees
    where emp_id = :empIDb) };
    if (iterEmpSuper.next())
    {
    return iterEmpSuper.empName();
    }
    else
    {
    return "None";
    }
    }
    }


    Warning: Java created with compilation errors.

    LOCAL>show errors;
    Errors for JAVA SOURCE EMPLOYEES:

    LINE/COL ERROR
    -------- --------------------------------------------------------------
    0/0 EMPLOYEES:8: Class EmpSuper not found.
    0/0 EmpSuper iterEmpSuper;
    0/0 ^
    0/0 <no file>: Processing source EMPLOYEES encountered sqlj
    translation failed.

    0/0 Info: 2 errors
    LOCAL>
    Hi,
    The error is very clear. You are trying to create the object of a
    class that does not exist.
    Why dont you extent the class EmpSuper into your
    current class (Employees).

    Hope it Helps.
    nn

  3. #3
    Join Date
    Mar 2003
    Posts
    45
    how do you do that?

  4. #4
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107
    Originally posted by alexxx15
    how do you do that?

    Hi,

    Sorry, I spelt it Wrong. I meant Extends in your java code.
    This is java inheritance.


    public class Employees extends EmpSuper


    This is how you create your class. That way you get the method
    of your parent class.
    If u can post the code of ur parent class as well. i could tell u in
    a better fashion how to do it.

    Hope it Helps.
    nn

  5. #5
    Join Date
    Mar 2003
    Posts
    45
    Thank you but I have fixed it. This line was the cause of my problem:

    #sql iterator EmpSuper (String empName);

    when copying it on sqlplus, it would not take it and as a result it would not find Class EmpSuper.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •