Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> PL/SQL & Java syntax question :(

PL/SQL & Java syntax question :(

From: Monty <mmontreaux_at_hotmail.com>
Date: 6 Aug 2003 03:06:25 -0700
Message-ID: <6284dd3.0308060206.3f77d801@posting.google.com>


Could someone help me with a syntax (: problem please. I know the syntax is somewhere in the Oracle documentation but I cannot find it. I have included my PL/SQL,Java below - just copy/paste into SQL/Plus. `
Here is some sample output (PL/SQL to create procedures/packages at bottom of this posting).

When I execute:

SQL>
SQL> SELECT pkg_test.method1('XXX') FROM DUAL;

PKG_TEST.METHOD1('XXX')



one argument:XXX

SQL> When I execute:

SQL> 
SQL> 
SQL> SELECT pkg_test.method2('XXX','YYY') FROM DUAL;

PKG_TEST.METHOD2('XXX','YYY')



two arguments:XXX and YYY

SQL> But I can not find the syntax so that when I execute

SELECT pkg_test.method3('ZZZ') FROM DUAL;

The output I get is

PKG_TEST.METHOD3('ZZZ')



two arguments:XXX and YYY  

Remove the "--" comments to execute.

My question is what is the syntax to use a default value in the "IS LANGUAGE JAVA NAME clause" as outlined in my "method3". Thank you and sorry for asking a syntax question. Monty

---Here is the code, using Oracle8i/9i on a WinBox.

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "test" AS  package com.something;
 public class Test
 {
  public static String methodName(String s1)
{

    return "one argument:"+s1;
  }
  public static String methodName(String s1,String s2)
{

    return "two arguments:"+s1+" and "+s2;   }
 }
/

CREATE OR REPLACE PACKAGE pkg_test AS
 FUNCTION method1(s1 IN VARCHAR2) RETURN VARCHAR2    AS LANGUAGE JAVA NAME
'com.something.Test.methodName(java.lang.String) return java.lang.String';
 FUNCTION method2(s1 IN VARCHAR2,s2 IN VARCHAR2) RETURN VARCHAR2    AS LANGUAGE JAVA NAME
'com.something.Test.methodName(java.lang.String,java.lang.String) return java.lang.String';
-- FUNCTION method3(s1 IN VARCHAR2) RETURN VARCHAR2 -- IS LANGUAGE JAVA NAME
'com.something.Test.methodName("XXX",java.lang.String) return java.lang.String';
END pkg_test;
/

SELECT pkg_test.method1('XXX') FROM DUAL; SELECT pkg_test.method2('XXX','YYY') FROM DUAL; --SELECT pkg_test.method3('ZZZ') FROM DUAL; Received on Wed Aug 06 2003 - 05:06:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US