Java v. PL/SQL Stored Procedures
From: Craig Willis <cwillis_at_netignite.com>
Date: Wed, 04 Aug 1999 10:09:57 -0600
Message-ID: <37A865D5.5C956F28_at_netignite.com>
[Quoted] [Quoted] We are in the process of evaluating Oracle 8i Java stored procedures.
create or replace function sal_grade (current_sal in number) RETURN VARCHAR2
IS
BEGIN
IF CURRENT_SAL > 0 AND CURRENT_SAL < 50000 THEN RETURN 'MTS'; END IF; IF CURRENT_SAL >= 50000 AND CURRENT_SAL < 100000 THEN RETURN 'SMTS'; END IF;
RETURN 'Salary out of range';
END sal_grade;
/
}
public static void approve_raise (float current_sal, float raise, float new_sal [ ]) {
}
}
~ Received on Wed Aug 04 1999 - 18:09:57 CEST
Date: Wed, 04 Aug 1999 10:09:57 -0600
Message-ID: <37A865D5.5C956F28_at_netignite.com>
[Quoted] [Quoted] We are in the process of evaluating Oracle 8i Java stored procedures.
[Quoted] We performed some preliminary tests (simple class based on the emp.class [Quoted] that queries a table of 50,000+ rows). Basic timings indicate that the [Quoted] PL/SQL stored procedure is still almost twice as fast as the Java stored procedure.
[Quoted] [Quoted] I would like to transition to the Java stored procedures (it definitely [Quoted] [Quoted] beats PL/SQL in terms of open-standards), but we cannot justify it if the performance is half of that of PL/SQL.
Can anyone provide any insight? Documentation on Oracle benchmarks?
Thanks,
Craig
-------------emp.sql------------------
create or replace function sal_grade (current_sal in number) RETURN VARCHAR2
IS
BEGIN
IF CURRENT_SAL > 0 AND CURRENT_SAL < 50000 THEN RETURN 'MTS'; END IF; IF CURRENT_SAL >= 50000 AND CURRENT_SAL < 100000 THEN RETURN 'SMTS'; END IF;
RETURN 'Salary out of range';
END sal_grade;
/
- emp.java ---------------- package com.oracle.employee;
public class emp {
public static String sal_grade (float current_sal) {
if (current_sal > 0 && current_sal < 50000) return "MTS"; if (current_sal >= 50000 && current_sal < 100000) return "SMTS"; return "Salary out of range.";
}
public static void approve_raise (float current_sal, float raise, float new_sal [ ]) {
float percent_raise = (raise / current_sal) * 100; if (percent_raise > 15 || percent_raise < 5) new_sal[0] = -1; else { new_sal[0] = current_sal + raise; }
}
}
~ Received on Wed Aug 04 1999 - 18:09:57 CEST