DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Java stored procedure

  1. #1
    Join Date
    Nov 2000
    Posts
    440
    I need help on jow to execute a simple java procedure.

    BY THE WAY, IM NEW IN THE JAVA WORLD...

    check this out...


    SQL> create or replace and compile java source named "first"
    2 as
    3 public class first
    4 {
    5 public static void main (String args[])
    6 {
    7 System.out.println("This is my fisrt jsp!!!");
    8 }
    9 }
    10 /

    Java created.

    SQL> create or replace procedure proc_first as language java name 'Premier.main';
    2 /

    Warning: Procedure created with compilation errors.

    SQL> show err;
    Errors for PROCEDURE PROC_FIRST:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    0/0 PL/SQL: Compilation unit analysis terminated
    1/39 PLS-00311: the declaration of "Premier.main" is incomplete or
    malformed



  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    When compiling java, that is, going from the .java to .class files, the name of the .java file and the class declared inside need to be the same.

    Perhaps that is the problem.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    hi this shld help u


    SET SERVEROUT ON
    CREATE OR REPLACE AND COMPILE JAVA SOURCE
    NAMED "test"
    AS
    import java.util.*;
    public class test
    {
    public static void test (String name,int num)
    {
    int i = 1;
    int s = i + num ;
    System.out.println("b4"+i +"i..............num"+num);
    String prtString="Hello Useless "+name +"...."+num;
    System.out.println("after"+i +"i..............num"+num);
    System.out.println(prtString);
    }
    }

    /
    CREATE OR REPLACE PROCEDURE test(name varchar2,i number)
    AS LANGUAGE JAVA
    NAME 'test.test(java.lang.String,int)';
    /

    CALL dbms_java.set_output(1000);
    /

    CALL test('jegan',10);


    Cheers!
    OraKid.

  4. #4
    Join Date
    Nov 2000
    Posts
    440
    cool thanks!

Posting Permissions

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


Click Here to Expand Forum to Full Width