create or replace java source named FirstClass as
public class FirstClass{
public static String greeting(String name){
return "Hello " + name + "!";
}
}
/
create or replace function firstclass_greeting (name varchar2) return varchar as
language java name 'FirstClass.greeting(java.lang.String) return java.lang.String';
/
SQL> select firstclass_greeting('Bruce') from dual;
FIRSTCLASS_GREETING('BRUCE')
--------------------------------------------------------------------------------
Hello Bruce!
========================================
Listing 4. The Source Code for create_bookstore_tables.sql
drop table books
/
drop table publisher_supply_orders
/
create table books(
book_id number primary key,
publisher_id number,
page_count number,
author_name varchar2(50),
book_title varchar2(50),
description varchar2(500),
status varchar2(10),
inventory_qty number
)
/
insert into books values(100, 200, 234, 'Bruce Hopkins', 'Bluetooth for Java', 'great book', 'IN STOCK', 10);
insert into books values(101, 200, 401, 'Sam Jones', 'Living on the East Coast', 'worth every penny', 'IN STOCK', 50);
insert into books values(102, 250, 278, 'Max Jason', 'The South of France', 'a best-seller', 'IN STOCK', 20);
create table publisher_supply_orders(
book_id number,
publisher_id number,
order_quantity number
)
/
=================
create or replace java source named "ReorderTrigger" as
import java.sql.*;
import oracle.jdbc.driver.*;
public class ReorderTrigger {
public static int REORDER_THRESHOLD = 5;
public static int REORDER_QTY = 25;
public static void reorderBooks(Integer bookID, Integer publi