You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/04/08 20:51:00 UTC
[01/14] incubator-trafodion git commit: Backup checkin. The basic
edit of the guide has been done. Need to change it to refer to trafci
commands to complete.
Repository: incubator-trafodion
Updated Branches:
refs/heads/master b7ecf18f9 -> 00b3291a3
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/index.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/index.adoc b/docs/spj_guide/src/asciidoc/index.adoc
index 17afeb7..f66513d 100644
--- a/docs/spj_guide/src/asciidoc/index.adoc
+++ b/docs/spj_guide/src/asciidoc/index.adoc
@@ -32,6 +32,7 @@
:experimental:
:source-language: text
:revnumber: {project-version}
+// :title-logo-image: {project-logo}
:title-logo-image: ../../../shared/trafodion-logo.jpg
:images: ../images
@@ -61,18 +62,17 @@ U.S. registered trademarks of Microsoft Corporation. Intel® and Intel®
Itanium® are trademarks of Intel Corporation in the U.S. and other
countries. Java® is a registered trademark of Oracle and/or its
affiliates. Motif, OSF/1, UNIX®, X/Open®, and the X device is a
-trademark of X/Open Company Ltd. in the UK and other countries. OSF,
-OSF/1, OSF/Motif, Motif, and Open Software Foundation are trademarks of
+trademark of X/Open Company Ltd. in the UK and other countries.
+
+OSF, OSF/1, OSF/Motif, Motif, and Open Software Foundation are trademarks of
the Open Software Foundation in the U.S. and other countries.
+© 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
-© 1990, 1991, 1992, 1993 Open Software Foundation, Inc. The OSF
-documentation and the OSF software to which it relates are derived in
+<<<
+The OSF documentation and the OSF software to which it relates are derived in
part from materials supplied by the following: © 1987, 1988, 1989
Carnegie-Mellon University. © 1989, 1990, 1991 Digital Equipment
-Corporation.
-
-<<<
-© 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free
+Corporation. © 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free
Software Foundation, Inc. © 1987, 1988, 1989, 1990, 1991 Hewlett-Packard
Company. © 1985, 1987, 1988, 1989, 1990, 1991, 1992 International
Business Machines Corporation. © 1988, 1989 Massachusetts Institute of
@@ -108,6 +108,13 @@ include::asciidoc/_chapters/about.adoc[]
include::asciidoc/_chapters/introduction.adoc[]
include::asciidoc/_chapters/get_started.adoc[]
include::asciidoc/_chapters/develop_spjs.adoc[]
+include::asciidoc/_chapters/deploy_spjs.adoc[]
+include::asciidoc/_chapters/create_spjs.adoc[]
+include::asciidoc/_chapters/grant_privileges.adoc[]
include::asciidoc/_chapters/execute_spjs.adoc[]
+include::asciidoc/_chapters/performance_troubleshooting.adoc[]
+include::asciidoc/_chapters/sample_spjs.adoc[]
+include::asciidoc/_chapters/sample_database.adoc[]
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/images/call-statement-elements.jpg
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/images/call-statement-elements.jpg b/docs/spj_guide/src/images/call-statement-elements.jpg
new file mode 100644
index 0000000..6301ca6
Binary files /dev/null and b/docs/spj_guide/src/images/call-statement-elements.jpg differ
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/Inventory.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Inventory.java b/docs/spj_guide/src/resources/source/Inventory.java
new file mode 100644
index 0000000..becfbee
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/Inventory.java
@@ -0,0 +1,120 @@
+import java.sql.* ;
+import java.math.* ;
+
+public class Inventory
+{
+ // The SUPPLIERINFO procedure accepts a supplier number and returns the
+ // supplier's name, street, city, state, and post code to separate output
+ // parameters.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#supplierinfo-procedure
+ // for more documentation.
+ public static void supplierInfo( BigDecimal suppNum
+ , String[] suppName
+ , String[] streetAddr
+ , String[] cityName
+ , String[] stateName
+ , String[] postCode
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getSupplier =
+ conn.prepareStatement( "SELECT suppname, street, city, "
+ + " state, postcode "
+ + "FROM demo.invent.supplier "
+ + "WHERE suppnum = ?"
+ ) ;
+
+ getSupplier.setBigDecimal( 1, suppNum ) ;
+ ResultSet rs = getSupplier.executeQuery() ;
+ rs.next() ;
+
+ suppName[0] = rs.getString( 1 ) ;
+ streetAddr[0] = rs.getString( 2 ) ;
+ cityName[0] = rs.getString( 3 ) ;
+ stateName[0] = rs.getString( 4 ) ;
+ postCode[0] = rs.getString( 5 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The SUPPLYQUANTITIES procedure returns the average, minimum, and maximum
+ // quantities of available parts in inventory to separate output
+ // parameters.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#supplyquantities-procedure
+ // for more documentation.
+ public static void supplyQuantities( int[] avgQty
+ , int[] minQty
+ , int[] maxQty
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getQty =
+ conn.prepareStatement( "SELECT AVG(qty_on_hand), "
+ + " MIN(qty_on_hand), "
+ + " MAX(qty_on_hand) "
+ + "FROM demo.invent.partloc"
+ ) ;
+
+ ResultSet rs = getQty.executeQuery() ;
+ rs.next() ;
+
+ avgQty[0] = rs.getInt( 1 ) ;
+ minQty[0] = rs.getInt( 2 ) ;
+ maxQty[0] = rs.getInt( 3 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The PARTLOCATIONS procedure accepts a part number and quantity and returns a
+ // set of location codes that have the exact quantity and a set of location
+ // codes that have more than that quantity.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#partlocations-procedure
+ // for more documentation.
+ public static void partLocations( int partNum
+ , int quantity
+ , ResultSet exactly[]
+ , ResultSet moreThan[]
+ ) throws SQLException
+
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getLocationsExact =
+ conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
+ + "FROM demo.invent.partloc L "
+ + "WHERE L.partnum = ? "
+ + " AND L.qty_on_hand = ? "
+ + " ORDER BY L.partnum "
+ ) ;
+
+ getLocationsExact.setInt( 1, partNum ) ;
+ getLocationsExact.setInt( 2, quantity) ;
+
+ PreparedStatement getLocationsMoreThan =
+ conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
+ + "FROM demo.invent.partloc L "
+ + "WHERE L.partnum = ? "
+ + " AND L.qty_on_hand > ? "
+ + "ORDER BY L.partnum "
+ ) ;
+
+ getLocationsMoreThan.setInt( 1, partNum ) ;
+ getLocationsMoreThan.setInt( 2, quantity) ;
+
+ exactly[0] = getLocationsExact.executeQuery() ;
+ moreThan[0] = getLocationsMoreThan.executeQuery() ;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/Payroll.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Payroll.java b/docs/spj_guide/src/resources/source/Payroll.java
new file mode 100644
index 0000000..7a85254
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/Payroll.java
@@ -0,0 +1,151 @@
+import java.sql.* ;
+import java.math.* ;
+
+public class Payroll
+{
+ // The ADJUSTSALARY procedure accepts an employee number and a percentage
+ // value and updates the employee's salary in the database based on that
+ // percentage. This method also returns the updated salary to an output
+ // parameter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#adjustsalary-procedure
+ // for more documentation.
+ public static void adjustSalary( BigDecimal empNum
+ , double percent
+ , BigDecimal[] newSalary
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement setSalary =
+ conn.prepareStatement( "UPDATE demo.persnl.employee "
+ + "SET salary = salary * (1 + (? / 100)) "
+ + "WHERE empnum = ?"
+ ) ;
+
+ PreparedStatement getSalary =
+ conn.prepareStatement( "SELECT salary "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum = ?"
+ ) ;
+
+ setSalary.setDouble( 1, percent ) ;
+ setSalary.setBigDecimal( 2, empNum ) ;
+ setSalary.executeUpdate() ;
+
+ getSalary.setBigDecimal( 1, empNum ) ;
+ ResultSet rs = getSalary.executeQuery() ;
+ rs.next() ;
+
+ newSalary[0] = rs.getBigDecimal( 1 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The EMPLOYEEJOB procedure accepts an employee number and returns a job
+ // code or null value to an output parameter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#employeejob-procedure
+ // for more documentation.
+ public static void employeeJob( int empNum
+ , java.lang.Integer[] jobCode
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getJobcode =
+ conn.prepareStatement( "SELECT jobcode "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum = ?"
+ ) ;
+
+ getJobcode.setInt( 1, empNum ) ;
+ ResultSet rs = getJobcode.executeQuery() ;
+ rs.next() ;
+
+ int num = rs.getInt(1) ;
+ if ( rs.wasNull() )
+ jobCode[0] = null ;
+ else
+ jobCode[0] = new Integer(num) ;
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The PROJECTTEAM procedure accepts a project code and returns the
+ // employee number, first name, last name, and location of the employees
+ // assigned to that project.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#projectteam-procedure
+ // for more documentation.
+ public static void projectTeam( int projectCode
+ , ResultSet[] members
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getMembers =
+ conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, D.location "
+ + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
+ + "WHERE P.projcode = ? "
+ + " AND P.empnum = E.empnum "
+ + " AND E.deptnum = D.deptnum "
+ ) ;
+
+ getMembers.setInt( 1, projectCode ) ;
+ members[0] = getMembers.executeQuery() ;
+
+ }
+
+ // The TOPSALESREPS procedure accepts a number representing the fiscal
+ // quarter (1, 2, 3, and 4, with each number representing a range of
+ // months) and returns the employee number, first name, last name, and sale
+ // figures of the top five sales representatives who had the highest sales
+ // (unit_price * qty_ordered) that quarter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#topsalesreps-procedure
+ // for more documentation.
+ public static void topSalesReps( int whichQuarter
+ , ResultSet[] topReps
+ ) throws SQLException
+ {
+ if ( whichQuarter < 1 || whichQuarter > 4 )
+ {
+ throw new SQLException ( "Invalid value for quarter. "
+ + "Retry the CALL statement "
+ + "using a number from 1 to 4 "
+ + "to represent the quarter."
+ , "38001"
+ ) ;
+ }
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getTopReps =
+ conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
+ + "e.last_name, totals.total "
+ + "FROM demo.persnl.employee e, "
+ + " ( SELECT o.salesrep, "
+ + " SUM( od.unit_price * od.qty_ordered ) as total "
+ + " FROM demo.sales.orders o, demo.sales.odetail od "
+ + " WHERE o.ordernum = od.ordernum "
+ + " AND QUARTER( o.order_date ) = ? "
+ + " GROUP BY o.salesrep "
+ + " ) totals "
+ + "WHERE e.empnum = totals.salesrep "
+ + "ORDER BY totals.total DESCENDING "
+ ) ;
+
+ getTopReps.setInt( 1, whichQuarter ) ;
+ topReps[0] = getTopReps.executeQuery() ;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/Sales.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Sales.java b/docs/spj_guide/src/resources/source/Sales.java
new file mode 100644
index 0000000..e66fbe1
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/Sales.java
@@ -0,0 +1,346 @@
+import java.sql.* ;
+import java.math.* ;
+
+public class Sales
+{
+ // The LOWERPRICE procedure determines which items are selling poorly (that
+ // is, have less than 50 orders) and lowers the price of these items in the
+ // database by 10 percent.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#lowerprice-procedure
+ // for more documentation.
+ public static void lowerPrice() throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getParts =
+ conn.prepareStatement( "SELECT p.partnum, "
+ + "SUM(qty_ordered) AS qtyOrdered "
+ + "FROM demo.sales.parts p "
+ + "LEFT JOIN demo.sales.odetail o "
+ + "ON p.partnum = o.partnum "
+ + "GROUP BY p.partnum"
+ ) ;
+
+ PreparedStatement updateParts =
+ conn.prepareStatement( "UPDATE demo.sales.parts "
+ + "SET price = price * 0.9 "
+ + "WHERE partnum = ?"
+ ) ;
+
+ ResultSet rs = getParts.executeQuery() ;
+ while ( rs.next() )
+ {
+ BigDecimal qtyOrdered = rs.getBigDecimal( 2 ) ;
+
+ if (( qtyOrdered == null ) || ( qtyOrdered.intValue() < 50 ) )
+ {
+ BigDecimal partnum = rs.getBigDecimal( 1 ) ;
+ updateParts.setBigDecimal( 1, partnum ) ;
+ updateParts.executeUpdate() ;
+ }
+ }
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The DAILYORDERS procedure accepts a date and returns the number of
+ //orders on that date to an output parameter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#dailyorders-procedure
+ // for additional documenation.
+ public static void numDailyOrders( Date date
+ , int[] numOrders
+ ) throws SQLException
+ {
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getNumOrders =
+ conn.prepareStatement( "SELECT COUNT(order_date) "
+ + "FROM demo.sales.orders "
+ + "WHERE order_date = ?"
+ ) ;
+
+ getNumOrders.setDate( 1, date ) ;
+
+ ResultSet rs = getNumOrders.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getInt( 1 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+ }
+
+ // The MONTHLYORDERS procedure accepts an integer representing the month
+ // and returns the number of orders during that month to an output parameter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#monthlyorders-procedure
+ // for more documentation.
+ public static void numMonthlyOrders( int month
+ , int[] numOrders
+ ) throws SQLException
+
+ {
+ if ( month < 1 || month > 12 )
+ {
+ throw new SQLException( "Invalid value for month. "
+ + "Retry the CALL statement "
+ + "using a number from 1 to 12 "
+ + "to represent the month."
+ , "38001"
+ ) ;
+ }
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getNumOrders =
+ conn.prepareStatement( "SELECT COUNT( month( order_date ) ) "
+ + "FROM demo.sales.orders "
+ + "WHERE month( order_date ) = ?"
+ ) ;
+
+ getNumOrders.setInt( 1, month ) ;
+
+ ResultSet rs = getNumOrders.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getInt(1) ;
+
+ rs.close() ;
+ conn.close();
+
+ }
+
+ // The TOTALPRICE procedure accepts the quantity, shipping speed, and price
+ // of an item, calculates the total price, including tax and shipping
+ // charges, and returns the total price to an input/output parameter.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#totalprice-procedure
+ // for more documentation.
+ public static void totalPrice( BigDecimal qtyOrdered
+ , String shippingSpeed
+ , BigDecimal[] price
+ ) throws SQLException
+ {
+ BigDecimal shipcharge = new BigDecimal( 0 ) ;
+
+ if ( shippingSpeed.equals( "economy" ) )
+ {
+ shipcharge = new BigDecimal( 1.95 ) ;
+ }
+ else if ( shippingSpeed.equals( "standard" ) )
+ {
+ shipcharge = new BigDecimal( 4.99 ) ;
+ }
+ else if ( shippingSpeed.equals( "nextday" ) )
+ {
+ shipcharge = new BigDecimal( 14.99 ) ;
+ }
+ else
+ {
+ throw new SQLException( "Invalid value for shipping speed. "
+ + "Retry the CALL statement using "
+ + "'economy' for 7 to 9 days, "
+ + "'standard' for 3 to 5 days, or "
+ + "'nextday' for one day."
+ , "38002"
+ ) ;
+ }
+
+ BigDecimal subtotal = price[0].multiply( qtyOrdered ) ;
+ BigDecimal tax = new BigDecimal( 0.0825 ) ;
+ BigDecimal taxcharge = subtotal.multiply( tax ) ;
+ BigDecimal charges = taxcharge.add( shipcharge ) ;
+ BigDecimal totalprice = subtotal.add( charges ) ;
+
+ totalprice = totalprice.setScale( 2, BigDecimal.ROUND_HALF_EVEN ) ;
+ price[0] = totalprice ;
+
+ }
+
+ // The PARTDATA procedure accepts a part number and returns this
+ // information about the part:
+ //
+ // * Part description, price, and quantity available as output parameters.
+ // * A result set that contains rows from the ORDERS table about when this part was ordered.
+ // * A result set that contains rows from the PARTLOC table, listing locations that have this
+ // part in stock and the quantity they have on hand.
+ // * A result set that contains rows from the PARTSUPP table for suppliers who carry this part.
+ // * A result set that contains rows from the EMPLOYEE table for sales reps who have sold this part.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#partdata-procedure
+ // for more documentation.
+ public static void partData( int partNum
+ , String[] partDescription
+ , BigDecimal[] unitPrice
+ , int[] qtyAvailable
+ , ResultSet[] orders
+ , ResultSet[] locations
+ , ResultSet[] suppliers
+ , ResultSet[] reps
+ ) throws SQLException
+ {
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ // Retrieve detail about this part into the output parameters
+ PreparedStatement getPartInfo =
+ conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
+ + "FROM demo.sales.parts P "
+ + "WHERE partnum = ? "
+ ) ;
+
+ getPartInfo.setInt( 1, partNum ) ;
+
+ ResultSet rs = getPartInfo.executeQuery() ;
+ rs.next() ;
+
+ partDescription[0] = rs.getString( 1 ) ;
+ unitPrice[0] = rs.getBigDecimal( 2 ) ;
+ qtyAvailable[0] = rs.getInt( 3 ) ;
+
+ rs.close();
+
+ // Return a result set of rows from the ORDERS table listing orders
+ // that included this part. Each ORDERS row is augmented with the
+ // quantity of this part that was ordered.
+ PreparedStatement getOrders =
+ conn.prepareStatement( "SELECT O.*, QTY.QTY_ORDERED "
+ + "FROM demo.sales.orders O "
+ + " , ( select ordernum, sum(qty_ordered) as QTY_ORDERED "
+ + " from demo.sales.odetail "
+ + " where partnum = ? "
+ + " group by ordernum ) QTY "
+ + "WHERE O.ordernum = QTY.ordernum "
+ + "ORDER BY O.ordernum "
+ ) ;
+
+
+ getOrders.setInt( 1, partNum ) ;
+ orders[0] = getOrders.executeQuery() ;
+
+ // Return a result set of rows from the PARTLOC table listing
+ // locations that have this part in stock and the quantity they
+ // have on hand.
+ PreparedStatement getLocations =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.invent.partloc "
+ + " WHERE partnum = ? "
+ ) ;
+
+ getLocations.setInt( 1, partNum ) ;
+ locations[0] = getLocations.executeQuery() ;
+
+ // Return a result set of rows from the PARTSUPP table listing
+ // suppliers who supply this part.
+ PreparedStatement getSuppliers =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.invent.partsupp "
+ + "WHERE partnum = ? "
+ ) ;
+
+ getSuppliers.setInt( 1, partNum ) ;
+ suppliers[0] = getSuppliers.executeQuery() ;
+
+ // Return a result set of rows from the EMPLOYEE table listing
+ // sales reps that have sold this part.
+ PreparedStatement getReps =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum in ( SELECT O.salesrep "
+ + " FROM demo.sales.orders O, "
+ + " demo.sales.odetail D "
+ + " D.partnum = ? "
+ + " O.ordernum = D.ordernum ) "
+ + "ORDER BY empnum "
+ ) ;
+
+ getReps.setInt( 1, partNum ) ;
+ reps[0] = getReps.executeQuery() ;
+
+ }
+
+ // The ORDERSUMMARY procedure accepts a date, which is formatted as a
+ // string, and returns this information about the orders on or after that
+ // date:
+ //
+ // * The number of orders as an output parameter
+ // * A result set that contains one row for each order. Each row contains
+ // fields for the order number, the number of parts ordered, total dollar
+ // amount, order date, and the name of the sales representative.
+ // * A result set that contains details about each order. Each order has
+ // one or more rows that provide details about the ordered parts. Each row
+ // contains fields for the order number, part number, unit price, quantity
+ // ordered, and part description.
+ //
+ // See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#ordersummary-procedure
+ // for more documentation.
+ public static void orderSummary( java.lang.String onOrAfter
+ , long[] numOrders
+ , java.sql.ResultSet[] orders
+ , java.sql.ResultSet[] detail
+ ) throws SQLException
+ {
+ java.lang.String s ;
+
+ java.sql.Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ // Get the number of orders on or after this date
+ s = "SELECT COUNT(ordernum) FROM demo.sales.orders "
+ + "WHERE order_date >= CAST(? AS DATE) "
+ ;
+
+ java.sql.PreparedStatement ps1 = conn.prepareStatement( s ) ;
+ ps1.setString( 1, onOrAfter ) ;
+
+ java.sql.ResultSet rs = ps1.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getLong( 1 ) ;
+ rs.close() ;
+
+ // Open a result set for order num, order info rows
+ s = "SELECT amounts.*, orders.order_date, emps.last_name "
+ + "FROM ( SELECT "
+ + " o.ordernum "
+ + " , COUNT(d.partnum) AS num_parts "
+ + " , SUM(d.unit_price * d.qty_ordered) AS amount "
+ + " FROM demo.sales.orders o, demo.sales.odetail d "
+ + " WHERE o.ordernum = d.ordernum "
+ + " AND o.order_date >= CAST(? AS DATE) "
+ + " GROUP BY o.ordernum "
+ + " ) amounts "
+ + " , demo.sales.orders orders "
+ + " , demo.persnl.employee emps "
+ + "WHERE amounts.ordernum = orders.ordernum "
+ + " AND orders.salesrep = emps.empnum "
+ + "ORDER BY orders.ordernum "
+ ;
+
+ java.sql.PreparedStatement ps2 = conn.prepareStatement( s ) ;
+ ps2.setString( 1, onOrAfter ) ;
+ orders[0] = ps2.executeQuery() ;
+
+ // Open a result set for order detail rows
+ s = "SELECT d.*, p.partdesc "
+ + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
+ + "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
+ + " AND o.order_date >= CAST(? AS DATE) "
+ + "ORDER BY d.ordernum "
+ ;
+
+ java.sql.PreparedStatement ps3 = conn.prepareStatement( s ) ;
+ ps3.setString( 1, onOrAfter ) ;
+ detail[0] = ps3.executeQuery() ;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/adjustSalary.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/adjustSalary.java b/docs/spj_guide/src/resources/source/adjustSalary.java
new file mode 100644
index 0000000..70ee558
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/adjustSalary.java
@@ -0,0 +1,41 @@
+// The ADJUSTSALARY procedure accepts an employee number and a percentage
+// value and updates the employee's salary in the database based on that
+// percentage. This method also returns the updated salary to an output
+// parameter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#adjustsalary-procedure
+// for more documentation.
+public static void adjustSalary( BigDecimal empNum
+ , double percent
+ , BigDecimal[] newSalary
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement setSalary =
+ conn.prepareStatement( "UPDATE demo.persnl.employee "
+ + "SET salary = salary * (1 + (? / 100)) "
+ + "WHERE empnum = ?"
+ ) ;
+
+ PreparedStatement getSalary =
+ conn.prepareStatement( "SELECT salary "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum = ?"
+ ) ;
+
+ setSalary.setDouble( 1, percent ) ;
+ setSalary.setBigDecimal( 2, empNum ) ;
+ setSalary.executeUpdate() ;
+
+ getSalary.setBigDecimal( 1, empNum ) ;
+ ResultSet rs = getSalary.executeQuery() ;
+ rs.next() ;
+
+ newSalary[0] = rs.getBigDecimal( 1 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/employeeJob.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/employeeJob.java b/docs/spj_guide/src/resources/source/employeeJob.java
new file mode 100644
index 0000000..99196bd
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/employeeJob.java
@@ -0,0 +1,32 @@
+// The EMPLOYEEJOB procedure accepts an employee number and returns a job
+// code or null value to an output parameter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#employeejob-procedure
+// for more documentation.
+public static void employeeJob( int empNum
+ , java.lang.Integer[] jobCode
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getJobcode =
+ conn.prepareStatement( "SELECT jobcode "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum = ?"
+ ) ;
+
+ getJobcode.setInt( 1, empNum ) ;
+ ResultSet rs = getJobcode.executeQuery() ;
+ rs.next() ;
+
+ int num = rs.getInt(1) ;
+ if ( rs.wasNull() )
+ jobCode[0] = null ;
+ else
+ jobCode[0] = new Integer(num) ;
+
+ rs.close() ;
+ conn.close() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/invent_partloc_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_partloc_table.sql b/docs/spj_guide/src/resources/source/invent_partloc_table.sql
new file mode 100644
index 0000000..03ecebb
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/invent_partloc_table.sql
@@ -0,0 +1,56 @@
+CREATE TABLE demo.invent.partloc
+( loc_code CHARACTER (3) NO DEFAULT NOT NULL
+, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, qty_on_hand NUMERIC (7) DEFAULT 0 NOT NULL
+, PRIMARY KEY (loc_code,partnum)
+) ;
+
+INSERT INTO demo.invent.partloc VALUES
+ ('A10', 2001, 800 )
+, ('A21', 255, 21 )
+, ('A34', 6201, 0 )
+, ('A35', 6301, 0 )
+, ('A36', 6400, 34 )
+, ('A66', 6603, 300 )
+, ('A67', 6401, 454 )
+, ('A78', 244, 43 )
+, ('A78', 5505, 100 )
+, ('A87', 212, 18 )
+, ('A88', 2403, 735 )
+, ('A88', 5504, 30 )
+, ('A94', 3205, 200 )
+, ('A98', 5110, 510 )
+, ('G11', 2002, 20 )
+, ('G34', 6201, 106 )
+, ('G35', 6301, 331 )
+, ('G36', 6400, 1034 )
+, ('G43', 5100, 77 )
+, ('G45', 4102, 69 )
+, ('G65', 3201, 36 )
+, ('G68', 6500, 1132 )
+, ('G76', 2405, 42 )
+, ('G76', 7301, 32 )
+, ('G78', 5505, 0 )
+, ('G87', 212, 20 )
+, ('G87', 3103, 0 )
+, ('G87', 3210, 44 )
+, ('G87', 2402, 0 )
+, ('G88', 2403, 32 )
+, ('G88', 5504, 0 )
+, ('G89', 5101, 86 )
+, ('G94', 3205, 59 )
+, ('G98', 5103, 28 )
+, ('G98', 5110, 136 )
+, ('P10', 2001, 0 )
+, ('P12', 2002, 200 )
+, ('P12', 2003, 0 )
+, ('P15', 2003, 200 )
+, ('P66', 6603, 40 )
+, ('P67', 6401, 54 )
+, ('P68', 6500, 0 )
+, ('P76', 7102, 200 )
+, ('P78', 244, 23 )
+, ('P87', 3103, 300 )
+;
+
+UPDATE STATISTICS FOR TABLE demo.invent.partloc ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_partsupp_table.sql b/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
new file mode 100644
index 0000000..5f388c1
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
@@ -0,0 +1,128 @@
+CREATE TABLE demo.invent.partsupp
+( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, partcost NUMERIC (8, 2) NO DEFAULT NOT NULL
+, qty_received NUMERIC (5) UNSIGNED DEFAULT 0 NOT NULL
+, PRIMARY KEY (partnum,suppnum)
+) ;
+
+CREATE INDEX XSUPORD ON partsupp
+( suppnum
+) ;
+
+CREATE VIEW demo.invent.view207
+( partnumber
+, partdescrpt
+, suppnumber
+, supplrname
+, partprice
+, qtyreceived
+)
+AS SELECT
+ x.partnum
+, partdesc
+, x.suppnum
+, suppname
+, partcost
+, qty_received
+FROM
+ demo.invent.partsupp x
+, demo.sales.parts p
+, demo.invent.supplier s
+WHERE x.partnum = p.partnum
+ AND x.suppnum = s.suppnum
+;
+
+CREATE VIEW demo.invent.view207n
+( partnumber
+, partdescrpt
+, suppnumber
+, supplrname
+, partprice
+, qtyreceived
+)
+AS SELECT
+ x.partnum
+, p.partdesc
+, s.suppnum
+, s.suppname
+, x.partcost
+, x.qty_received
+FROM demo.invent.supplier s
+LEFT JOIN demo.invent.partsupp x ON s.suppnum = x.suppnum
+LEFT JOIN demo.sales.parts p ON x.partnum = p.partnum
+;
+
+CREATE VIEW demo.invent.viewcust
+( custnumber
+, cusname
+, ordernum
+)
+AS SELECT
+ c.custnum
+, c.custname
+, o.ordernum
+FROM demo.sales.customer c
+LEFT JOIN demo.sales.orders o ON c.custnum = o.custnum
+;
+
+CREATE VIEW demo.invent.viewcs AS SELECT
+ custname
+FROM demo.sales.customer
+UNION SELECT
+ suppname
+FROM demo.invent.supplier ;
+
+INSERT INTO demo.invent.partsupp VALUES
+ ( 212, 1, 2000.00, 20 )
+, ( 212, 3, 1900.00, 35 )
+, ( 244, 1, 2400.00, 50 )
+, ( 244, 2, 2200.00, 66 )
+, ( 255, 1, 3300.00, 35 )
+, ( 255, 3, 3000.00, 46 )
+, ( 2001, 1, 700.00, 100 )
+, ( 2001, 2, 750.00, 55 )
+, ( 2002, 1, 1000.00, 120 )
+, ( 2002, 6, 1100.00, 20 )
+, ( 2003, 1, 1300.00, 100 )
+, ( 2003, 2, 1400.00, 50 )
+, ( 2003, 10, 1450.00, 50 )
+, ( 2402, 1, 200.00, 35 )
+, ( 2403, 1, 300.00, 200 )
+, ( 2405, 1, 500.00, 40 )
+, ( 2405, 6, 450.00, 50 )
+, ( 3103, 1, 3200.00, 200 )
+, ( 3103, 15, 3300.00, 100 )
+, ( 3201, 1, 380.00, 36 )
+, ( 3205, 1, 425.00, 150 )
+, ( 3210, 6, 470.00, 10 )
+, ( 3210, 15, 450.00, 25 )
+, ( 4102, 6, 20.00, 115 )
+, ( 4102, 8, 19.00, 140 )
+, ( 4102, 15, 21.00, 30 )
+, ( 5100, 6, 100.00, 50 )
+, ( 5100, 8, 105.00, 40 )
+, ( 5100, 15, 95.00, 60 )
+, ( 5101, 8, 135.00, 33 )
+, ( 5101, 15, 125.00, 43 )
+, ( 5103, 8, 265.00, 20 )
+, ( 5103, 15, 250.00, 58 )
+, ( 5110, 1, 335.00, 100 )
+, ( 5110, 2, 350.00, 36 )
+, ( 5504, 2, 85.00, 10 )
+, ( 5504, 6, 75.00, 10 )
+, ( 5504, 15, 78.00, 10 )
+, ( 5505, 15, 200.00, 100 )
+, ( 6201, 1, 100.00, 110 )
+, ( 6301, 1, 150.00, 230 )
+, ( 6400, 1, 390.00, 50 )
+, ( 6401, 2, 500.00, 20 )
+, ( 6401, 3, 480.00, 38 )
+, ( 6500, 2, 60.00, 140 )
+, ( 6500, 3, 65.00, 32 )
+, ( 6603, 2, 25.00, 150 )
+, ( 7102, 10, 165.00, 100 )
+, ( 7301, 1, 300.00, 32 )
+;
+
+UPDATE STATISTICS FOR TABLE demo.invent.partsupp ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/invent_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_schema.sql b/docs/spj_guide/src/resources/source/invent_schema.sql
new file mode 100644
index 0000000..9074be8
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/invent_schema.sql
@@ -0,0 +1,2 @@
+CREATE SCHEMA DEMO.INVENT ;
+SET SCHEMA DEMO.INVENT ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/invent_supplier_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_supplier_table.sql b/docs/spj_guide/src/resources/source/invent_supplier_table.sql
new file mode 100644
index 0000000..0fc4da3
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/invent_supplier_table.sql
@@ -0,0 +1,35 @@
+CREATE TABLE demo.invent.supplier
+( suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, suppname CHARACTER (18) NO DEFAULT NOT NULL
+, street CHARACTER (22) NO DEFAULT NOT NULL
+, city CHARACTER (14) NO DEFAULT NOT NULL
+, state CHARACTER (12) NO DEFAULT NOT NULL
+, postcode CHARACTER (10) NO DEFAULT NOT NULL
+, PRIMARY KEY (suppnum)
+) ;
+
+CREATE INDEX xsuppnam ON supplier
+( suppname
+) ;
+
+INSERT INTO demo.invent.supplier VALUES
+ ( 1, 'NEW COMPUTERS INC', '1800 KING ST.', 'SAN FRANCISCO', 'CALIFORNIA', '94112' )
+, ( 2, 'DATA TERMINAL INC', '2000 BAKER STREET', 'LAS VEGAS', 'NEVADA', '66134' )
+, ( 3, 'HIGH DENSITY INC', '7600 EMERSON', 'NEW YORK', 'NEW YORK', '10230' )
+, ( 6, 'MAGNETICS INC', '1000 INDUSTRY DRIVE', 'LEXINGTON', 'MASS', '02159' )
+, ( 8, 'ATTRACTIVE CORP', '7777 FOUNTAIN WAY', 'CHICAGO', 'ILLINOIS', '60610' )
+, ( 10, 'LEVERAGE INC', '6000 LINCOLN LANE', 'DENVER', 'COLORADO', '80712' )
+, ( 15, 'DATADRIVE CORP', '100 MAC ARTHUR', 'DALLAS', 'TEXAS', '75244' )
+, ( 20, 'Macadam''S PC''s', '106 River Road', 'New Orleans', 'Louisiana', '67890' )
+, ( 25, 'Schroeder''s Ltd', '212 Strasse Blvd West', 'Hamburg', 'Rhode Island', '22222' )
+, ( 30, 'O''Donnell''s Drives', '729 West Palm Beach ', 'San Antonio', 'Texas', '78344' )
+, ( 35, 'Mac''Murphys PC''s', '93323 Alemeda', 'Menlo Park', 'California', '94025' )
+, ( 36, 'MAC''MURPHYS PCB''s', '93323 Alemeda Suite B', 'Menlo Park', 'California', '94025' )
+, ( 90, 'laser jets inc', '284 blue ridge way', 'levittown', 'penna.', '09520' )
+, ( 92, 'watercolors', '84 north grand avenue', 'menlo park', 'california', '94025' )
+, ( 95, 'application do''ers', '2846 yellowwood drive', 'wayland', 'mass', '02158' )
+, ( 99, 'terminals, inc.', '2 longfellow way', 'heightstown', 'nj', '08520' )
+, ( 186, '186 Disk Makers', '186 Dis Way', 'Dat Way', 'Wisconsin', '00186' )
+;
+
+UPDATE STATISTICS FOR TABLE demo.invent.supplier ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/lowerPrice.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/lowerPrice.java b/docs/spj_guide/src/resources/source/lowerPrice.java
new file mode 100644
index 0000000..fd25ecd
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/lowerPrice.java
@@ -0,0 +1,44 @@
+// The LOWERPRICE procedure determines which items are selling poorly (that
+// is, have less than 50 orders) and lowers the price of these items in the
+// database by 10 percent.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#lowerprice-procedure
+// for more documentation.
+public static void lowerPrice() throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getParts =
+ conn.prepareStatement( "SELECT p.partnum, "
+ + "SUM(qty_ordered) AS qtyOrdered "
+ + "FROM demo.sales.parts p "
+ + "LEFT JOIN demo.sales.odetail o "
+ + "ON p.partnum = o.partnum "
+ + "GROUP BY p.partnum"
+ ) ;
+
+ PreparedStatement updateParts =
+ conn.prepareStatement( "UPDATE demo.sales.parts "
+ + "SET price = price * 0.9 "
+ + "WHERE partnum = ?"
+ ) ;
+
+ ResultSet rs = getParts.executeQuery() ;
+ while ( rs.next() )
+ {
+ BigDecimal qtyOrdered = rs.getBigDecimal( 2 ) ;
+
+ if (( qtyOrdered == null ) || ( qtyOrdered.intValue() < 50 ) )
+ {
+ BigDecimal partnum = rs.getBigDecimal( 1 ) ;
+ updateParts.setBigDecimal( 1, partnum ) ;
+ updateParts.executeUpdate() ;
+ }
+ }
+
+ rs.close() ;
+ conn.close() ;
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/numDailyOrders.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/numDailyOrders.java b/docs/spj_guide/src/resources/source/numDailyOrders.java
new file mode 100644
index 0000000..d7aab43
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/numDailyOrders.java
@@ -0,0 +1,29 @@
+// The DAILYORDERS procedure accepts a date and returns the number of
+//orders on that date to an output parameter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#dailyorders-procedure
+// for additional documenation.
+public static void numDailyOrders( Date date
+ , int[] numOrders
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getNumOrders =
+ conn.prepareStatement( "SELECT COUNT(order_date) "
+ + "FROM demo.sales.orders "
+ + "WHERE order_date = ?"
+ ) ;
+
+ getNumOrders.setDate( 1, date ) ;
+
+ ResultSet rs = getNumOrders.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getInt( 1 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/numMonthlyOrders.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/numMonthlyOrders.java b/docs/spj_guide/src/resources/source/numMonthlyOrders.java
new file mode 100644
index 0000000..605f605
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/numMonthlyOrders.java
@@ -0,0 +1,41 @@
+// The MONTHLYORDERS procedure accepts an integer representing the month
+// and returns the number of orders during that month to an output parameter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#monthlyorders-procedure
+// for more documentation.
+public static void numMonthlyOrders( int month
+ , int[] numOrders
+ ) throws SQLException
+
+{
+ if ( month < 1 || month > 12 )
+ {
+ throw new SQLException( "Invalid value for month. "
+ + "Retry the CALL statement "
+ + "using a number from 1 to 12 "
+ + "to represent the month."
+ , "38001"
+ ) ;
+ }
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getNumOrders =
+ conn.prepareStatement( "SELECT COUNT( month( order_date ) ) "
+ + "FROM demo.sales.orders "
+ + "WHERE month( order_date ) = ?"
+ ) ;
+
+ getNumOrders.setInt( 1, month ) ;
+
+ ResultSet rs = getNumOrders.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getInt(1) ;
+
+ rs.close() ;
+ conn.close();
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/orderSummary.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/orderSummary.java b/docs/spj_guide/src/resources/source/orderSummary.java
new file mode 100644
index 0000000..d10e98a
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/orderSummary.java
@@ -0,0 +1,76 @@
+// The ORDERSUMMARY procedure accepts a date, which is formatted as a
+// string, and returns this information about the orders on or after that
+// date:
+//
+// * The number of orders as an output parameter
+// * A result set that contains one row for each order. Each row contains
+// fields for the order number, the number of parts ordered, total dollar
+// amount, order date, and the name of the sales representative.
+// * A result set that contains details about each order. Each order has
+// one or more rows that provide details about the ordered parts. Each row
+// contains fields for the order number, part number, unit price, quantity
+// ordered, and part description.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#ordersummary-procedure
+// for more documentation.
+public static void orderSummary( java.lang.String onOrAfter
+ , long[] numOrders
+ , java.sql.ResultSet[] orders
+ , java.sql.ResultSet[] detail
+ ) throws SQLException
+{
+ java.lang.String s ;
+
+ java.sql.Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ // Get the number of orders on or after this date
+ s = "SELECT COUNT(ordernum) FROM demo.sales.orders "
+ + "WHERE order_date >= CAST(? AS DATE) "
+ ;
+
+ java.sql.PreparedStatement ps1 = conn.prepareStatement( s ) ;
+ ps1.setString( 1, onOrAfter ) ;
+
+ java.sql.ResultSet rs = ps1.executeQuery() ;
+ rs.next() ;
+
+ numOrders[0] = rs.getLong( 1 ) ;
+ rs.close() ;
+
+ // Open a result set for order num, order info rows
+ s = "SELECT amounts.*, orders.order_date, emps.last_name "
+ + "FROM ( SELECT "
+ + " o.ordernum "
+ + " , COUNT(d.partnum) AS num_parts "
+ + " , SUM(d.unit_price * d.qty_ordered) AS amount "
+ + " FROM demo.sales.orders o, demo.sales.odetail d "
+ + " WHERE o.ordernum = d.ordernum "
+ + " AND o.order_date >= CAST(? AS DATE) "
+ + " GROUP BY o.ordernum "
+ + " ) amounts "
+ + " , demo.sales.orders orders "
+ + " , demo.persnl.employee emps "
+ + "WHERE amounts.ordernum = orders.ordernum "
+ + " AND orders.salesrep = emps.empnum "
+ + "ORDER BY orders.ordernum "
+ ;
+
+ java.sql.PreparedStatement ps2 = conn.prepareStatement( s ) ;
+ ps2.setString( 1, onOrAfter ) ;
+ orders[0] = ps2.executeQuery() ;
+
+ // Open a result set for order detail rows
+ s = "SELECT d.*, p.partdesc "
+ + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
+ + "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
+ + " AND o.order_date >= CAST(? AS DATE) "
+ + "ORDER BY d.ordernum "
+ ;
+
+ java.sql.PreparedStatement ps3 = conn.prepareStatement( s ) ;
+ ps3.setString( 1, onOrAfter ) ;
+ detail[0] = ps3.executeQuery() ;
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/partData.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/partData.java b/docs/spj_guide/src/resources/source/partData.java
new file mode 100644
index 0000000..d85f980
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/partData.java
@@ -0,0 +1,103 @@
+// The PARTDATA procedure accepts a part number and returns this
+// information about the part:
+//
+// * Part description, price, and quantity available as output parameters.
+// * A result set that contains rows from the ORDERS table about when this part was ordered.
+// * A result set that contains rows from the PARTLOC table, listing locations that have this
+// part in stock and the quantity they have on hand.
+// * A result set that contains rows from the PARTSUPP table for suppliers who carry this part.
+// * A result set that contains rows from the EMPLOYEE table for sales reps who have sold this part.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#partdata-procedure
+// for more documentation.
+public static void partData( int partNum
+ , String[] partDescription
+ , BigDecimal[] unitPrice
+ , int[] qtyAvailable
+ , ResultSet[] orders
+ , ResultSet[] locations
+ , ResultSet[] suppliers
+ , ResultSet[] reps
+ ) throws SQLException
+{
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ // Retrieve detail about this part into the output parameters
+ PreparedStatement getPartInfo =
+ conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
+ + "FROM demo.sales.parts P "
+ + "WHERE partnum = ? "
+ ) ;
+
+ getPartInfo.setInt( 1, partNum ) ;
+
+ ResultSet rs = getPartInfo.executeQuery() ;
+ rs.next() ;
+
+ partDescription[0] = rs.getString( 1 ) ;
+ unitPrice[0] = rs.getBigDecimal( 2 ) ;
+ qtyAvailable[0] = rs.getInt( 3 ) ;
+
+ rs.close();
+
+ // Return a result set of rows from the ORDERS table listing orders
+ // that included this part. Each ORDERS row is augmented with the
+ // quantity of this part that was ordered.
+ PreparedStatement getOrders =
+ conn.prepareStatement( "SELECT O.*, QTY.QTY_ORDERED "
+ + "FROM demo.sales.orders O "
+ + " , ( select ordernum, sum(qty_ordered) as QTY_ORDERED "
+ + " from demo.sales.odetail "
+ + " where partnum = ? "
+ + " group by ordernum ) QTY "
+ + "WHERE O.ordernum = QTY.ordernum "
+ + "ORDER BY O.ordernum "
+ ) ;
+
+
+ getOrders.setInt( 1, partNum ) ;
+ orders[0] = getOrders.executeQuery() ;
+
+ // Return a result set of rows from the PARTLOC table listing
+ // locations that have this part in stock and the quantity they
+ // have on hand.
+ PreparedStatement getLocations =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.invent.partloc "
+ + " WHERE partnum = ? "
+ ) ;
+
+ getLocations.setInt( 1, partNum ) ;
+ locations[0] = getLocations.executeQuery() ;
+
+ // Return a result set of rows from the PARTSUPP table listing
+ // suppliers who supply this part.
+ PreparedStatement getSuppliers =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.invent.partsupp "
+ + "WHERE partnum = ? "
+ ) ;
+
+ getSuppliers.setInt( 1, partNum ) ;
+ suppliers[0] = getSuppliers.executeQuery() ;
+
+ // Return a result set of rows from the EMPLOYEE table listing
+ // sales reps that have sold this part.
+ PreparedStatement getReps =
+ conn.prepareStatement( "SELECT * "
+ + "FROM demo.persnl.employee "
+ + "WHERE empnum in ( SELECT O.salesrep "
+ + " FROM demo.sales.orders O, "
+ + " demo.sales.odetail D "
+ + " D.partnum = ? "
+ + " O.ordernum = D.ordernum ) "
+ + "ORDER BY empnum "
+ ) ;
+
+ getReps.setInt( 1, partNum ) ;
+ reps[0] = getReps.executeQuery() ;
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/partlocations.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/partlocations.java b/docs/spj_guide/src/resources/source/partlocations.java
new file mode 100644
index 0000000..2a4df24
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/partlocations.java
@@ -0,0 +1,42 @@
+// The PARTLOCATIONS procedure accepts a part number and quantity and returns a
+// set of location codes that have the exact quantity and a set of location
+// codes that have more than that quantity.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#partlocations-procedure
+// for more documentation.
+public static void partLocations( int partNum
+ , int quantity
+ , ResultSet exactly[]
+ , ResultSet moreThan[]
+ ) throws SQLException
+
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getLocationsExact =
+ conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
+ + "FROM demo.invent.partloc L "
+ + "WHERE L.partnum = ? "
+ + " AND L.qty_on_hand = ? "
+ + " ORDER BY L.partnum "
+ ) ;
+
+ getLocationsExact.setInt( 1, partNum ) ;
+ getLocationsExact.setInt( 2, quantity) ;
+
+ PreparedStatement getLocationsMoreThan =
+ conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
+ + "FROM demo.invent.partloc L "
+ + "WHERE L.partnum = ? "
+ + " AND L.qty_on_hand > ? "
+ + "ORDER BY L.partnum "
+ ) ;
+
+ getLocationsMoreThan.setInt( 1, partNum ) ;
+ getLocationsMoreThan.setInt( 2, quantity) ;
+
+ exactly[0] = getLocationsExact.executeQuery() ;
+ moreThan[0] = getLocationsMoreThan.executeQuery() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/persnl_dept_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_dept_table.sql b/docs/spj_guide/src/resources/source/persnl_dept_table.sql
new file mode 100644
index 0000000..85b4d19
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/persnl_dept_table.sql
@@ -0,0 +1,70 @@
+CREATE TABLE demo.persnl.dept
+( deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, deptname CHARACTER (12) NO DEFAULT NOT NULL
+, manager NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, rptdept NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
+, location VARCHAR (18) DEFAULT ' ' NOT NULL
+, PRIMARY KEY (deptnum)
+) ;
+
+CREATE INDEX xdeptmgr ON dept
+( manager
+) ;
+
+CREATE INDEX xdeptrpt ON dept
+( rptdept
+) ;
+
+ALTER TABLE demo.persnl.dept
+ ADD CONSTRAINT mgrnum_constrnt
+ CHECK (manager BETWEEN 0000 AND 9999)
+ ;
+
+ALTER TABLE demo.persnl.dept
+ ADD CONSTRAINT deptnum_constrnt
+ CHECK ( deptnum IN
+ ( 1000
+ , 1500
+ , 2000
+ , 2500
+ , 3000
+ , 3100
+ , 3200
+ , 3300
+ , 3500
+ , 4000
+ , 4100
+ , 9000
+ )
+ )
+ ;
+3
+CREATE VIEW demo.persnl.mgrlist
+( first_name
+, last_name
+, department
+)
+AS SELECT
+ first_name
+, last_name
+, deptname
+FROM dept, employee
+WHERE dept.manager = employee.empnum
+;
+
+INSERT INTO demo.persnl.dept VALUES
+ ( 1000, 'FINANCE', 23, 9000, 'CHICAGO' )
+, ( 1500, 'PERSONNEL', 213, 1000, 'CHICAGO' )
+, ( 2000, 'INVENTORY', 32, 9000, 'LOS ANGELES' )
+, ( 2500, 'SHIPPING', 234, 2000, 'PHOENIX' )
+, ( 3000, 'MARKETING', 29, 9000, 'NEW YORK' )
+, ( 3100, 'CANADA SALES', 43, 3000, 'TORONTO' )
+, ( 3200, 'GERMNY SALES', 39, 3000, 'FRANKFURT' )
+, ( 3300, 'ENGLND SALES', 72, 3000, 'LONDON' )
+, ( 3500, 'ASIA SALES', 111, 3000, 'HONG KONG' )
+, ( 4000, 'RESEARCH', 65, 9000, 'NEW YORK' )
+, ( 4100, 'PLANNING', 87, 4000, 'NEW YORK' )
+, ( 9000, 'xxCORPORATE', 1, 9000, 'CHICAGO' )
+;
+
+UPDATE STATISTICS FOR TABLE demo.persnl.dept ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/persnl_employee_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_employee_table.sql b/docs/spj_guide/src/resources/source/persnl_employee_table.sql
new file mode 100644
index 0000000..1af4323
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/persnl_employee_table.sql
@@ -0,0 +1,99 @@
+CREATE TABLE demo.persnl.employee
+( empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, first_name CHARACTER (15) DEFAULT ' ' NOT NULL
+, last_name CHARACTER (20) DEFAULT ' ' NOT NULL
+, deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, jobcode NUMERIC (4) UNSIGNED DEFAULT NULL
+, salary NUMERIC (8, 2) UNSIGNED DEFAULT NULL
+, PRIMARY KEY (empnum)
+) ;
+
+ALTER TABLE demo.persnl.employee
+ ADD CONSTRAINT empnum_constrnt CHECK (empnum BETWEEN 0001 AND 9999)
+ ;
+
+CREATE INDEX xempname ON employee
+( last_name
+, first_name
+) ;
+
+CREATE INDEX xempdept ON employee
+( deptnum
+) ;
+
+CREATE VIEW demo.persnl.emplist AS
+SELECT
+ empnum
+, first_name
+, last_name
+, deptnum
+, jobcode
+FROM employee
+;
+
+INSERT INTO demo.persnl.employee VALUES
+ ( 1, 'ROGER', 'GREEN', 9000, 100, 175500.00 )
+, ( 23, 'JERRY', 'HOWARD', 1000, 100, 137000.10 )
+, ( 29, 'JANE', 'RAYMOND', 3000, 100, 136000.00 )
+, ( 32, 'THOMAS', 'RUDLOFF', 2000, 100, 138000.40 )
+, ( 39, 'KLAUS ', 'SAFFERT', 3200, 100, 75000.00 )
+, ( 43, 'PAUL', 'WINTER', 3100, 100, 90000.00 )
+, ( 65, 'RACHEL', 'MCKAY', 4000, 100, 118000.00 )
+, ( 72, 'GLENN', 'THOMAS', 3300, 100, 80000.00 )
+, ( 75, 'TIM', 'WALKER', 3000, 300, 32000.00 )
+, ( 87, 'ERIC', 'BROWN', 4000, 400, 89000.00 )
+, ( 89, 'PETER', 'SMITH', 3300, 300, 37000.40 )
+, ( 93, 'DONALD', 'TAYLOR', 3100, 300, 33000.00 )
+, ( 104, 'DAVID', 'STRAND', 4000, 400, 69000.00 )
+, ( 109, 'STEVE', 'COOK', 4000, 400, 68000.00 )
+, ( 111, 'SHERRIE', 'WONG', 3500, 100, 70000.00 )
+, ( 178, 'JOHN', 'CHOU', 3500, 900, 28000.00 )
+, ( 180, 'MANFRED', 'CONRAD', 4000, 450, 32000.00 )
+, ( 201, 'JIM', 'HERMAN', 3000, 300, 19000.00 )
+, ( 202, 'LARRY', 'CLARK', 1000, 500, 25000.75 )
+, ( 203, 'KATHRYN', 'HALL', 4000, 400, 96000.00 )
+, ( 205, 'GINNY', 'FOSTER', 3300, 900, 30000.00 )
+, ( 206, 'DAVE', 'FISHER', 3200, 900, 25000.00 )
+, ( 207, 'MARK', 'FOLEY', 4000, 420, 33000.00 )
+, ( 208, 'SUE', 'CRAMER', 1000, 900, 19000.00 )
+, ( 209, 'SUSAN', 'CHAPMAN', 1500, 900, 17000.00 )
+, ( 210, 'RICHARD', 'BARTON', 1000, 500, 29000.00 )
+, ( 211, 'JIMMY', 'SCHNEIDER', 1500, 600, 26000.00 )
+, ( 212, 'JONATHAN', 'MITCHELL', 1500, 600, 32000.00 )
+, ( 213, 'ROBERT', 'WHITE', 1500, 100, 90000.00 )
+, ( 214, 'JULIA', 'KELLY', 1000, 500, 50000.00 )
+, ( 215, 'WALTER', 'LANCASTER', 4000, 450, 33000.50 )
+, ( 216, 'JOHN', 'JONES', 4000, 450, 40000.00 )
+, ( 217, 'MARLENE', 'BONNY', 4000, 900, 24000.90 )
+, ( 218, 'GEORGE', 'FRENCHMAN', 4000, 420, 36000.00 )
+, ( 219, 'DAVID', 'TERRY', 2000, 250, 27000.12 )
+, ( 220, 'JOHN', 'HUGHES', 3200, 300, 33000.10 )
+, ( 221, 'OTTO', 'SCHNABL', 3200, 300, 33000.00 )
+, ( 222, 'MARTIN', 'SCHAEFFER', 3200, 300, 31000.00 )
+, ( 223, 'HERBERT', 'KARAJAN', 3200, 300, 29000.00 )
+, ( 224, 'MARIA', 'JOSEF', 4000, 420, 18000.10 )
+, ( 225, 'KARL', 'HELMSTED', 4000, 450, 32000.00 )
+, ( 226, 'HEIDI', 'WEIGL', 3200, 300, 22000.00 )
+, ( 227, 'XAVIER', 'SEDLEMEYER', 3300, 300, 30000.00 )
+, ( 228, 'PETE', 'WELLINGTON', 3100, 300, 32000.20 )
+, ( 229, 'GEORGE', 'STRICKER', 3100, 300, 32222.00 )
+, ( 230, 'ROCKY', 'LEWIS', 2000, 200, 24000.00 )
+, ( 231, 'HERB', 'ALBERT', 3300, 300, 33000.00 )
+, ( 232, 'THOMAS', 'SPINNER', 4000, 450, 45000.00 )
+, ( 233, 'TED', 'MCDONALD', 2000, 250, 29000.00 )
+, ( 234, 'MARY', 'MILLER', 2500, 100, 56000.00 )
+, ( 235, 'MIRIAM', 'KING', 2500, 900, 18000.00 )
+, ( 321, 'BILL', 'WINN', 2000, 900, 32000.00 )
+, ( 337, 'DINAH', 'CLARK', 9000, 900, 37000.00 )
+, ( 343, 'ALAN', 'TERRY', 3000, 900, 39500.00 )
+, ( 557, 'BEN', 'HENDERSON', 4000, 400, 65000.00 )
+, ( 568, 'JESSICA', 'CRINER', 3500, 300, 39500.00 )
+, ( 990, 'THOMAS', 'STIBBS', 3500, NULL, NULL )
+, ( 991, 'WAYNE', 'O''NEIL', 3500, NULL, NULL )
+, ( 992, 'BARRY', 'KINNEY', 3500, NULL, NULL )
+, ( 993, 'PAUL', 'BUSKETT', 3100, NULL, NULL )
+, ( 994, 'EMMY', 'BUSKETT', 3100, NULL, NULL )
+, ( 995, 'WALT', 'FARLEY', 3100, NULL, NULL )
+;
+
+UPDATE STATISTICS FOR TABLE demo.persnl.employee ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/persnl_job_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_job_table.sql b/docs/spj_guide/src/resources/source/persnl_job_table.sql
new file mode 100644
index 0000000..0692af0
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/persnl_job_table.sql
@@ -0,0 +1,20 @@
+CREATE TABLE demo.persnl.job
+( jobcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, jobdesc VARCHAR (18) DEFAULT ' ' NOT NULL
+, PRIMARY KEY (jobcode)
+) ;
+
+INSERT INTO demo.persnl.job VALUES
+ ( 100, 'MANAGER' )
+, ( 200, 'PRODUCTION SUPV' )
+, ( 250, 'ASSEMBLER' )
+, ( 300, 'SALESREP' )
+, ( 400, 'SYSTEM ANALYST' )
+, ( 420, 'ENGINEER' )
+, ( 450, 'PROGRAMMER' )
+, ( 500, 'ACCOUNTANT' )
+, ( 600, 'ADMINISTRATOR' )
+, ( 900, 'SECRETARY' )
+;
+
+UPDATE STATISTICS FOR TABLE demo.persnl.job ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/persnl_project_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_project_table.sql b/docs/spj_guide/src/resources/source/persnl_project_table.sql
new file mode 100644
index 0000000..35c2999
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/persnl_project_table.sql
@@ -0,0 +1,45 @@
+CREATE TABLE demo.persnl.project
+( projcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, projdesc VARCHAR (18) DEFAULT ' ' NOT NULL
+, start_date DATE DEFAULT DATE '2011-07-01' NOT NULL
+, ship_timestamp TIMESTAMP DEFAULT TIMESTAMP '2011-08-01:12:00:00.000000' NOT NULL
+, est_complete INTERVAL DAY DEFAULT INTERVAL '30' DAY NOT NULL
+, PRIMARY KEY (projcode, empnum)
+) ;
+
+INSERT INTO demo.persnl.project
+VALUES
+ ( 1000, 213, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
+, ( 1000, 211, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
+, ( 1000, 23, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
+, ( 1000, 1, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
+, ( 2000, 227, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
+, ( 2000, 109, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
+, ( 2000, 215, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
+, ( 2000, 65, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
+, ( 2500, 65, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
+, ( 2500, 207, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
+, ( 2500, 232, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
+, ( 2500, 180, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
+, ( 2500, 93, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
+, ( 3000, 65, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
+, ( 3000, 221, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
+, ( 3000, 226, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
+, ( 3000, 224, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
+, ( 3000, 225, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
+, ( 4000, 75, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 4000, 29, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 4000, 231, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 4000, 228, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 4000, 223, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 4000, 568, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
+, ( 5000, 65, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+, ( 5000, 568, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+, ( 5000, 557, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+, ( 5000, 216, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+, ( 5000, 203, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+, ( 5000, 218, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
+;
+
+UPDATE STATISTICS FOR TABLE demo.persnl.project ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/persnl_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_schema.sql b/docs/spj_guide/src/resources/source/persnl_schema.sql
new file mode 100644
index 0000000..bad0734
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/persnl_schema.sql
@@ -0,0 +1,2 @@
+CREATE SCHEMA DEMO.PERSNL ;
+SET SCHEMA DEMO.PERSNL ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/projectTeam.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/projectTeam.java b/docs/spj_guide/src/resources/source/projectTeam.java
new file mode 100644
index 0000000..039b534
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/projectTeam.java
@@ -0,0 +1,25 @@
+// The PROJECTTEAM procedure accepts a project code and returns the
+// employee number, first name, last name, and location of the employees
+// assigned to that project.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#projectteam-procedure
+// for more documentation.
+public static void projectTeam( int projectCode
+ , ResultSet[] members
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getMembers =
+ conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, D.location "
+ + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
+ + "WHERE P.projcode = ? "
+ + " AND P.empnum = E.empnum "
+ + " AND E.deptnum = D.deptnum "
+ ) ;
+
+ getMembers.setInt( 1, projectCode ) ;
+ members[0] = getMembers.executeQuery() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/sales_customer_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_customer_table.sql b/docs/spj_guide/src/resources/source/sales_customer_table.sql
new file mode 100644
index 0000000..96a1c7c
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/sales_customer_table.sql
@@ -0,0 +1,30 @@
+CREATE TABLE demo.sales.customer
+( custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, custname CHARACTER (18) NO DEFAULT NOT NULL
+, street CHARACTER (22) NO DEFAULT NOT NULL
+, city CHARACTER (14) NO DEFAULT NOT NULL
+, state CHARACTER (12) DEFAULT ' ' NOT NULL
+, postcode CHARACTER (10) NO DEFAULT NOT NULL
+, credit CHARACTER (2) DEFAULT 'C1' NOT NULL
+, PRIMARY KEY (custnum)
+) ;
+
+INSERT INTO demo.sales.customer VALUES
+ ( 21, 'CENTRAL UNIVERSITY', 'UNIVERSITY WAY', 'PHILADELPHIA', 'PENNSYLVANIA', '19104', 'A1' )
+, ( 123, 'BROWN MEDICAL CO', '100 CALIFORNIA STREET', 'SAN FRANCISCO', 'CALIFORNIA', '94944', 'C2' )
+, ( 143, 'STEVENS SUPPLY', '2020 HARRIS STREET', 'DENVER', 'COLORADO', '80734', 'A2' )
+, ( 324, 'PREMIER INSURANCE', '3300 WARBASH', 'LUBBOCK', 'TEXAS', '76308', 'A1' )
+, ( 543, 'FRESNO STATE BANK', '2300 BROWN BLVD', 'FRESNO', 'CALIFORNIA', '93921', 'B3' )
+, ( 926, 'METALL-AG.', '12 WAGNERRING', 'FRANKFURT', 'WEST GERMANY', '34', 'D4' )
+, ( 1234, 'DATASPEED', '300 SAN GABRIEL WAY', 'NEW YORK', 'NEW YORK', '10014', 'C1' )
+, ( 3210, 'BESTFOOD MARKETS', '3333 PHELPS STREET', 'LINCOLN', 'NEBRASKA', '68134', 'A4' )
+, ( 3333, 'NATIONAL UTILITIES', '6500 TRANS-CANADIENNE', 'QUEBEC', 'CANADA', 'H4T 1X4', 'A1' )
+, ( 5635, 'ROYAL CHEMICALS', '45 NEW BROAD STREET', 'LONDON', 'ENGLAND', 'EC2M 1NH', 'B2' )
+, ( 7654, 'MOTOR DISTRIBUTING', '2345 FIRST STREET', 'CHICAGO', 'ILLINOIS', '60610', 'E4' )
+, ( 7777, 'SLEEPWELL HOTELS', '9000 PETERS AVENUE', 'DALLAS', 'TEXAS', '75244', 'B1' )
+, ( 9000, 'BUNKNOUGHT INN', '4738 RALPH STREET', 'BAYONNE', 'NEW JERSEY', '09520', 'C1' )
+, ( 9010, 'HOTEL OREGON', '333 PORTLAND AVE.', 'MEDFORD', 'OREGON', '97444', 'C2' )
+, ( 9033, 'ART SUPPLIES, INC.', '22 SWEET ST.', 'PITTSBURGH', 'PENNA.', '08333', 'C3' )
+;
+
+UPDATE STATISTICS FOR TABLE demo.sales.customer ON EVERY COLUMN;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/sales_odetail_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_odetail_table.sql b/docs/spj_guide/src/resources/source/sales_odetail_table.sql
new file mode 100644
index 0000000..13cfb61
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/sales_odetail_table.sql
@@ -0,0 +1,84 @@
+CREATE TABLE demo.sales.odetail
+( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
+, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, unit_price NUMERIC (8, 2) NO DEFAULT NOT NULL
+, qty_ordered NUMERIC (5) UNSIGNED NO DEFAULT NOT NULL
+, PRIMARY KEY (ordernum,partnum)
+) ;
+
+INSERT INTO demo.sales.odetail VALUES
+ ( 100210, 244, 3500.00, 3 )
+, ( 100210,2001, 1100.00, 3 )
+, ( 100210,2403, 620.00, 6 )
+, ( 100210,5100, 150.00, 10 )
+, ( 100250, 244, 3500.00, 4 )
+, ( 100250,5103, 400.00, 10 )
+, ( 100250,6301, 245.00, 15 )
+, ( 100250,6500, 95.00, 10 )
+, ( 101220, 255, 3900.00, 10 )
+, ( 101220,5103, 400.00, 3 )
+, ( 101220,7102, 275.00, 7 )
+, ( 101220,7301, 425.00, 8 )
+, ( 200300, 244, 3500.00, 8 )
+, ( 200300,2001, 1000.00, 10 )
+, ( 200300,2002, 1400.00, 10 )
+, ( 200320,5504, 165.00, 5 )
+, ( 200320,6201, 195.00, 16 )
+, ( 200320,6301, 245.00, 6 )
+, ( 200320,6400, 540.00, 7 )
+, ( 200490,3210, 715.00, 1 )
+, ( 200490,5505, 350.00, 1 )
+, ( 300350, 244, 2800.00, 20 )
+, ( 300350,5100, 150.00, 5 )
+, ( 300350,5110, 525.00, 12 )
+, ( 300350,6301, 245.00, 5 )
+, ( 300350,6400, 550.00, 5 )
+, ( 300380, 244, 3000.00, 6 )
+, ( 300380,2402, 320.00, 12 )
+, ( 300380,2405, 760.00, 8 )
+, ( 400410, 212, 2450.00, 12 )
+, ( 400410, 255, 3800.00, 12 )
+, ( 400410,2001, 1000.00, 36 )
+, ( 400410,6301, 240.00, 48 )
+, ( 400410,6400, 500.00, 70 )
+, ( 400410,7301, 415.00, 36 )
+, ( 500450, 212, 2500.00, 8 )
+, ( 500450, 255, 3900.00, 12 )
+, ( 500450,2001, 1100.00, 16 )
+, ( 500450,2002, 1500.00, 16 )
+, ( 500450,2402, 330.00, 48 )
+, ( 600480,2001, 1000.00, 60 )
+, ( 600480,2002, 1450.00, 20 )
+, ( 600480,2003, 1900.00, 40 )
+, ( 600480,3103, 4000.00, 40 )
+, ( 600480,3205, 625.00, 20 )
+, ( 600480,5100, 135.00, 60 )
+, ( 600480,5103, 390.00, 20 )
+, ( 600480,7301, 425.00, 40 )
+, ( 700410,2003, 1900.00, 65 )
+, ( 700410,2403, 650.00, 10 )
+, ( 700510, 255, 4000.00, 4 )
+, ( 700510,6500, 95.00, 8 )
+, ( 700510,7102, 275.00, 5 )
+, ( 800660, 244, 3000.00, 6 )
+, ( 800660,2001, 1000.00, 30 )
+, ( 800660,2403, 600.00, 48 )
+, ( 800660,2405, 795.00, 10 )
+, ( 800660,3201, 525.00, 6 )
+, ( 800660,3205, 600.00, 18 )
+, ( 800660,3210, 715.00, 6 )
+, ( 800660,4102, 26.00, 130 )
+, ( 800660,5100, 150.00, 12 )
+, ( 800660,5101, 200.00, 6 )
+, ( 800660,5110, 490.00, 48 )
+, ( 800660,5504, 165.00, 18 )
+, ( 800660,6201, 195.00, 6 )
+, ( 800660,6301, 235.00, 24 )
+, ( 800660,6400, 525.00, 30 )
+, ( 800660,6401, 700.00, 36 )
+, ( 800660,6500, 95.00, 22 )
+, ( 800660,7102, 275.00, 6 )
+, ( 800660,7301, 425.00, 12 )
+;
+
+UPDATE STATISTICS FOR TABLE demo.sales.odetail ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/sales_orders_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_orders_table.sql b/docs/spj_guide/src/resources/source/sales_orders_table.sql
new file mode 100644
index 0000000..45dd0a0
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/sales_orders_table.sql
@@ -0,0 +1,66 @@
+CREATE TABLE demo.sales.orders
+( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
+, order_date DATE DEFAULT DATE '2011-07-01' NOT NULL
+, deliv_date DATE DEFAULT DATE '2011-08-01' NOT NULL
+, salesrep NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
+, custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, PRIMARY KEY (ordernum)
+) ;
+
+ALTER TABLE demo.sales.orders
+ ADD CONSTRAINT demo.sales.date_constrnt CHECK (deliv_date >= order_date)
+ ;
+
+CREATE INDEX xordrep ON orders
+( salesrep
+) ;
+
+CREATE INDEX xordcus ON orders
+( custnum
+) ;
+
+CREATE VIEW demo.sales.ordrep AS SELECT
+ empnum
+, last_name
+, ordernum
+, o.custnum
+FROM
+ demo.persnl.employee e
+, demo.sales.orders o
+, demo.sales.customer c
+WHERE e.empnum = o.salesrep
+ AND o.custnum = C.custnum
+;
+
+CREATE INDEX xcustnam ON customer
+(
+custname
+) ;
+
+CREATE VIEW demo.sales.custlist AS SELECT
+ custnum
+, custname
+, street
+, city
+, state
+, postcode
+FROM demo.sales.customer
+;
+
+INSERT INTO demo.sales.orders VALUES
+ ( 100210, DATE '2011-04-10', DATE '2011-04-10', 220, 1234 )
+, ( 100250, DATE '2011-01-23', DATE '2011-06-15', 220, 7777 )
+, ( 101220, DATE '2011-07-21', DATE '2011-12-15', 221, 5635 )
+, ( 200300, DATE '2011-02-06', DATE '2011-07-01', 222, 926 )
+, ( 200320, DATE '2011-02-17', DATE '2011-07-20', 223, 21 )
+, ( 200490, DATE '2011-03-19', DATE '2011-11-01', 226, 123 )
+, ( 300350, DATE '2011-03-03', DATE '2011-08-10', 231, 543 )
+, ( 300380, DATE '2011-03-19', DATE '2011-08-20', 226, 123 )
+, ( 400410, DATE '2011-03-27', DATE '2011-09-01', 227, 7654 )
+, ( 500450, DATE '2011-04-20', DATE '2011-09-15', 220, 324 )
+, ( 600480, DATE '2011-05-12', DATE '2011-10-10', 226, 3333 )
+, ( 700510, DATE '2011-06-01', DATE '2011-10-20', 229, 143 )
+, ( 800660, DATE '2011-10-09', DATE '2011-11-01', 568, 3210 )
+;
+
+UPDATE STATISTICS FOR TABLE demo.sales.orders ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/sales_parts_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_parts_table.sql b/docs/spj_guide/src/resources/source/sales_parts_table.sql
new file mode 100644
index 0000000..ed7d2fc
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/sales_parts_table.sql
@@ -0,0 +1,45 @@
+CREATE TABLE demo.sales.parts
+( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
+, partdesc CHARACTER (18) NO DEFAULT NOT NULL
+, price NUMERIC (8, 2) NO DEFAULT NOT NULL
+, qty_available NUMERIC (5) DEFAULT 0 NOT NULL
+, PRIMARY KEY (partnum)
+) ;
+
+CREATE INDEX xpartdes ON parts
+( partdesc
+) ;
+
+INSERT INTO demo.sales.parts VALUES
+ ( 186, '186 MegaByte Disk', 186186.86, 186 )
+, ( 212, 'PC SILVER, 20 MB', 2500.00, 3525 )
+, ( 244, 'PC GOLD, 30 MB', 3000.00, 4426 )
+, ( 255, 'PC DIAMOND, 60 MB', 4000.00, 3321 )
+, ( 2001, 'GRAPHIC PRINTER,M1', 1100.00, 2100 )
+, ( 2002, 'GRAPHIC PRINTER,M2', 1500.00, 3220 )
+, ( 2003, 'GRAPHIC PRINTER,M3', 2000.00, 2200 )
+, ( 2402, 'DAISY PRINTER,T1', 350.00, 4425 )
+, ( 2403, 'DAISY PRINTER,T2', 650.00, 3312 )
+, ( 2405, 'DAISY PRINTER, T3', 795.00, 2712 )
+, ( 3103, 'LASER PRINTER, X1', 4200.00, 3300 )
+, ( 3201, 'HARD DISK 20 MB', 525.00, 4436 )
+, ( 3205, 'HARD DISK 30 MB', 625.00, 2209 )
+, ( 3210, 'HARD DISK 40 MB', 715.00, 3314 )
+, ( 4102, 'DISKETTE HD, BOX', 28.00, 6540 )
+, ( 5100, 'MONITOR BW, TYPE 1', 150.00, 3237 )
+, ( 5101, 'MONITOR BW, TYPE 2', 200.00, 2400 )
+, ( 5103, 'MONITOR COLOR, M1', 400.00, 3328 )
+, ( 5110, 'MONITOR COLOR, M2', 525.00, 3236 )
+, ( 5504, 'MEMORY CARD, 512KB', 165.00, 2630 )
+, ( 5505, 'MEMORY CARD, 1 MB', 315.00, 3830 )
+, ( 6201, 'GRAPHIC CARD, LR', 195.00, 2306 )
+, ( 6301, 'GRAPHIC CARD, HR', 245.00, 2331 )
+, ( 6400, 'STREAMING TAPE,M20', 550.00, 1268 )
+, ( 6401, 'STREAMING TAPE,M60', 725.00, 1308 )
+, ( 6500, 'DISK CONTROLLER', 95.00, 2532 )
+, ( 6603, 'PRINTER CONTROLLER', 45.00, 430 )
+, ( 7102, 'SMART MODEM, 1200', 275.00, 2200 )
+, ( 7301, 'SMART MODEM, 2400', 425.00, 2332 )
+;
+
+UPDATE STATISTICS FOR TABLE demo.sales.parts ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/sales_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_schema.sql b/docs/spj_guide/src/resources/source/sales_schema.sql
new file mode 100644
index 0000000..3049491
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/sales_schema.sql
@@ -0,0 +1,2 @@
+CREATE SCHEMA DEMO.SALES ;
+SET SCHEMA DEMO.SALES ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/supplierinfo.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/supplierinfo.java b/docs/spj_guide/src/resources/source/supplierinfo.java
new file mode 100644
index 0000000..a75c617
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/supplierinfo.java
@@ -0,0 +1,38 @@
+// The SUPPLIERINFO procedure accepts a supplier number and returns the
+// supplier's name, street, city, state, and post code to separate output
+// parameters.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#supplierinfo-procedure
+// for more documentation.
+public static void supplierInfo( BigDecimal suppNum
+ , String[] suppName
+ , String[] streetAddr
+ , String[] cityName
+ , String[] stateName
+ , String[] postCode
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getSupplier =
+ conn.prepareStatement( "SELECT suppname, street, city, "
+ + " state, postcode "
+ + "FROM demo.invent.supplier "
+ + "WHERE suppnum = ?"
+ ) ;
+
+ getSupplier.setBigDecimal( 1, suppNum ) ;
+ ResultSet rs = getSupplier.executeQuery() ;
+ rs.next() ;
+
+ suppName[0] = rs.getString( 1 ) ;
+ streetAddr[0] = rs.getString( 2 ) ;
+ cityName[0] = rs.getString( 3 ) ;
+ stateName[0] = rs.getString( 4 ) ;
+ postCode[0] = rs.getString( 5 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/supplyquantities.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/supplyquantities.java b/docs/spj_guide/src/resources/source/supplyquantities.java
new file mode 100644
index 0000000..466f444
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/supplyquantities.java
@@ -0,0 +1,32 @@
+// The SUPPLYQUANTITIES procedure returns the average, minimum, and maximum
+// quantities of available parts in inventory to separate output
+// parameters.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#supplyquantities-procedure
+// for more documentation.
+public static void supplyQuantities( int[] avgQty
+ , int[] minQty
+ , int[] maxQty
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getQty =
+ conn.prepareStatement( "SELECT AVG(qty_on_hand), "
+ + " MIN(qty_on_hand), "
+ + " MAX(qty_on_hand) "
+ + "FROM demo.invent.partloc"
+ ) ;
+
+ ResultSet rs = getQty.executeQuery() ;
+ rs.next() ;
+
+ avgQty[0] = rs.getInt( 1 ) ;
+ minQty[0] = rs.getInt( 2 ) ;
+ maxQty[0] = rs.getInt( 3 ) ;
+
+ rs.close() ;
+ conn.close() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/topSalesReps.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/topSalesReps.java b/docs/spj_guide/src/resources/source/topSalesReps.java
new file mode 100644
index 0000000..96be5db
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/topSalesReps.java
@@ -0,0 +1,43 @@
+// The TOPSALESREPS procedure accepts a number representing the fiscal
+// quarter (1, 2, 3, and 4, with each number representing a range of
+// months) and returns the employee number, first name, last name, and sale
+// figures of the top five sales representatives who had the highest sales
+// (unit_price * qty_ordered) that quarter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#topsalesreps-procedure
+// for more documentation.
+public static void topSalesReps( int whichQuarter
+ , ResultSet[] topReps
+ ) throws SQLException
+{
+ if ( whichQuarter < 1 || whichQuarter > 4 )
+ {
+ throw new SQLException ( "Invalid value for quarter. "
+ + "Retry the CALL statement "
+ + "using a number from 1 to 4 "
+ + "to represent the quarter."
+ , "38001"
+ ) ;
+ }
+
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getTopReps =
+ conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
+ + "e.last_name, totals.total "
+ + "FROM demo.persnl.employee e, "
+ + " ( SELECT o.salesrep, "
+ + " SUM( od.unit_price * od.qty_ordered ) as total "
+ + " FROM demo.sales.orders o, demo.sales.odetail od "
+ + " WHERE o.ordernum = od.ordernum "
+ + " AND QUARTER( o.order_date ) = ? "
+ + " GROUP BY o.salesrep "
+ + " ) totals "
+ + "WHERE e.empnum = totals.salesrep "
+ + "ORDER BY totals.total DESCENDING "
+ ) ;
+
+ getTopReps.setInt( 1, whichQuarter ) ;
+ topReps[0] = getTopReps.executeQuery() ;
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/resources/source/totalPrice.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/totalPrice.java b/docs/spj_guide/src/resources/source/totalPrice.java
new file mode 100644
index 0000000..5e1ff15
--- /dev/null
+++ b/docs/spj_guide/src/resources/source/totalPrice.java
@@ -0,0 +1,47 @@
+// The TOTALPRICE procedure accepts the quantity, shipping speed, and price
+// of an item, calculates the total price, including tax and shipping
+// charges, and returns the total price to an input/output parameter.
+//
+// See http://trafodion.incubator.apache.org/docs/spj_guide/index.html#totalprice-procedure
+// for more documentation.
+public static void totalPrice( BigDecimal qtyOrdered
+ , String shippingSpeed
+ , BigDecimal[] price
+ ) throws SQLException
+{
+ BigDecimal shipcharge = new BigDecimal( 0 ) ;
+
+ if ( shippingSpeed.equals( "economy" ) )
+ {
+ shipcharge = new BigDecimal( 1.95 ) ;
+ }
+ else if ( shippingSpeed.equals( "standard" ) )
+ {
+ shipcharge = new BigDecimal( 4.99 ) ;
+ }
+ else if ( shippingSpeed.equals( "nextday" ) )
+ {
+ shipcharge = new BigDecimal( 14.99 ) ;
+ }
+ else
+ {
+ throw new SQLException( "Invalid value for shipping speed. "
+ + "Retry the CALL statement using "
+ + "'economy' for 7 to 9 days, "
+ + "'standard' for 3 to 5 days, or "
+ + "'nextday' for one day."
+ , "38002"
+ ) ;
+ }
+
+ BigDecimal subtotal = price[0].multiply( qtyOrdered ) ;
+ BigDecimal tax = new BigDecimal( 0.0825 ) ;
+ BigDecimal taxcharge = subtotal.multiply( tax ) ;
+ BigDecimal charges = taxcharge.add( shipcharge ) ;
+ BigDecimal totalprice = subtotal.add( charges ) ;
+
+ totalprice = totalprice.setScale( 2, BigDecimal.ROUND_HALF_EVEN ) ;
+ price[0] = totalprice ;
+
+}
+
[02/14] incubator-trafodion git commit: Backup checkin. The basic
edit of the guide has been done. Need to change it to refer to trafci
commands to complete.
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
index 1c4fc8e..758b156 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
@@ -26,11 +26,16 @@
This appendix presents the SPJs that are shown in examples throughout
this manual. The class files that contain the SPJ methods use JDBC
method calls to access a sample database. For information about the
-sample database, see link:#_bookmark336[Appendix B (page 103)].
+sample database, see <<b-sample-database, Sample Database>> below.
-* link:#_bookmark223["Procedures in the SALES Schema" (page 62)]
-* link:#_bookmark274["Procedures in the PERSNL Schema" (page 83)]
-* link:#_bookmark309["Procedures in the INVENT Schema" (page 94)]
+* <<procedures-in-the-sales-schema, Procedures in the SALES Schema>>
+* <<procedures-in-the-persnl-schema, Procedures in the PERSNL Schema>>
+* <<procedures-in-the-invent-schema, Procedures in the INVENT Schema>>
+
+You can download each source sample by clicking the link provided with the
+sample name. For example, click on
+link:/resources/source/Sales.java[Sales.java]
+to download the sample sales class source file.
[[procedures-in-the-sales-schema]]
== Procedures in the SALES Schema
@@ -38,318 +43,25 @@ sample database, see link:#_bookmark336[Appendix B (page 103)].
The Sales class contains these SPJ methods, which are useful for
tracking orders and managing sales:
-* link:#_bookmark226["LOWERPRICE Procedure" (page 67)]
-* link:#_bookmark234["DAILYORDERS Procedure" (page 69)]
-* link:#_bookmark242["MONTHLYORDERS Procedure" (page 71)]
-* link:#_bookmark250["TOTALPRICE Procedure" (page 73)]
-* link:#_bookmark258["PARTDATA Procedure" (page 76)]
-* link:#_bookmark266["ORDERSUMMARY Procedure" (page 80)]
+* <<lowerprice-procedure, LOWERPRICE Procedure>>
+* <<dailyorders-procedure, DAILYORDERS Procedure>>
+* <<monthlyorders-procedure, MONTHLYORDERS Procedure>>
+* <<totalprice-procedure, TOTALPRICE Procedure>>
+* <<partdata-procedure, PARTDATA Procedure>>
+* <<ordersummary-procedure, ORDERSUMMARY Procedure>>
Those methods are registered as stored procedures in the SALES schema.
-link:#_bookmark225[Example 1] shows the code of the Sales.java source
+<<example-1,Example 1>> shows the code of the
+link:resources/source/Sales.java[Sales.java]
file.
-*Example 1* `Sales.java` - The Sales Class
+[[example-1]]
+.Example 1: link:resources/source/Sales.java[`Sales.java`] - The Sales Class
-```
-import java.sql.*; import java.math.*;
-
-public class Sales
-{
- public static void lowerPrice() throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getParts =
- conn.prepareStatement( "SELECT p.partnum, "
- + "SUM(qty_ordered) AS qtyOrdered "
- + "FROM demo.sales.parts p "
- + "LEFT JOIN demo.sales.odetail o "
- + "ON p.partnum = o.partnum "
- + "GROUP BY p.partnum"
- ) ;
-
- PreparedStatement updateParts =
- conn.prepareStatement( "UPDATE demo.sales.parts "
- + "SET price = price * 0.9 "
- + "WHERE partnum = ?"
- ) ;
-
- ResultSet rs = getParts.executeQuery() ;
- while ( rs.next() )
- {
- BigDecimal qtyOrdered = rs.getBigDecimal( 2 ) ;
-
- if (( qtyOrdered == null ) || ( qtyOrdered.intValue() < 50 ) )
- {
- BigDecimal partnum = rs.getBigDecimal( 1 ) ;
- updateParts.setBigDecimal( 1, partnum ) ;
- updateParts.executeUpdate() ;
- }
- }
-
- rs.close();
- conn.close();
-
- } // See the link:#_bookmark226["LOWERPRICE Procedure" (page 67)].
-
- public static void numDailyOrders( Date date
- , int[] numOrders
- ) throws SQLException
-
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getNumOrders =
- conn.prepareStatement( "SELECT COUNT(order_date) "
- + "FROM demo.sales.orders "
- + "WHERE order_date = ?"
- ) ;
-
- getNumOrders.setDate( 1, date ) ;
-
- ResultSet rs = getNumOrders.executeQuery() ;
- rs.next() ;
-
- numOrders[0] = rs.getInt( 1 ) ;
- rs.close() ;
-
- conn.close();
-
- } // See the link:#_bookmark234["DAILYORDERS Procedure" (page 69)].
-
- public static void numMonthlyOrders( int month
- , int[] numOrders
- ) throws SQLException
-
- {
- if ( month < 1 || month > 12 )
- {
- throw new SQLException( "Invalid value for month. "
- + "Retry the CALL statement "
- + "using a number from 1 to 12 "
- + "to represent the month."
- , "38001"
- ) ;
- }
-
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getNumOrders =
- conn.prepareStatement( "SELECT COUNT( month( order_date ) ) "
- + "FROM demo.sales.orders "
- + "WHERE month( order_date ) = ?"
- ) ;
-
- getNumOrders.setInt(1, month);
-
- ResultSet rs = getNumOrders.executeQuery() ;
- rs.next() ;
-
- numOrders[0] = rs.getInt(1) ;
- rs.close() ;
-
- conn.close();
-
- } // See the link:#_bookmark242["MONTHLYORDERS Procedure" (page 71)].
-
- public static void totalPrice( BigDecimal qtyOrdered
- , String shippingSpeed
- , BigDecimal[] price
- ) throws SQLException
- {
- BigDecimal shipcharge = new BigDecimal( 0 ) ;
-
- if ( shippingSpeed.equals( "economy" ) )
- {
- shipcharge = new BigDecimal( 1.95 ) ;
- }
- else if ( shippingSpeed.equals( "standard" ) )
- {
- shipcharge = new BigDecimal( 4.99 ) ;
- }
- else if ( shippingSpeed.equals( "nextday" ) )
- {
- shipcharge = new BigDecimal( 14.99 ) ;
- }
- else
- {
- throw new SQLException( "Invalid value for shipping speed. "
- + "Retry the CALL statement using "
- + "'economy' for 7 to 9 days, "
- + "'standard' for 3 to 5 days, or "
- + "'nextday' for one day."
- , "38002"
- ) ;
- }
-
- BigDecimal subtotal = price[0].multiply( qtyOrdered ) ;
- BigDecimal tax = new BigDecimal( 0.0825 ) ;
- BigDecimal taxcharge = subtotal.multiply( tax ) ;
- BigDecimal charges = taxcharge.add( shipcharge ) ;
- BigDecimal totalprice = subtotal.add( charges ) ;
-
- totalprice = totalprice.setScale( 2, BigDecimal.ROUND_HALF_EVEN ) ;
- price[0] = totalprice;
-
- } // See the link:#_bookmark250["TOTALPRICE Procedure" (page 73)].
-
- public static void partData( int partNum
- , String[] partDescription
- , BigDecimal[] unitPrice
- , int[] qtyAvailable
- , ResultSet[] orders
- , ResultSet[] locations
- , ResultSet[] suppliers
- , ResultSet[] reps
- ) throws SQLException
- {
-
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- // Retrieve detail about this part into the output parameters
- PreparedStatement getPartInfo =
- conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
- + "FROM demo.sales.parts P "
- + "WHERE partnum = ? "
- ) ;
-
- getPartInfo.setInt( 1, partNum ) ;
-
- ResultSet rs = getPartInfo.executeQuery() ;
- rs.next() ;
-
- partDescription[0] = rs.getString( 1 ) ;
- unitPrice[0] = rs.getBigDecimal( 2 ) ;
- qtyAvailable[0] = rs.getInt( 3 ) ;
-
- rs.close();
-
- // Return a result set of rows from the ORDERS table listing orders
- // that included this part. Each ORDERS row is augmented with the
- // quantity of this part that was ordered.
- PreparedStatement getOrders =
- conn.prepareStatement( "SELECT O.*, QTY.QTY_ORDERED "
- + "FROM demo.sales.orders O "
- + " , ( select ordernum, sum(qty_ordered) as QTY_ORDERED "
- + " from demo.sales.odetail "
- + " where partnum = ? "
- + " group by ordernum ) QTY "
- + "WHERE O.ordernum = QTY.ordernum "
- + "ORDER BY O.ordernum "
- ) ;
-
-
- getOrders.setInt( 1, partNum ) ;
- orders[0] = getOrders.executeQuery() ;
-
- // Return a result set of rows from the PARTLOC table listing
- // locations that have this part in stock and the quantity they
- // have on hand.
- PreparedStatement getLocations =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partloc "
- + " WHERE partnum = ? "
- ) ;
-
- getLocations.setInt( 1, partNum ) ;
- locations[0] = getLocations.executeQuery() ;
-
- // Return a result set of rows from the PARTSUPP table listing
- // suppliers who supply this part.
- PreparedStatement getSuppliers =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partsupp "
- + "WHERE partnum = ? "
- ) ;
-
- getSuppliers.setInt( 1, partNum ) ;
- suppliers[0] = getSuppliers.executeQuery() ;
-
- // Return a result set of rows from the EMPLOYEE table listing
- // sales reps that have sold this part.
- PreparedStatement getReps =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.persnl.employee "
- + "WHERE empnum in ( SELECT O.salesrep "
- + " FROM demo.sales.orders O, "
- + " demo.sales.odetail D "
- + " D.partnum = ? "
- + " O.ordernum = D.ordernum ) "
- + "ORDER BY empnum "
- ) ;
-
- getReps.setInt( 1, partNum ) ;
- reps[0] = getReps.executeQuery() ;
-
- } // See the link:#_bookmark258["PARTDATA Procedure" (page 76)].
-
- public static void orderSummary( java.lang.String onOrAfter
- , long[] numOrders
- , java.sql.ResultSet[] orders
- , java.sql.ResultSet[] detail
- ) throws SQLException
- {
- java.lang.String s ;
-
- java.sql.Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- // Get the number of orders on or after this date
- s = "SELECT COUNT(ordernum) FROM demo.sales.orders "
- + "WHERE order_date >= CAST(? AS DATE) "
- ;
-
- java.sql.PreparedStatement ps1 = conn.prepareStatement( s ) ;
- ps1.setString( 1, onOrAfter ) ;
-
- java.sql.ResultSet rs = ps1.executeQuery() ;
- rs.next() ;
-
- numOrders[0] = rs.getLong( 1 ) ;
- rs.close() ;
-
- // Open a result set for order num, order info rows
- s = "SELECT amounts.*, orders.order_date, emps.last_name "
- + "FROM ( SELECT "
- + " o.ordernum "
- + " , COUNT(d.partnum) AS num_parts "
- + " , SUM(d.unit_price * d.qty_ordered) AS amount "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
- + " WHERE o.ordernum = d.ordernum "
- + " AND o.order_date >= CAST(? AS DATE) "
- + " GROUP BY o.ordernum "
- + " ) amounts "
- + " , demo.sales.orders orders "
- + " , demo.persnl.employee emps "
- + "WHERE amounts.ordernum = orders.ordernum "
- + " AND orders.salesrep = emps.empnum "
- + "ORDER BY orders.ordernum "
- ;
-
- java.sql.PreparedStatement ps2 = conn.prepareStatement( s ) ;
- ps2.setString( 1, onOrAfter ) ;
- orders[0] = ps2.executeQuery() ;
-
- // Open a result set for order detail rows
- s = "SELECT d.*, p.partdesc "
- + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
- + "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
- + " AND o.order_date >= CAST(? AS DATE) "
- + "ORDER BY d.ordernum "
- ;
-
- java.sql.PreparedStatement ps3 = conn.prepareStatement( s ) ;
- ps3.setString( 1, onOrAfter ) ;
- detail[0] = ps3.executeQuery() ;
-
- } // See the link:#_bookmark266["ORDERSUMMARY Procedure" (page 80)].
-}
-```
+[source, java]
+----
+include::{sourcedir}/Sales.java[Sales Class source]
+----
See the following sections for more information about each SPJ method.
@@ -363,101 +75,68 @@ database by 10 percent.
[[java-method-lowerprice]]
==== Java Method: lowerPrice()
-Example 2 lowerPrice() Method
+.Example 2: link:resources/source/lowerPrice.java[`lowerPrice()`] Method
-```
-public static void lowerPrice() throws SQLException
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getParts =
- conn.prepareStatement( "SELECT "
- + " p.partnum"
- + ", SUM(qty_ordered) AS qtyOrdered "
- + "FROM demo.sales.parts p "
- + "LEFT JOIN demo.sales.odetail o "
- + " ON p.partnum = o.partnum "
- + "GROUP BY p.partnum"
- ) ;
-
- PreparedStatement updateParts =
- conn.prepareStatement( "UPDATE demo.sales.parts "
- + "SET price = price * 0.9 "
- + "WHERE partnum = ?"
- ) ;
-
- ResultSet rs = getParts.executeQuery() ;
-
- while ( rs.next() )
- {
- BigDecimal qtyOrdered = rs.getBigDecimal( 2 ) ;
-
- if ( ( qtyOrdered == null ) || ( qtyOrdered.intValue() < 50 ) )
- {
- BigDecimal partnum = rs.getBigDecimal( 1 ) ;
- updateParts.setBigDecimal( 1, partnum ) ;
- updateParts.executeUpdate() ;
- }
- }
-
- rs.close() ;
- conn.close() ;
-}
-```
+[source, java]
+----
+include::{sourcedir}/lowerPrice.java[lowerPrice procedure source code]
+----
[[creating-the-procedure-lowerprice]]
==== Creating the Procedure: LOWERPRICE
-Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
+Before creating the procedure, use HPDM to create a library named `SALES`
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+<<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the Procedures folder in the SALES schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-Table 3 HPDM Create Procedure Settings: LOWERPRICE Procedure
+[[table-3]]
+.HPDM Create Procedure Settings: LOWERPRICE Procedure
-[cols=",,",options="header",]
+[cols="15%,30%,55%", options="header"]
+|===
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `lowerprice`
+| *Code* | Library | `DEMO.SALES.SALES`
+| | Class Name | `Sales`
+| | Method Name | `lowerPrice`
+| *Parameters* | | None
+| *Attributes* | Number of dynamic results sets | `0`
+| | Access Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE*: Depending on your security requirements, you can select Definer
+instead. For more information, see
+<<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
-| Group Box | Field or Option | Value or Setting
-| Name
-| lowerprice | Code | DEMO.SALES.SALES | Sales
-lowerPrice
-Parameters
-None
-Attributes
-0
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
-|==
[[calling-the-procedure-lowerprice]]
==== Calling the Procedure: LOWERPRICE
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the LOWERPRICE procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.sales.lowerprice() ;
--- SQL operation complete.
-```
+----
To view the prices and quantities of items in the database with 50 or
fewer orders, issue this query before and after calling the LOWERPRICE
procedure:
-```
+[source, sql]
+----
SELECT *
FROM
( SELECT p.partnum
@@ -468,13 +147,14 @@ FROM
GROUP BY p.partnum, p.price
) AS allparts
WHERE qtyOrdered < 51 ;
-```
+----
The LOWERPRICE procedure lowers the price of items with 50 or fewer
orders by 10 percent in the database. For example, part number 3103, the
LASER PRINTER, X1, has 40 orders and a price of 4200.00:
-```
+[source, sql]
+----
PARTNUM QTYORDERED PRICE
------- -------------------- ----------
212 20 2500.00
@@ -487,12 +167,13 @@ PARTNUM QTYORDERED PRICE
... ... ...
--- 17 row(s) selected.
-```
+----
The invocation of LOWERPRICE lowers the price of this item from 4200.00
to 3780.00:
-```
+[source, sql]
+----
PARTNUM QTYORDERED PRICE
------- -------------------- ----------
6500 40 85.50
@@ -504,7 +185,7 @@ PARTNUM QTYORDERED PRICE
... ... ...
--- 17 row(s) selected.
-```
+----
[[dailyorders-procedure]]
=== DAILYORDERS Procedure
@@ -515,70 +196,50 @@ orders on that date to an output parameter.
[[java-method-numdailyorders]]
==== Java Method: numDailyOrders()
-Example 3 numDailyOrders() Method
-
-```
-public static void numDailyOrders( Date date
- , int[] numOrders
- ) throws SQLException
-{
- Connection conn = DriverManager.getConnection("jdbc:default:connection");
-
- PreparedStatement getNumOrders =
- conn.prepareStatement( "SELECT COUNT(order_date) "
- + "FROM demo.sales.orders "
- + "WHERE order_date = ?"
- ) ;
-
- getNumOrders.setDate( 1, date ) ;
-
- ResultSet rs = getNumOrders.executeQuery() ;
- rs.next() ;
+.Example 3: link:resources/source/numDailyOrders.java[`numDailyOrders()`] Method
- numOrders[0] = rs.getInt( 1 ) ;
- rs.close() ;
-
- conn.close() ;
-}
-```
+[source, java]
+----
+include::{sourcedir}/numDailyOrders.java[numDailyOrders procedure source code]
+----
[[creating-the-procedure-dailyorders]]
==== Creating the Procedure: DAILYORDERS
-Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
+Before creating the procedure, use HPDM to create a library named `SALES`
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
+<<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the Procedures folder in the SALES schema, launch
the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+For more information, see <<create-a-procedure, Create a Procedure>>
-Table 4 HPDM Create Procedure Settings: DAILYORDERS Procedure
+[[table-4]]
+.HPDM Create Procedure Settings: DAILYORDERS Procedure
-[cols="15%,20%,65%", options="header"]
+[cols="15%,30%,55%", options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| Name | Procedure Name | dailyorders
-| Code | Library | DEMO.SALES.SALES
-| | Class Name | Sales
-| | Method Name | numDailyOrders
-| Parameters | |
-| 1st | Parameter Name | date1
-| | SQL Data Type | DATE
-| | Direction | IN
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.sql.Date`
-| 2nd | Parameter Name | number
-| | SQL Data Type | SIGNED INTEGER
-| | Direction | OUT
-| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
-| Attributes | Number of dynamic result sets | 0
-| | Accesses Database | selected
-| | External security | Invoker +
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | dailyorders
+| *Code* | Library | DEMO.SALES.SALES
+| | Class Name | Sales
+| | Method Name | numDailyOrders
+3+<| *Parameters*
+| _First_ | Parameter Name | date1
+| | SQL Data Type | DATE
+| | Direction | IN
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.sql.Date`
+| _Second_ | Parameter Name | number
+| | SQL Data Type | SIGNED INTEGER
+| | Direction | OUT
+| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
+| *Attributes* | Number of dynamic result sets | 0
+| | Accesses Database | selected
+| | External security | Invoker +
+
-*NOTE:( Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
+*NOTE:* Depending on your security requirements, you can select Definer
+instead. For more information, see <<understand-external-security, Understand External Security>>.
| | Transaction required | Yes
|===
@@ -587,24 +248,26 @@ External] link:#_bookmark124[Security" (page 41)].
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the DAILYORDERS procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.sales.dailyorders( DATE '2011-03-19', ? ) ;
-```
+----
The DAILYORDERS procedure determines the total number of orders on a
specified date and returns this output in trafci:
-```
+[source, sql]
+----
NUMBER
-----------
2
--- SQL operation complete.
-```
+----
On March 19, 2011, there were two orders.
@@ -618,83 +281,51 @@ parameter.
[[java-method-nummonthlyorders]]
==== Java Method: numMonthlyOrders()
-Example 4 numMonthlyOrders() Method
+.Example 4: link:resources/source/numMonthlyOrders.java[`numMonthlyOrders()`] Method
-```
-public static void numMonthlyOrders( int month
- , int[] numOrders
- ) throws SQLException
-{
- if ( month < 1 || month > 12 )
- {
- throw new
- SQLException( "Invalid value for month. "
- + "Retry the CALL statement "
- + "using a number from 1 to 12 "
- + "to represent the month."
- , "38001"
- ) ;
- }
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getNumOrders =
- conn.prepareStatement( "SELECT COUNT(month(order_date)) "
- + "FROM demo.sales.orders "
- + "WHERE month(order_date) = ?"
- ) ;
-
- getNumOrders.setInt( 1, month ) ;
-
- ResultSet rs = getNumOrders.executeQuery() ;
- rs.next() ;
-
- numOrders[0] = rs.getInt( 1 ) ;
- rs.close() ;
-
- conn.close() ;
-}
+[source, java]
+----
+include::{sourcedir}/numMonthlyOrders.java[numMonthlyOrders procedure source code]
+----
[[creating-the-procedure-monthlyorders]]
-=== Creating the Procedure: MONTHLYORDERS
+==== Creating the Procedure: MONTHLYORDERS
Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
-Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the Procedures folder in the SALES schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-Table 5 HPDM Create Procedure Settings: MONTHLYORDERS Procedure
+[[table-5]]
+.HPDM Create Procedure Settings: MONTHLYORDERS Procedure
-[cols=",,",options="header",]
+[cols="15%,30%,55%", options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-Name
-monthlyorders
-Code
-DEMO.SALES.SALES
-Sales
-numMonthlyOrders
-Parameters
-monthnum
-SIGNED INTEGER
-IN
-Displays the signature of the Java method that you selected: int
-ordernum
-SIGNED INTEGER
-OUT
-Displays the signature of the Java method that you selected: int[]
-Attributes
-0
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `monthlyorders`
+| *Code* | Library | `DEMO.SALES.SALES`
+| | Class Name | `Sales`
+| | Method Name | `numMonthlyOrders`
+3+<| *Parameters*
+| _First_ | Parameter Name | `monthnum`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int`
+| _Second_ | Parameter Name | `ordernum`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
+| *Attributes* | Number of dynamic result sets | `0`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-monthlyorders]]
@@ -702,24 +333,26 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the MONTHLYORDERS procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.sales.monthlyorders( 3,? ) ;
-```
+----
The MONTHLYORDERS procedure determines the total number of orders during
a specified month and returns this output in trafci:
-```
+[source, sql]
+----
ORDERNUM
-----------
4
--- SQL operation complete.
-```
+----
In March, there were four orders.
@@ -733,111 +366,64 @@ charges, and returns the total price to an input/output parameter.
[[java-method-totalprice]]
==== Java Method: totalPrice()
-Example 5 totalPrice() Method
+.Example 5: link:resources/source/totalPrice.java[`totalPrice()`] Method
-```
-public static void totalPrice( BigDecimal qtyOrdered
- , String shippingSpeed
- , BigDecimal[] price
- ) throws SQLException
-{
- BigDecimal shipcharge = new BigDecimal( 0 ) ;
-
- if ( shippingSpeed.equals( "economy" ) )
- {
- shipcharge = new BigDecimal( 1.95 ) ;
- }
- else if ( shippingSpeed.equals( "standard" ) )
- {
- shipcharge = new BigDecimal( 4.99 ) ;
- }
- else if ( shippingSpeed.equals( "nextday" ) )
- {
- shipcharge = new BigDecimal( 14.99 ) ;
- }
- else
- {
- throw new SQLException( "Invalid value for shipping speed. "
- + "Retry the CALL statement using "
- + "'economy' for 7 to 9 days,"
- + "'standard' for 3 to 5 days, or "
- + "'nextday' for one day."
- , "38002"
- ) ;
- }
-
- BigDecimal subtotal = price[0].multiply( qtyOrdered ) ;
-
- BigDecimal tax = new BigDecimal( 0.0825 ) ;
- BigDecimal taxcharge = subtotal.multiply( tax ) ;
- BigDecimal charges = taxcharge.add( shipcharge ) ;
- BigDecimal totalprice = subtotal.add( charges ) ;
-
- totalprice = totalprice.setScale( 2, BigDecimal.ROUND_HALF_EVEN ) ;
- price[0] = totalprice ;
-
-}
+[source, java]
+----
+include::{sourcedir}/totalPrice.java[totalPrice procedure source code]
+----
[[creating-the-procedure-totalprice]]
==== Creating the Procedure: TOTALPRICE
Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
-Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
-
-Table 6 HPDM Create Procedure Settings: TOTALPRICE Procedure
-
-[cols=",,",options="header",]
-|=======================================================================
-| Group Box | Field or Option | Value or Setting
-Name
-totalprice
-Code
-DEMO.SALES.SALES
-Sales
-totalPrice
-Parameters
-qty
-SIGNED NUMERIC
-*
-Precision: 18
-*
-Scale: 0
-IN
-Displays the signature of the Java method that you selected:
-java.math.BigDecimal
-rate
-VARCHAR
-*
-Length: 10
-*
-Upshift: not selected
-*
-Character set: ISO88591
-IN
-Displays the signature of the Java method that you selected:
-java.lang.String
-price
-SIGNED NUMERIC
-*
-Precision: 18
-*
-Scale: 2
-INOUT
-Displays the signature of the Java method that you selected:
-java.math.BigDecimal[]
-Attributes
-0
-not selected
-Invoker
-NOTE: External security is disabled because the stored procedure does
-not access the database.
-No
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the Procedures folder in the SALES schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
+
+[[table-6]]
+.HPDM Create Procedure Settings: TOTALPRICE Procedure
+
+[cols="15%,30%,55%", options="header"]
+|===
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `totalprice`
+| *Code* | Library | `DEMO.SALES.SALES`
+| | Class Name | `Sales`
+| | Method Name | `totalPrice`
+3+<| *Parameters*
+| _First_ | Parameter Name | `qty`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `18` +
+- Scale: `0`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
+| _Second_ | Parameter Name | `rate`
+| | SQL Data Type | `VARCHAR` +
+ +
+- Length: `10` +
+- Upshift: `not selected` +
+- Character set: `ISO88591`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String`
+| _Third_ | Parameter Name | `price`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `18` +
+- Scale: `2`
+| | Direction | `INOUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
+| *Attributes* | Number of dynamic result sets | `0`
+| | Accesses Database | `not selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* External security is disabled because the stored procedure does not access the database.
+| | Transaction Required | No
|===
[[calling-the-procedure-totalprice]]
@@ -845,25 +431,27 @@ No
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the TOTALPRICE procedure in trafci:
-```
+[source, sql]
+----
SQL> SET PARAM ?p 10 ;
SQL> CALL demo.sales.totalprice( 23, 'standard', ?p ) ;
-```
+----
The TOTALPRICE procedure calculates the total price of a purchase and
returns this output in trafci:
-```
+[source, sql]
+----
p
--------------------
253.97
--- SQL operation complete.
-```
+----
The total price of 23 items, which cost $10 each and which are shipped
at the standard rate, is $253.97, including sales tax.
@@ -874,169 +462,76 @@ at the standard rate, is $253.97, including sales tax.
The PARTDATA procedure accepts a part number and returns this
information about the part:
-* Part description, price, and quantity available as output parameters
-* A result set that contains rows from the ORDERS table about when this part was ordered
-* A result set that contains rows from the PARTLOC table, listing locations that have this
-part in stock and the quantity they have on hand
-* A result set that contains rows from the PARTSUPP table for suppliers who carry this part
-* A result set that contains rows from the EMPLOYEE table for sales reps who have sold this part
+* Part description, price, and quantity available as output parameters.
+* A result set that contains rows from the ORDERS table about when this part was ordered.
+* A result set that contains rows from the PARTLOC table, listing locations that have this part in stock and the quantity they have on hand.
+* A result set that contains rows from the PARTSUPP table for suppliers who carry this part.
+* A result set that contains rows from the EMPLOYEE table for sales reps who have sold this part.
[[java-method-partdata]]
==== Java Method: partData()
-Example 6 partData() Method
+.Example 6: link:resources/source/partData.java[`partData()`] Method
-```
-public static void partData( int partNum
- , String[] partDescription
- , BigDecimal[] unitPrice
- , int[] qtyAvailable
- , ResultSet[] orders
- , ResultSet[] locations
- , ResultSet[] suppliers
- , ResultSet[] reps
- ) throws SQLException
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- // Retrieve detail about this part into the output parameters
- PreparedStatement getPartInfo =
- conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
- + "FROM demo.sales.parts P "
- + "WHERE partnum = ? "
- ) ;
-
- getPartInfo.setInt( 1, partNum ) ;
-
- ResultSet rs = getPartInfo.executeQuery() ;
- rs.next() ;
-
- partDescription[0] = rs.getString( 1 ) ;
- unitPrice[0] = rs.getBigDecimal( 2 ) ;
- qtyAvailable[0] = rs.getInt( 3 ) ;
-
- rs.close();
-
- // Return a result set of rows from the ORDERS table listing orders
- // that included this part. Each ORDERS row is augmented with the
- // quantity of this part that was ordered.
- PreparedStatement getOrders =
- conn.prepareStatement( "SELECT o.*, qty.qty_ordered "
- + "FROM demo.sales.orders o "
- + " , ( SELECT ordernum, SUM( qty_ordered ) AS qty_ordered "
- + " FROM demo.sales.odetail "
- + " WHERE partnum = ? "
- + " GROUP BY ordernum) qty "
- + "WHERE o.ordernum = qty.ordernum "
- + "ORDER BY O.ordernum "
- ) ;
-
- getOrders.setInt( 1, partNum ) ;
- orders[0] = getOrders.executeQuery() ;
-
- // Return a result set of rows from the PARTLOC table listing
- // locations that have this part in stock and the quantity they
- // have on hand.
- PreparedStatement getLocations =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partloc "
- + "WHERE partnum = ? "
- ) ;
-
- getLocations.setInt( 1, partNum ) ;
- locations[0] = getLocations.executeQuery() ;
-
- // Return a result set of rows from the PARTSUPP table listing
- // suppliers who supply this part.
- PreparedStatement getSuppliers =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partsupp "
- + "WHERE partnum = ? "
- ) ;
-
- getSuppliers.setInt( 1, partNum ) ;
- suppliers[0] = getSuppliers.executeQuery() ;
-
- // Return a result set of rows from the EMPLOYEE table listing
- // sales reps that have sold this part.
- PreparedStatement getReps =
- conn.prepareStatement( "SELECT * "
- + "FROM demo.persnl.employee "
- + "WHERE empnum IN "
- + " ( SELECT o.salesrep "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
- + " WHERE d.partnum = ? "
- + " AND o.ordernum = d.ordernum ) "
- + "ORDER BY empnum "
- ) ;
-
- getReps.setInt( 1, partNum ) ;
- reps[0] = getReps.executeQuery() ;
-}
+[source, java]
+----
+include::{sourcedir}/partData.java[partData procedure source code]
+----
[[creating-the-procedure-partdata]]
==== Creating the Procedure: PARTDATA
Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
-Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
-Table 7 HPDM Create Procedure Settings: PARTDATA Procedure
+After creating the library, navigate to the Procedures folder in the SALES schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-[cols=",,",options="header",]
+[[table-7]]
+.HPDM Create Procedure Settings: PARTDATA Procedure
+
+[cols="15%,30%,55%", options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-Name
-partdata
-Code
-DEMO.SALES.SALES
-Sales
-partData
-Parameters
-partnum
-SIGNED INTEGER
-IN
-Displays the signature of the Java method that you selected: int
-partdesc
-CHARACTER
-*
-Length: 18
-*
-Varying: not selected
-*
-Upshift: not selected
-*
-Character set: ISO88591
-OUT
-Displays the signature of the Java method that you selected:
-java.lang.String[]
-price
-SIGNED NUMERIC
-*
-Precision: 8
-*
-Scale: 2
-OUT
-Displays the signature of the Java method that you selected:
-java.math.BigDecimal[]
-qty_available
-SIGNED INTEGER
-OUT
-Displays the signature of the Java method that you selected: int[]
-Attributes
-4
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `partdata`
+| *Code* | Library | `DEMO.SALES.SALES`
+| | Class Name | `Sales`
+| | Method Name | `partData`
+3+<| *Parameters*
+| _First_ | Parameter Name | `partnum`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int`
+| _Second_ | Parameter Name | `partdesc`
+| | SQL Data Type | `CHARACTER` +
+ +
+- Length: `18` +
+- Varying: `not selected` +
+- Upshift: `not selected` +
+- Character set: `ISO88591`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
+| _Third_ | Parameter Name | `price`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `8` +
+- Scale: `2`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
+| _Fourth_ | Parameter Name | `qty_available`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
+| *Attributes* | Number of dynamic result sets | `4`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-partdata]]
@@ -1044,17 +539,19 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the PARTDATA procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.sales.partdata(212,?,?,?) ;
-```
+----
The PARTDATA procedure returns this information about part 212:
-```
+[source, sql]
+----
PARTDESC PRICE QTY_AVAILABLE
------------------ ---------- -------------
PC SILVER, 20 MB 2500.00 3525
@@ -1088,16 +585,16 @@ EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY
--- 2 row(s) selected.
--- SQL operation complete.
-```
+----
[[ordersummary-procedure]]
-== ORDERSUMMARY Procedure
+=== ORDERSUMMARY Procedure
The ORDERSUMMARY procedure accepts a date, which is formatted as a
string, and returns this information about the orders on or after that
date:
-* The number of orders as an output parameter
+* The number of orders as an output parameter.
* A result set that contains one row for each order. Each row contains
fields for the order number, the number of parts ordered, total dollar
amount, order date, and the name of the sales representative.
@@ -1109,112 +606,55 @@ ordered, and part description.
[[java-method-ordersummary]]
==== Java Method: orderSummary()
-Example 7 orderSummary() Method
-
-public static void orderSummary( java.lang.String onOrAfter
- , long[] numOrders
- , java.sql.ResultSet[] orders
- , java.sql.ResultSet[] detail
- ) throws SQLException
-{
- java.lang.String s ;
-
- java.sql.Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- // Get the number of orders on or after this date
- s = "SELECT COUNT( ordernum ) FROM demo.sales.orders "
- + "WHERE order_date >= CAST(? AS DATE) "
- ;
-
- java.sql.PreparedStatement ps1 = conn.prepareStatement( s ) ;
- ps1.setString( 1, onOrAfter ) ;
-
- java.sql.ResultSet rs = ps1.executeQuery() ;
- rs.next() ;
-
- numOrders[0] = rs.getLong(1) ;
- rs.close() ;
-
- // Open a result set for order num, order info rows
- s = "SELECT amounts.*, orders.order_date, emps.last_name "
- + "FROM ( SELECT o.ordernum, COUNT(d.partnum) AS num_parts, "
- + " SUM(d.unit_price * d.qty_ordered) AS amount "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
- + " WHERE o.ordernum = d.ordernum "
- + " AND o.order_date >= CAST(? AS DATE) "
- + " GROUP BY o.ordernum "
- + " ) amounts "
- + " , demo.sales.orders orders "
- + " , demo.persnl.employee emps "
- + "WHERE amounts.ordernum = orders.ordernum "
- + " AND orders.salesrep = emps.empnum "
- + "ORDER BY orders.ordernum "
- ;
-
- java.sql.PreparedStatement ps2 = conn.prepareStatement( s ) ;
- ps2.setString( 1, onOrAfter ) ;
- orders[0] = ps2.executeQuery() ;
-
- // Open a result set for order detail rows
- s = "SELECT d.*, p.partdesc "
- + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
- + "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
- + " AND o.order_date >= CAST(? AS DATE) "
- + "ORDER BY d.ordernum "
- ;
-
- java.sql.PreparedStatement ps3 = conn.prepareStatement( s ) ;
- ps3.setString( 1, onOrAfter ) ;
- detail[0] = ps3.executeQuery() ;
-}
+.Example 7: link:resources/source/orderSummary.java[`orderSummary()`] Method
+
+[source, java]
+----
+include::{sourcedir}/orderSummary.java[orderSummary procedure source code]
+----
[[creating-the-procedure-ordersummary]]
==== Creating the Procedure: ORDERSUMMARY
Before creating the procedure, use HPDM to create a library named SALES
-in the DEMO.SALES schema and select the Sales.jar file to upload to the
-Trafodion platform for that library. For more information, see
-link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
-Table 8 HPDM Create Procedure Settings: ORDERSUMMARY Procedure
+After creating the library, navigate to the Procedures folder in the SALES schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-[cols=",,",options="header",]
+[[table-8]]
+.HPDM Create Procedure Settings: ORDERSUMMARY Procedure
+
+[cols="15%,30%,55%", options="header"]
|===
-Group Box
-Field or Option
-Value or Setting
-Name
-ordersummary
-Code
-DEMO.SALES.SALES
-Sales
-orderSummary
-Parameters
-on_or_after_date
-VARCHAR
-Length: 20
-Upshift: not selected
-Character set: ISO88591
-IN
-Displays the signature of the Java method that you selected:
-java.lang.String
-num_orders
-SIGNED LARGEINT
-OUT
-Displays the signature of the Java method that you selected: long[]
-Attributes
-2
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `ordersummary`
+| *Code* | Library | `DEMO.SALES.SALES`
+| | Class Name | `Sales`
+| | Method Name | `orderSummary`
+3+<| *Parameters*
+| _First_ | Parameter Name | `on_or_after_date`
+| | SQL Data Type | `VARCHAR` +
+ +
+- Length: `20`
+- Upshift: `not selected`
+- Character set: `ISO88591`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String`
+| _Second_ | Parameter Name | `num_orders`
+| | SQL Data Type | `SIGNED LARGEINT`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `long[]`
+| *Attributes* | Number of dynamic result sets | `2`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-ordersummary]]
@@ -1222,18 +662,20 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the ORDERSUMMARY procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.sales.ordersummary('01-01-2011', ?);
-```
+----
The ORDERSUMMARY procedure returns this information about the orders on
or after the specified date, 01-01-2011:
-```
+[source, sql]
+----
NUM_ORDERS
--------------------
13
@@ -1255,7 +697,7 @@ ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
--- 70 row(s) selected.
--- SQL operation complete.
-```
+----
[[procedures-in-the-persnl-schema]]
== Procedures in the PERSNL Schema
@@ -1263,143 +705,23 @@ ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
The Payroll class contains these SPJ methods, which are useful for
managing personnel data:
-* link:#_bookmark277["ADJUSTSALARY Procedure" (page 86)]
-* link:#_bookmark285["EMPLOYEEJOB Procedure" (page 88)]
-* link:#_bookmark293["PROJECTTEAM Procedure" (page 90)]
-* link:#_bookmark301["TOPSALESREPS Procedure" (page 92)]
+* <<adjustsalary-procedure, ADJUSTSALARY Procedure>>
+* <<employeejob-procedure, EMPLOYEEJOB Procedure>>
+* <<projectteam-procedure, PROJECTTEAM Procedure>>
+* <<topsalesreps-procedure, TOPSALESREPS Procedure>>
Those methods are registered as stored procedures in the PERSNL schema.
-link:#_bookmark276[Example 8] shows the code of the Payroll.java source
+<<example-6, Example 6>> shows the code of the
+link:resources/source/Payroll.java[Payroll.java]
file.
-Example 8 Payroll.java-The Payroll Class
+[[example-8]]
+.Example 8: link:resources/source/Payroll.java[`Payroll.java`] - The Payroll Class
-```
-import java.sql.*;
-import java.math.*;
-
-public class Payroll
-{
- public static void adjustSalary( BigDecimal empNum
- , double percent
- , BigDecimal[] newSalary
- ) throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
- + "SET salary = salary * (1 + (? / 100)) "
- + "WHERE empnum = ?"
- ) ;
-
- PreparedStatement getSalary =
- conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
- + "WHERE empnum = ?"
- ) ;
-
- setSalary.setDouble( 1, percent ) ;
- setSalary.setBigDecimal( 2, empNum ) ;
- setSalary.executeUpdate() ;
-
- getSalary.setBigDecimal( 1, empNum ) ;
- ResultSet rs = getSalary.executeQuery() ;
- rs.next() ;
-
- newSalary[0] = rs.getBigDecimal( 1 ) ;
- rs.close() ;
-
- conn.close() ;
-
- } // See the link:#_bookmark277["ADJUSTSALARY Procedure" (page 86)].
-
- public static void employeeJob( int empNum
- , java.lang.Integer[] jobCode
- ) throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getJobcode =
- conn.prepareStatement( "SELECT jobcode "
- + "FROM demo.persnl.employee "
- + "WHERE empnum = ?"
- ) ;
-
- getJobcode.setInt( 1, empNum ) ;
- ResultSet rs = getJobcode.executeQuery() ;
- rs.next() ;
-
- int num = rs.getInt(1) ;
- if ( rs.wasNull() )
- jobCode[0] = null ;
- else
- jobCode[0] = new Integer(num) ;
-
- rs.close() ;
- conn.close() ;
-
- } // See the link:#_bookmark285["EMPLOYEEJOB Procedure" (page 88)].
-
- public static void projectTeam( int projectCode
- , ResultSet[] members
- ) throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getMembers =
- conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, D.location "
- + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
- + "WHERE P.projcode = ? "
- + " AND P.empnum = E.empnum "
- + " AND E.deptnum = D.deptnum "
- ) ;
-
- getMembers.setInt( 1, projectCode ) ;
- members[0] = getMembers.executeQuery() ;
-
- } // See the link:#_bookmark293["PROJECTTEAM Procedure" (page 90)].
-
- public static void topSalesReps( int whichQuarter
- , ResultSet[] topReps
- ) throws SQLException
- {
- if ( whichQuarter < 1 || whichQuarter > 4 )
- {
- throw new SQLException ( "Invalid value for quarter. "
- + "Retry the CALL statement "
- + "using a number from 1 to 4 "
- + "to represent the quarter."
- , "38001"
- ) ;
- }
-
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getTopReps =
- conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
- + "e.last_name, totals.total "
- + "FROM demo.persnl.employee e, "
- + " ( SELECT o.salesrep, "
- + " SUM( od.unit_price * od.qty_ordered ) as total "
- + " FROM demo.sales.orders o, demo.sales.odetail od "
- + " WHERE o.ordernum = od.ordernum "
- + " AND QUARTER( o.order_date ) = ? "
- + " GROUP BY o.salesrep "
- + " ) totals "
- + "WHERE e.empnum = totals.salesrep "
- + "ORDER BY totals.total DESCENDING "
- ) ;
-
- getTopReps.setInt( 1, whichQuarter ) ;
- topReps[0] = getTopReps.executeQuery() ;
-
- } // See the link:#_bookmark301["TOPSALESREPS Procedure" (page 92)].
-}
+[source, java]
+----
+include::{sourcedir}/Payroll.java[Sales Class source]
+----
See the following sections for more information about each SPJ method.
@@ -1407,102 +729,68 @@ See the following sections for more information about each SPJ method.
=== ADJUSTSALARY Procedure
The ADJUSTSALARY procedure accepts an employee number and a percentage
-value and updates the employee's salary in the database based on that
+vvalue and updates the employee's salary in the database based on that
percentage. This method also returns the updated salary to an output
parameter.
[[java-method-adjustsalary]]
==== Java Method: adjustSalary()
-Example 9 adjustSalary() Method
+.Example 9: link:resources/source/adjustSalary.java[`adjustSalary()`] Method
-```
-public static void adjustSalary( BigDecimal empNum
- , double percent
- , BigDecimal[] newSalary
- ) throws SQLException
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
- + "SET salary = salary * (1 + (? / 100)) "
- + "WHERE empnum = ?"
- ) ;
-
- PreparedStatement getSalary =
- conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
- + "WHERE empnum = ?"
- ) ;
-
- setSalary.setDouble( 1, percent ) ;
- setSalary.setBigDecimal( 2, empNum ) ;
- setSalary.executeUpdate() ;
-
- getSalary.setBigDecimal( 1, empNum ) ;
- ResultSet rs = getSalary.executeQuery() ;
- rs.next() ;
-
- newSalary[0] = rs.getBigDecimal( 1 ) ;
-
- rs.close() ;
- conn.close() ;
-}
-```
+[source, java]
+----
+include::{sourcedir}/adjustSalary.java[adjustSalary procedure source code]
+----
[[creating-the-procedure-adjustsalary]]
==== Creating the Procedure: ADJUSTSALARY
Before creating the procedure, use HPDM to create a library named
-PAYROLL in the DEMO.PERSNL schema and select the Payroll.jar file to
-upload to the Trafodion platform for that library. For more information,
-see link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the PERSNL schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
+upload to the Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-Table 9 HPDM Create Procedure Settings: ADJUSTSALARY Procedure
+[[table-9]]
+.HPDM Create Procedure Settings: ADJUSTSALARY Procedure
-[cols=",,",options="header",]
+[cols="15%,30%,55%", options="header"]
|===
-Group Box
-Field or Option
-Value or Setting
-Name
-adjustsalary
-Code
-DEMO.PERSNL.PAYROLL
-Payroll
-adjustSalary
-Parameters
-empnum
-SIGNED NUMERIC
-Precision: 4
-Scale: 0
-Displays the signature of the Java method that you selected:
-java.math.BigDecimal
-percent
-FLOAT
-IN
-Displays the signature of the Java method that you selected: double
-newsalary
-SIGNED NUMERIC
-Precision: 8
-Scale: 2
-OUT
-Displays the signature of the Java method that you selected:
-java.math.BigDecimal[]
-Attributes
-0
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `adjustsalary`
+| *Code* | Library | `DEMO.PERSNL.PAYROLL`
+| | Class Name | `Payroll`
+| | Method Name | `adjustSalary`
+3+<| *Parameters*
+| _First_ | Parameter Name | `empnum`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `4` +
+- Scale: `0`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
+| _Second_ | Parameter Name | `percent`
+| | SQL Data Type | `FLOAT`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `double`
+| _Third_ | Parameter Name | `newsalary`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `8` +
+- Scale: `2`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
+| *Attributes* | Number of dynamic result sets | `0`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-adjustsalary]]
@@ -1510,24 +798,26 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the ADJUSTSALARY procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.persnl.adjustsalary(29, 2.5, ?) ;
-```
+----
The ADJUSTSALARY procedure updates the salary of employee number 29 by
2.5 percent and returns this output in trafci:
-```
+[source, sql]
+----
NEWSALARY
----------
139400.00
--- SQL operation complete.
-```
+----
The salary of employee number 29 was originally $136,000.00 and became
$139,400.00 after the invocation of ADJUSTSALARY.
@@ -1541,80 +831,54 @@ code or null value to an output parameter.
[[java-method-employeejob]]
==== Java Method: employeeJob()
-Example 10 employeeJob() Method
+.Example 10:link:resources/source/employeeJob.java[`employeeJob()`] Method
-```
-public static void employeeJob( int empNum
- , java.lang.Integer[] jobCode
- ) throws SQLException
-
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getJobcode =
- conn.prepareStatement( "SELECT jobcode "
- + "FROM demo.persnl.employee " + "WHERE empnum = ?");
-
- getJobcode.setInt( 1, empNum ) ;
-
- ResultSet rs = getJobcode.executeQuery() ;
- rs.next() ;
-
- int num = rs.getInt( 1 ) ;
- if ( rs.wasNull() )
- jobCode[0] = null ;
- else
- jobCode[0] = new Integer( num ) ;
-
- rs.close() ;
- conn.close() ;
-}
-```
+[source, java]
+----
+include::{sourcedir}/employeeJob.java[employeeJob procedure source code]
+----
[[creating-the-procedure-employeejob]]
==== Creating the Procedure: EMPLOYEEJOB
Before creating the procedure, use HPDM to create a library named
-PAYROLL in the DEMO.PERSNL schema and select the Payroll.jar file to
-upload to the Trafodion platform for that library. For more information,
-see link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the PERSNL schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
+upload to the Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-Table 10 HPDM Create Procedure Settings: EMPLOYEEJOB Procedure
+[[table-10]]
+.HPDM Create Procedure Settings: EMPLOYEEJOB Procedure
-[cols=",,",options="header",]
+[cols="15%,30%,55%", options="header"]
|===
-Group Box
-Field or Option
-Value or Setting
-Name
-employeejob
-Code
-DEMO.PERSNL.PAYROLL
-Payroll
-employeeJob
-Parameters
-empnum
-SIGNED INTEGER
-IN
-Displays the signature of the Java method that you selected: int
-jobcode
-SIGNED INTEGER
-OUT
-Displays the signature of the Java method that you selected:
-java.lang.Integer[]
-Attributes
-0
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `employeejob`
+| *Code* | Library | `DEMO.PERSNL.PAYROLL`
+| | Class Name | `Payroll`
+| | Method Name | `employeeJob`
+3+<| *Parameters*
+| _First_ | Parameter Name | `empnum`
+| | SQL Data Type | `SIGNED NUMERIC` +
+ +
+- Precision: `4` +
+- Scale: `0`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
+| _Second_ | Parameter Name | `jobcode`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `OUT`
+| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.Integer[]`
+| *Attributes* | Number of dynamic result sets | `0`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-employeejob]]
@@ -1622,24 +886,26 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the EMPLOYEEJOB procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.persnl.employeejob(337, ?) ;
-```
+----
The EMPLOYEEJOB procedure accepts the employee number 337 and returns
this output in trafci:
-```
+[source, sql]
+----
JOBCODE
-----------
900
--- SQL operation complete.
-```
+----
The job code for employee number 337 is 900.
@@ -1653,67 +919,47 @@ assigned to that project.
[[java-method-projectteam]]
==== Java Method: projectTeam()
-Example 11 projectTeam() Method
+.Example 11:link:resources/source/projectTeam.java[`projectTeam()`] Method
-```
-public static void projectTeam( int projectCode
- , ResultSet[] members
- ) throws SQLException
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getMembers =
- conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, "
- + " D.location "
- + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
- + "WHERE P.projcode = ? "
- + " AND P.empnum = E.empnum "
- + " AND E.deptnum = D.deptnum "
- ) ;
-
- getMembers.setInt( 1, projectCode ) ;
- members[0] = getMembers.executeQuery() ;
-}
+[source, java]
+----
+include::{sourcedir}/projectTeam.java[projectTeam procedure source code]
+----
[[creating-the-procedure-projectteam]]
==== Creating the Procedure: PROJECTTEAM
Before creating the procedure, use HPDM to create a library named
-PAYROLL in the DEMO.PERSNL schema and select the Payroll.jar file to
-upload to the Trafodion platform for that library. For more information,
-see link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the PERSNL schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
+upload to the Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
-Table 11 HPDM Create Procedure Settings: PROJECTTEAM Procedure
+After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-[cols=",,",options="header",]
+[[table-11]]
+.HPDM Create Procedure Settings: PROJECTTEAM Procedure
+
+[cols="15%,30%,55%", options="header"]
|===
-Group Box
-Field or Option
-Value or Setting
-Name
-projectteam
-Code
-DEMO.PERSNL.PAYROLL
-Payroll
-projectTeam
-Parameters
-projectcode
-SIGNED INTEGER
-IN
-Displays the signature of the Java method that you selected: int
-Attributes
-1
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `projectteam`
+| *Code* | Library | `DEMO.PERSNL.PAYROLL`
+| | Class Name | `Payroll`
+| | Method Name | `projectTeam`
+3+<| *Parameters*
+| _First_ | Parameter Name | `projectcode`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int`
+| *Attributes* | Number of dynamic result sets | `1`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-projectteam]]
@@ -1721,16 +967,20 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the PROJECTTEAM procedure in trafci:
+[source, sql]
+----
SQL> CALL demo.persnl.projectteam( 5000 ) ;
+----
The PROJECTTEAM procedure returns this information about the employees
assigned to project number 5000:
-```
+[source, sql]
+----
EMPNUM FIRST_NAME LAST_NAME LOCATION
------ --------------- -------------------- ------------------
65 RACHEL MCKAY NEW YORK
@@ -1740,7 +990,7 @@ EMPNUM FIRST_NAME LAST_NAME LOCATION
--- 6 row(s) selected.
--- SQL operation complete.
-```
+----
[[topsalesreps-procedure]]
=== TOPSALESREPS Procedure
@@ -1754,84 +1004,47 @@ figures of the top five sales representatives who had the highest sales
[[java-method-topsalesreps]]
==== Java Method: topSalesReps()
-Example 12 topSalesReps() Method
+.Example 12: link:resources/source/topSalesReps.java[`topSalesReps()`] Method
-```
-public static void topSalesReps( int whichQuarter
- , ResultSet[] topReps
- ) throws SQLException
-{
- if ( whichQuarter < 1 || whichQuarter > 4 )
- {
- throw new SQLException( "Invalid value for quarter. "
- + "Retry the CALL statement "
- + "using a number from 1 to 4 "
- + "to represent the quarter."
- , "38001"
- ) ;
- }
-
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getTopReps =
- conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
- + " e.last_name, totals.total "
- + " FROM demo.persnl.employee e, "
- + " ( SELECT o.salesrep, "
- + " SUM( od.unit_price * od.qty_ordered) AS total "
- + " FROM demo.sales.orders o, demo.sales.odetail od "
- + " WHERE o.ordernum = od.ordernum "
- + " AND quarter(o.order_date) = ? "
- + " GROUP BY o.salesrep "
- + " ) totals "
- + "WHERE e.empnum = totals.salesrep "
- + "ORDER BY totals.total DESCENDING "
- ) ;
-
- getTopReps.setInt( 1, whichQuarter ) ;
- topReps[0] = getTopReps.executeQuery() ;
-
-}
+[source, java]
+----
+include::{sourcedir}/topSalesReps.java[topSalesReps procedure source code]
+----
[[creating-the-procedure-topsalesreps]]
==== Creating the Procedure: TOPSALESREPS
Before creating the procedure, use HPDM to create a library named
-PAYROLL in the DEMO.PERSNL schema and select the Payroll.jar file to
-upload to the Trafodion platform for that library. For more information,
-see link:#_bookmark95["Create a Library" (page 29)]. After creating the
-library, navigate to the Procedures folder in the PERSNL schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see link:#_bookmark116["Create a Procedure" (page
-37)].
+`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
+upload to the Trafodion platform for that library.
+For more information, see <<create-a-library, Create a Library>>.
+
+After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
+launch the Create Procedure dialog box, and then enter or select these values.
+For more information, see <<create-a-procedure, Create a Procedure>>.
-Table 12 HPDM Create Procedure Settings: TOPSALESREPS Procedure
+[[table-12]]
+.HPDM Create Procedure Settings: TOPSALESREPS Procedure
-[cols=",,",options="header",]
+[cols="15%,30%,55%", options="header"]
|===
-Group Box
-Field or Option
-Value or Setting
-Name
-topsalesreps
-Code
-DEMO.PERSNL.PAYROLL
-Payroll
-topSalesReps
-Parameters
-whichquarter
-SIGNED INTEGER
-IN
-Displays the signature of the Java method that you selected: int
-Attributes
-1
-selected
-Invoker
-NOTE: Depending on your security requirements, you can select Definer
-instead. For more information, see link:#_bookmark124["Understand
-External] link:#_bookmark124[Security" (page 41)].
-Yes
+| Group Box | Field or Option | Value or Setting
+| *Name* | Procedure Name | `topsalesreps`
+| *Code* | Library | `DEMO.PERSNL.PAYROLL`
+| | Class Name | `Payroll`
+| | Method Name | `topSalesReps`
+3+<| *Parameters*
+| _First_ | Parameter Name | `whichquarter`
+| | SQL Data Type | `SIGNED INTEGER`
+| | Direction | `IN`
+| | Java Data Type | Displays the signature of the Java method that you selected: `int`
+| *Attributes* | Number of dynamic result sets | `1`
+| | Acceses Database | `selected`
+| | External Security | `Invoker` +
+ +
+*NOTE:* Depending on your security requirements, you can select `Definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required | `Yes`
|===
[[calling-the-procedure-topsalesreps]]
@@ -1839,19 +1052,20 @@ Yes
NOTE: Make sure that users who will be calling the stored procedure have
the appropriate execute privileges. For more information, see
-link:#bookmark138["Granting Privileges for Executing SPJs" (page 45)].
+<<grant-privileges, Grant Privileges>>.
To invoke the TOPSALESREPS procedure in trafci:
-```
+[source, sql]
+----
SQL> CALL demo.persnl.topsalesreps( 1 ) ;
-```
+----
The TOPSALESREPS procedure returns this information about the top five
sales representatives during the first fiscal quarter:
-[cols=",,,",options="header",]
-|===
+[source, sql]
+----
FIRST_NAME LAST_NAME TOTAL
--------------- -------------------- --------------------
XAVIER SEDLEMEYER 172460.00
@@ -1863,7 +1077,7 @@ JOHN HUGHES 22625.00
--- 5 row(s) selected.
--- SQL operation complete.
-```
+----
[[procedures-in-the-invent-schema]]
== Procedures in the INVENT Schema
@@ -1871,119 +1085,21 @@ JOHN HUGHES 22625.00
The Inventory class contains these SPJ methods, which are useful for
tracking parts and suppliers:
-* link:#_bookmark312["SUPPLIERINFO Procedure" (page 96)]
-* link:#_bookmark320["SUPPLYNUMBERS Procedure" (page 99)]
-* link:#_bookmark328["PARTLOCS Procedure" (page 101)]
+* <<supplierinfo-procedure, SUPPLIERINFO Procedure>>
+* <<supplyquantities-procedure, SUPPLYQUANTITIES Procedure>>
+* <<partlocs-procedure, PARTLOCS Procedure>>
Those methods are registered as stored procedures in the INVENT schema.
-link:#_bookmark311[Example 13] shows the code of the Inventory.java
-source file.
+<<example-13, Example 13>> shows the code of the
+link:resources/source/Inventory.java[Inventory.java] file.
-Example 13 Inventory.java The Inventory Class
+[[example-13]]
+.Example 13: link:resources/source/Inventory.java[`Inventory.java`] - The Inventory Class
-```
-import java.sql.*;
-import java.math.*;
-
-public class Inventory
-{
- public static void supplierInfo( BigDecimal suppNum
- , String[] suppName
- , String[] streetAddr
- , String[] cityName
- , String[] stateName
- , String[] postCode
- ) throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getSupplier =
- conn.prepareStatement( "SELECT suppname, street, city, "
- + " state, postcode "
- + "FROM demo.invent.supplier "
- + "WHERE suppnum = ?"
- ) ;
-
- getSupplier.setBigDecimal( 1, suppNum ) ;
- ResultSet rs = getSupplier.executeQuery() ;
- rs.next() ;
-
- suppName[0] = rs.getString( 1 ) ;
- streetAddr[0] = rs.getString( 2 ) ;
- cityName[0] = rs.getString( 3 ) ;
- stateName[0] = rs.getString( 4 ) ;
- postCode[0] = rs.getString( 5 ) ;
-
- rs.close() ;
- conn.close() ;
-
- } // See the link:#_bookmark312["SUPPLIERINFO Procedure" (page 96)].
-
- public static void supplyQuantities( int[] avgQty
- , int[] minQty
- , int[] maxQty
- ) throws SQLException
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getQty =
- conn.prepareStatement( "SELECT AVG(qty_on_hand), "
- + " MIN(qty_on_hand), "
- + " MAX(qty_on_hand) "
- + "FROM demo.invent.partloc"
- ) ;
-
- ResultSet rs = getQty.executeQuery() ;
- rs.next() ;
-
- avgQty[0] = rs.getInt( 1 ) ;
- minQty[0] = rs.getInt( 2 ) ;
- maxQty[0] = rs.getInt( 3 ) ;
-
- rs.close() ;
- conn.close() ;
-
- } // See the link:#_bookmark320["SUPPLYNUMBERS Procedure" (page 99)].
-
- public static void partLocations( int partNum
- , int quantity
- , ResultSet exactly[]
- , ResultSet moreThan[]
- ) throws SQLException
-
- {
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getLocationsExact =
- conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
- + "WHERE L.partnum = ? "
- + " AND L.qty_on_hand = ? "
- + " ORDER BY L.partnum "
- ) ;
-
- getLocationsExact.setInt( 1, partNum ) ;
- getLocationsExact.setInt( 2, quantity) ;
-
- PreparedStatement getLocationsMoreThan =
- conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
- + "WHERE L.partnum = ? "
- + " AND L.qty_on_hand > ? "
- + "ORDER BY L.partnum "
- ) ;
-
- getLocationsMoreThan.setInt( 1, partNum ) ;
- getLocationsMoreThan.setInt( 2, quantity) ;
-
- exactly[0] = getLocationsExact.executeQuery() ;
- moreThan[0] = getLocationsMoreThan.executeQuery() ;
-
- } // See the link:#_bookmark328["PARTLOCS Procedure" (page 101)].
-}
+[source, java]
+----
+include::{sourcedir}/Inventory.java[Inventory Class source]
+----
See the following sections for more information about each SPJ method.
@@ -1997,127 +1113,95 @@ parameters.
[[java-method-supplierinfo]]
==== Java Method: supplierInfo()
-Example 14 supplierInfo() Method
+.Example 14: link:resources/source/supplierInfo.java[`supplierInfo()`] Method
-```
-public static void supplierInfo( BigDecimal suppNum
- , String[] suppName
- , String[] streetAddr
- , String[] cityName
- , String[] stateName
- , String[] postCode
- ) throws SQLException
-{
- Connection conn =
- DriverManager.getConnection( "jdbc:default:connection" ) ;
-
- PreparedStatement getSupplier =
- conn.prepareStatement( "SELECT suppname, street, city, "
- + " state, postcode "
- + "FROM demo.invent.supplier "
- + "WHERE suppnum = ?"
- ) ;
-
- getSupplier.setBigDecimal( 1, suppNum ) ;
- ResultSet rs = getSupplier.executeQuery() ;
- rs.next() ;
-
- suppName[0] = rs.getString( 1 ) ;
- streetAddr[0] = rs.getString( 2 ) ;
- cityName[0] = rs.getString( 3 ) ;
- stateName[0] = rs.getString( 4 ) ;
- postCode[0] = rs.getString( 5 ) ;
-
- rs.close() ;
- conn.close() ;
-}
-```
+[source, java]
+----
+include::{sourcedir}/supplierInfo.java[supplierInfo procedure source code]
+----
[[creating-the-procedure-supplierinfo]]
==== Creating the Procedure: SUPPLIERINFO
Before creating the procedure, use HPDM to create a library named
-INVENTORY in the DEMO.INVENT schema and select the Inventory.jar file to
-upload to the Traf
<TRUNCATED>
[04/14] incubator-trafodion git commit: Backup checkin. The basic
edit of the guide has been done. Need to change it to refer to trafci
commands to complete.
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
index a2557c9..db287f7 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
@@ -39,7 +39,11 @@ This chapter covers these topics:
* <<calling-spjs-in-trafci, Calling SPJs in trafci>>
* <<calling-spjs-from-an-odbc-client-application, Calling SPJs From an ODBC Client Application>>
* <<calling-spjs-from-a-jdbc-client-application, Calling SPJs From a JDBC Client Application>>
+////
+GTA 20160321: Triggers aren't supported yet. Uncommented as needed.
+
* <<calling-an-spj-in-a-trigger, Calling an SPJ in a Trigger>>
+////
The CALL statement invokes an SPJ in the database. You can issue a CALL
statement from any of these applications or interfaces supported by the
@@ -55,12 +59,14 @@ use a CALL statement in a trigger but not inside a compound statement or
with rowsets. The SPJ that you use in a trigger must not have any OUT or
INOUT parameters or return any result sets.
+[[required-privileges-for-calling-an-spj]]
== Required Privileges for Calling an SPJ
To execute the CALL statement, you must have the EXECUTE privilege on
the procedure. For more information, see
<<grant-privileges, Grant Privileges>>.
+[[transaction-behavior]]
== Transaction Behavior
The stored procedure's transaction attribute determines whether it
@@ -78,40 +84,45 @@ stored procedure to manage its own transactions, you should set the stored
procedure's transaction attribute to NO TRANSACTION REQUIRED.
See <<no-transaction-required>>.
+[[transaction-required]]
=== Transaction Required
If you want the SPJ method to inherit the transaction from the calling
application, set the stored procedure's transaction attribute to
TRANSACTION REQUIRED (the default setting) when creating the stored
procedure. For more information, see the Transaction Required attribute
-in link:#_bookmark116["Create a]
-link:#_bookmark116[Procedure" (page 37)]. When a stored procedure's
+in <<create-a-procedure, Create a Procedure>>. When a stored procedure's
transaction attribute is TRANSACTION REQUIRED, a CALL statement
automatically initiates a transaction if there is no active transaction.
+[[using-transaction-control-statements-or-methods]]
==== Using Transaction Control Statements or Methods
If you select Yes for the Transaction Required attribute when creating a
-stored procedure, you should not use transaction control statements (or
+stored procedure, then you should not use transaction control statements (or
equivalent JDBC transaction methods) in the SPJ method. Transaction
control statements include COMMIT WORK and ROLLBACK WORK, and the
-equivalent JDBC transaction methods are Connection.commit() and
-Connection.rollback(). If you try to use transaction control statements
-or methods in an SPJ method when the stored procedure's transaction
-attribute is set to TRANSACTION REQUIRED, the transaction control
-statements or methods in the SPJ method are ignored, and the Java
-virtual machine (JVM) does not report any errors or warnings. When the
-stored procedure's transaction attribute is set to TRANSACTION REQUIRED,
-you should rely on the transaction control statements or methods in the
+equivalent JDBC transaction methods are `Connection.commit()` and
+`Connection.rollback()`.
+
+If you try to use transaction control statements or methods in an SPJ method
+when the stored procedure's transaction attribute is set to TRANSACTION REQUIRED,
+then the transaction control statements or methods in the SPJ method are ignored
+and the Java virtual machine (JVM) does not report any errors or warnings.
+
+When the stored procedure's transaction attribute is set to TRANSACTION REQUIRED,
+then you should rely on the transaction control statements or methods in the
application that calls the stored procedure and allow the calling
application to manage the transactions.
+[[committing-or-rolling-back-a-transaction]]
===== Committing or Rolling Back a Transaction
If you do not use transaction control statements in the calling
-application, the transaction initiated by the CALL statement might not
-automatically commit or roll back changes to the database. When
-AUTOCOMMIT is ON (the default setting), the database engine
+application, then the transaction initiated by the CALL statement might not
+automatically commit or roll back changes to the database.
+
+When AUTOCOMMIT is ON (the default setting), then the database engine
automatically commits or rolls back any changes made to the database at
the end of the CALL statement execution. However, when AUTOCOMMIT is
OFF, the current transaction remains active until the end of the client
@@ -121,8 +132,10 @@ To ensure an atomic unit of work when calling an SPJ, use the COMMIT
WORK statement in the calling application to commit the transaction when
the CALL statement succeeds, and use the ROLLBACK WORK statement to roll
back the transaction when the CALL statement fails. For more information
-about transaction management, see the __Trafodion SQL Reference Manual__.
+about transaction management, see the
+http://trafodion.incubator.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+[[no-transaction-required]]
=== No Transaction Required
In some cases, you might not want the SPJ method to inherit the
@@ -135,53 +148,59 @@ useful in these cases:
multiple DDL or table maintenance operations, on the database. In this
case, you might want to commit those operations periodically from within
the SPJ method to avoid locking tables for a long time.
+
* The stored procedure performs certain SQL operations that must run
without an active transaction. For example, INSERT, UPDATE, and DELETE
statements with the WITH NO ROLLBACK option are rejected when a
transaction is already active, as is the case when a stored procedure
inherits a transaction from the calling application. The PURGEDATA
utility is also rejected when a transaction is already active.
+
* The stored procedure does not access the database. (For an example,
-see the link:#_bookmark250["TOTALPRICE] link:#_bookmark250[Procedure"
-(page 73)].) In this case, the stored procedure does not need to inherit
-the transaction from the calling application. By setting the stored
-procedure's transaction attribute to NO TRANSACTION REQUIRED, you can
-avoid the overhead of the calling application's transaction being
-propagated to the stored procedure.
+see the <<totalprice-procedure, TOTALPRICE Procedure>>.) In this case,
+the stored procedure does not need to inherit the transaction from the
+calling application. By setting the stored procedure's transaction
+attribute to NO TRANSACTION REQUIRED, you can avoid the overhead of
+the calling application's transaction being propagated to the stored
+procedure.
In these cases, you should set the stored procedure's transaction
attribute to NO TRANSACTION REQUIRED when creating the stored procedure.
For more information, see the Transaction Required attribute in
-link:#_bookmark116["Create a Procedure" (page 37)].
+<<create-a-procedure, Create a Procedure>>.
If you select No for the Transaction Required attribute when creating a
stored procedure and if the SPJ method creates a JDBC default
-connection, that connection will have autocommit enabled by default. You
+connection, then that connection has autocommit enabled by default. You
can either use the autocommit transactions or disable autocommit
-(conn.setAutoCommit(false);) and use the JDBC transaction methods,
-Connection.commit() and Connection.rollback(), to commit or roll back
+(`conn.setAutoCommit(false);`) and use the JDBC transaction methods,
+`Connection.commit()` and `Connection.rollback()`, to commit or roll back
work where needed.
+[[multithreading]]
== Multithreading
The Trafodion database engine manages a single thread of execution within
an SPJ environment, even if the application that issues a CALL statement
-is a multithreaded Java application. The CALL statements in a
-multithreaded application can execute in a nonblocking manner, but the
-SPJ methods underlying those CALL statements execute serially within a
+is a multithreaded Java application.
+
+The CALL statements in a multithreaded application can execute in a nonblocking manner,
+but the SPJ methods underlying those CALL statements execute serially within a
given SPJ environment.
+[[using-the-call-statement]]
== Using the CALL Statement
To invoke a stored procedure, specify the name of the stored procedure
-and its arguments in a CALL statement, as shown in
-link:#_bookmark167[Figure 2]:
+and its arguments in a CALL statement, as shown in the figure below.
-image:media/image8.png[image]Figure 2 CALL Statement Elements
+.CALL Statement Elements
+image:{images}/call-statement-elements.jpg[CALL Statement Elements]
-For the syntax of the CALL statement, see the __Trafodion SQL Reference
-Manual__.
+For the syntax of the CALL statement, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#call_statement[Trafodion SQL Reference Manual].
+[[specifying-the-name-of-the-spj]]
=== Specifying the Name of the SPJ
In the CALL statement, specify the name of an SPJ that you have already
@@ -189,22 +208,25 @@ created in the database. Qualify the procedure name with the same
catalog and schema that you specified when you registered the SPJ. For
example:
-```
-CALL demo.persnl.adjustsalary(202, 5.5, ?);
-```
+[source, sql]
+----
+CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
+----
Or, for example:
-```
-SET SCHEMA demo.persnl;
+[source, sql]
+----
+SET SCHEMA demo.persnl ;
-CALL adjustsalary(202, 5.5, ?);
-```
+CALL adjustsalary( 202, 5.5, ? ) ;
+----
-If you do not fully qualify the procedure name, the database engine
+If you do not fully qualify the procedure name, then the database engine
qualifies the procedure according to the catalog and schema of the
current session.
+[[listing-the-parameter-arguments-of-the-spj]]
=== Listing the Parameter Arguments of the SPJ
Each argument that you list in the CALL statement must correspond to an
@@ -213,20 +235,22 @@ method does not correspond to an SQL parameter. Do not specify result
sets in the argument list.
For example, if you registered the stored procedure with three SQL
-parameters (two IN parameters and one OUT parameter), you must list
-three formal parameter arguments, separated by commas, in the CALL
-statement:
+parameters (two IN parameters and one OUT parameter), then you must
+list three formal parameter arguments, separated by commas, in the
+CALL statement:
-```
-CALL demo.persnl.adjustsalary(202, 5, ?);
-```
+[source, sql]
+----
+CALL demo.persnl.adjustsalary( 202, 5, ? ) ;
+----
If the SPJ does not accept arguments, you must specify empty
parentheses, as shown below:
-```
-CALL demo.sales.lowerprice();
-```
+[source, sql]
+----
+CALL demo.sales.lowerprice() ;
+----
If the SPJ has one IN parameter, one OUT parameter, and two result sets,
you must list the IN and OUT parameters but not the result sets in the
@@ -236,111 +260,98 @@ argument list:
CALL demo.sales.ordersummary('01-01-2011', ?);
```
+[[data-conversion-of-parameter-arguments]]
==== Data Conversion of Parameter Arguments
The database engine performs an implicit data conversion when the data
type of a parameter argument is compatible with but does not match the
-formal data type of the stored procedure. For stored procedure input
-values, the conversion is from the actual argument value to the formal
-parameter type. For stored procedure output values, the conversion is
-from the actual output value, which has the data type of the formal
-parameter, to the declared type of the dynamic parameter.
+formal data type of the stored procedure.
+
+For stored procedure input values, the conversion is from the actual
+argument value to the formal parameter type.
+For stored procedure output values, the conversion is from the actual
+output value, which has the data type of the formal parameter, to the
+declared type of the dynamic parameter.
+
+[[input-parameter-arguments]]
==== Input Parameter Arguments
To pass data to an IN or INOUT parameter of an SPJ, specify an SQL value
expression that evaluates to a character, date-time, or numeric value.
The SQL value expression can evaluate to NULL provided that the
underlying Java parameter supports null values. For more information,
-see link:#_bookmark58["Null Input and Output" (page 22)].
+see <<null-input-and-output, Null Input and Output>>.
For an IN parameter argument, use one of these SQL value expressions in
-link:#_bookmark175[Table 2]:
-
-Table 2 Input Parameter Argument Types
-
-Type of Argument Examples
-
-Literal
-
-CALL adjustsalary(**202**, 5.5, ?);
-
-CALL dailyorders(**DATE '2011-03-19**', ?); CALL totalprice(23,
-*'nextday'* , ?param);
-
-SQL function (including CASE and CAST expressions)
-
-CALL dailyorders(**CURRENT_DATE**, ?);
-
-Arithmetic expression CALL adjustsalary(202, **?percent * 0.25**, :OUT
-newsalary);
-
-Concatenation operation
-
-CALL totalprice(23, **'next' || 'day'**, ?param);
-
-Scalar subquery
-
-Dynamic parameter
-
-CALL totalprice(**(SELECT qty_ordered**
-
-*FROM odetail*
-
-**WHERE ordernum = 100210 AND partnum = 5100)**,
-
-'nextday', ?param);
-
-CALL adjustsalary(**?**, ?, ?);
-
-CALL adjustsalary(**?param1**, ?param2, ?param3);
-
-For more information about SQL value expressions, see the __Trafodion SQL
-Reference Manual__.
+that table below:
+
+[[table-2]]
+.Input Parameter Argument Types
+[cols="30%,70%", options="header"]
+|===
+| Type of Argument | Examples
+| Literal |
+`CALL adjustsalary( *202*, 5.5, ? ) ;` +
+`CALL dailyorders( *DATE '2011-03-19'*, ? )` ; +
+`CALL totalprice(23, *'nextday'* , ?param ) ;`
+| SQL function (including CASE and CAST expressions) |
+`CALL dailyorders( *CURRENT_DATE*, ? ) ;`
+| Arithmetic expression |
+`CALL adjustsalary( 202, *?percent \* 0.25*, :OUT newsalary ) ;`
+| Concatenation operation |
+`CALL totalprice( 23, *'next' \|\| 'day'*, ?param ) ;`
+| Scalar subquery |
+`CALL totalprice ( ( SELECT qty_ordered FROM odetail WHERE ordernum = 100210 AND partnum = 5100 ) , 'nextday', ?param ) ;`
+| Dynamic parameter |
+`CALL adjustsalary( *?*, ?, ?) ;` +
+`CALL adjustsalary( *?param1*, ?param2, ?param3 ) ;`
+|===
+
+For more information about SQL value expressions, see the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
Because an INOUT parameter passes a single value to and accepts a single
value from an SPJ, you can specify only dynamic parameters for INOUT
parameter arguments in a CALL statement.
+[[output-parameter-arguments]]
==== Output Parameter Arguments
Except for result sets, an SPJ returns values in OUT and INOUT
parameters. Each OUT or INOUT parameter accepts only one value from an
SPJ. Any attempt to return more than one value to an output parameter
-results in a Java exception. See link:#_bookmark48["Returning Output
-Values From the Java Method"] link:#_bookmark48[(page 19)].
+results in a Java exception. See
+<<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>.
OUT and INOUT parameter arguments must be dynamic parameters in a client
-application (for example, ?) or named or unnamed parameters in trafci
-(for example, ?param or ?).
+application (for example, `?`) or named or unnamed parameters in trafci
+(for example, `?param` or `?`).
For information about how to call SPJs in different applications, see:
-* link:#_bookmark188["Calling SPJs in trafci" (page 53)]
-* link:#_bookmark196["Calling SPJs From an ODBC Client Application"
-(page 54)]
-* link:#_bookmark200["Calling SPJs From a JDBC Client Application" (page
-56)]
+* <<calling-spjs-in-trafci, Calling SPJs in trafci>>
+* <<calling-spjs-from-an-odbc-client-application, Calling SPJs From an ODBC Client Application>>
+* <<calling-spjs-from-a-jdbc-client-application, Calling SPJs From a JDBC Client Application>>
+[[result-sets]]
==== Result Sets
Result sets are an ordered set of open cursors that the SPJ method
-returns to the calling application in java.sql.ResultSet[] parameter
-arrays. The java.sql.ResultSet[] parameters do not correspond to SQL
+returns to the calling application in `java.sql.ResultSet[]` parameter
+arrays. The `java.sql.ResultSet[]` parameters do not correspond to SQL
parameters, so you must not include them in the parameter argument list
of a CALL statement.
The calling application can retrieve multiple rows of data from the
-java.sql.ResultSet[]
-parameters. For information about how to process result sets in
-different applications, see:
+`java.sql.ResultSet[]` parameters. For information about how to process
+result sets in different applications, see:
-* link:#_bookmark194["Returning Result Sets in trafci" (page 54)]
-* link:#_bookmark198["Returning Result Sets in an ODBC Client
-Application" (page 55)]
-* link:#_bookmark204["Returning Result Sets in a JDBC Client
-Application" (page 56)]
+* <<returning-result-sets-in-trafci, Returning Result Sets in trafci>>
+* <<returning-result-sets-in-an-odbc-client, Returning Result Sets in an ODBC Client>>
+* <<returning-result-sets-in-a-jdbc-client, Returning Result Sets in a JDBC Client>>
+[[calling-spjs-in-trafci]]
== Calling SPJs in trafci
In trafci, you can invoke an SPJ by issuing a CALL statement directly or
@@ -356,26 +367,29 @@ displays all output parameter values and result sets after you issue the
CALL statement. The procedure call changes the value of a named
parameter that you use as an OUT or INOUT parameter.
-For more information about named and unnamed parameters, see the _HP
-Database Command_ __Interface (trafci) Guide__.
+For more information about named and unnamed parameters, see the
+http://trafodion.incubator.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide].
+[[using-named-parameters]]
=== Using Named Parameters
In an trafci session, invoke the SPJ named TOTALPRICE, which has two IN
-parameters and one INOUT parameter. This SPJ accepts the quantity,
-shipping speed, and price of an item, calculates the total price,
-including tax and shipping charges, and returns the total price. For
-more information, see the link:#_bookmark250["TOTALPRICE Procedure"
-(page 73)].
+parameters and one INOUT parameter.
+
+This SPJ accepts the quantity, shipping speed, and price of an item,
+calculates the total price, including tax and shipping charges, and
+returns the total price. For more information, see the
+<<totalprice-procedure, TOTALPRICE Procedure>>.
Set the input value for the INOUT parameter by entering a SET PARAM
command before calling the SPJ:
-```
-SQL>**set param ?p 10;**
+[source, sql]
+----
+SQL> SET PARAM ?p 10 ;
-SQL>**call demo.sales.totalprice(23, 'standard', ?p);**
-```
+SQL> CALL demo.sales.totalprice( 23, 'standard', ?p ) ;
+----
The CALL statement returns the total price of the item:
@@ -390,12 +404,14 @@ p
The value of the named parameter, ?p, changes from 10 to the returned
value, 253.97:
-```
-SQL>**show param**
+[source, sql]
+----
+SQL> SHOW PARAM
p 253.97
-```
+----
+[[using-unnamed-parameters]]
=== Using Unnamed Parameters
In an trafci session, invoke the SPJ named TOTALPRICE by preparing and
@@ -403,13 +419,14 @@ executing a CALL statement. The INOUT parameter accepts a value that is
set by the USING clause of the EXECUTE statement and returns the total
price:
-```
-SQL>**prepare stmt1 from call demo.sales.totalprice(50, 'nextday',?);**
+[source, sql]
+----
+SQL> PREPARE stmt1 FROM CALL demo.sales.totalprice( 50, 'nextday', ? ) ;
--- SQL command prepared.
-SQL>**execute stmt1 using 2.25;**
-```
+SQL> EXECUTE stmt1 USING 2.25 ;
+----
The output of the prepared CALL statement is:
@@ -426,25 +443,28 @@ and executing a CALL statement in which all three parameters accept
values that are set by the USING clause of the EXECUTE statement. The
INOUT parameter returns the total price:
-```
-SQL>**prepare stmt2 from call demo.sales.totalprice(?,?,?);**
+[source, sql]
+----
+SQL> PREPARE stmt2 FROM CALL demo.sales.totalprice( ?, ?, ? ) ;
--- SQL command prepared.
-SQL>**execute stmt2 using 3, 'economy', 16.99;**
-```
+SQL> EXECUTE stmt2 USING 3, 'economy', 16.99 ;
+----
The output of the prepared CALL statement is:
-```
+[source, sql]
+----
PRICE
--------------------
57.13
--- SQL operation complete.
-```
+----
+[[returning-result-sets-in-trafci]]
=== Returning Result Sets in trafci
If a CALL statement returns result sets, trafci displays column headings
@@ -452,8 +472,10 @@ and data for each returned result set in the same format as SELECT
statements. For example, this CALL statement returns an output parameter
for the number of orders and two result sets in the trafci session:
-```
-SQL>**call demo.sales.ordersummary('01-01-2011', ?);**
+
+[source, sql]
+----
+SQL> CALL demo.sales.ordersummary( '01-01-2011', ? ) ;
NUM_ORDERS
--------------------
@@ -461,195 +483,213 @@ NUM_ORDERS
ORDERNUM NUM_PARTS AMOUNT ORDER_DATE LAST_NAME
-------- -------------------- -------------------- ---------- --------------------
-HUGHES HUGHES SCHNABL
-
-...
+ 100210 4 19020.00 2011-04-10 HUGHES
+ 100250 4 22625.00 2011-01-23 HUGHES
+ 101220 4 45525.00 2011-07-21 SCHNABL
+ ... ... ... ... ...
--- 13 row(s) selected.
ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
-
--------- ------- ---------- ----------- ------------------ 100210 244
-3500.00 3 PC GOLD, 30 MB
-
-100210 2001 1100.00 3 GRAPHIC PRINTER,M1
-
-100210 2403 620.00 6 DAISY PRINTER,T2
-
-... ... ... ... ...
+-------- ------- ---------- ----------- ------------------
+ 100210 244 3500.00 3 PC GOLD, 30 MB
+ 100210 2001 1100.00 3 GRAPHIC PRINTER,M1
+ 100210 2403 620.00 6 DAISY PRINTER,T2
+ ... ... ... ... ...
--- 70 row(s) selected.
--- SQL operation complete.
-```
+----
-For other result set examples, see link:#_bookmark221[Appendix A (page
-62)].
+For other result set examples, see <<sample-spjs, Appendix A: Sample SPJs>>.
+[[calling-spjs-from-an-odbc-client-application]]
== Calling SPJs From an ODBC Client Application
You can execute a CALL statement in an ODBC client application.
Microsoft ODBC requires that you put the CALL statement in an escape
clause:
-```
-{call _procedure-name_ ([__parameter__][,[__parameter__]]...)}
-```
+[source, sql]
+----
+{ CALL procedure-name ( [ parameter ] [ , [ parameter ] ] ... ) }
+----
For IN or INOUT parameters, use a literal or a parameter marker (?). You
cannot use an empty string as an IN or INOUT parameter in the argument
list. If you specify a literal for an INOUT parameter, the driver
discards the output value.
-For OUT parameters, you can use only a parameter marker (?). You must
-bind all parameter markers with the SQLBindParameter function before you
+For OUT parameters, you can use only a parameter marker (`?`). You must
+bind all parameter markers with the `SQLBindParameter` function before you
can execute the CALL statement.
In this example, a CALL statement is executed from an ODBC client
application:
-```
+[source, cplusplus]
+----
/* Declare variables. */
-SQLHSTMT hstmt; SQL_NUMERIC_STRUCT salary; SDWORD cbParam = SQL_NTS;
+SQLHSTMT hstmt ;
+SQL_NUMERIC_STRUCT salary ;
+SDWORD cbParam = SQL_NTS ;
/* Bind the parameter markers. */
-
-SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_NUMERIC, SQL_NUMERIC, 4, 0, 202, 0, &cbParam);
-
-SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, 0, 0, 5.5, 0, &cbParam);
-
-SQLBindParameter(hstmt, 3, SQL_PARAM_OUTPUT, SQL_C_NUMERIC, SQL_NUMERIC, 8, 2, &salary, 0, &cbParam);
+SQLBindParameter( hstmt, 1, SQL_PARAM_INPUT, SQL_C_NUMERIC, SQL_NUMERIC, 4, 0, 202, 0, &cbParam ) ;
+SQLBindParameter( hstmt, 2, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, 0, 0, 5.5, 0, &cbParam ) ;
+SQLBindParameter( hstmt, 3, SQL_PARAM_OUTPUT, SQL_C_NUMERIC, SQL_NUMERIC, 8, 2, &salary, 0, &cbParam ) ;
/* Execute the CALL statement. */
+SQLExecDirect( hstmt, "{ CALL demo.persnl.adjustsalary( ?, ?, ? ) }", SQL_NTS ) ;
+----
-SQLExecDirect(hstmt, "{call demo.persnl.adjustsalary(?,?,?)}", SQL_NTS);
-```
+////
+GTA 20160321: The JDBC T4 manual does not exist yet. Enable this line
+once written.
-For more information about ODBC client applications, see the __Neoview
-ODBC Drivers Manual__.
+For more information about the ODBC client applications,
+see the
+http://trafodion.incubator.apache.org/docs/odbc_reference/index.html[Trafodion ODBC Driver Programmer's Reference].
+////
+
+[[returning-result-sets-in-an-odbc-client-application]]
=== Returning Result Sets in an ODBC Client Application
This example shows how an ODBC client application processes the result
-sets returned by a CALL statement. The SQLMoreResults() function closes
+sets returned by a CALL statement. The `SQLMoreResults()` function closes
the current result set and moves processing to the next available result
set.
-NOTE: The HP ODBC API does not currently support interleaved result set
+NOTE: The Trafodion ODBC API does not currently support interleaved result set
processing, where more than one returned result set can be open at a
time.
-```
+[source, cplusplus]
+----
/* Allocate a statement handle */
-SQLHSTMT s;
+SQLHSTMT s ;
-RETCODE rc = SQLAllocHandle(SQL_HANDLE_STMT, myConnection, &s);
+RETCODE rc = SQLAllocHandle( SQL_HANDLE_STMT, myConnection, &s ) ;
/* Prepare a CALL */
-char *stmtText = "{call demo.sales.ordersummary('01-01-2011', ?)}";
-rc = SQLPrepare(s, (SQLCHAR *) stmtText, strlen(stmtText));
+char *stmtText = "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) } ";
+rc = SQLPrepare( s, (SQLCHAR *) stmtText, strlen( stmtText ) ) ;
/* Bind the output parameter */
-_int64 num_orders = 0; SQLINTEGER indicator;
-
-rc = SQLBindParameter(s, 2, SQL_PARAM_OUTPUT, SQL_C_SBIGINT, SQL_BIGINT, 0, 0, &num_orders, 0, &indicator);
+_int64 num_orders = 0 ;
+SQLINTEGER indicator ;
+
+rc = SQLBindParameter( s
+ , 2
+ , SQL_PARAM_OUTPUT
+ , SQL_C_SBIGINT
+ , SQL_BIGINT
+ , 0
+ , 0
+ , &num_orders
+ , 0
+ , &indicator
+ ) ;
/* Execute the CALL */
-rc = SQLExecute(s);
+rc = SQLExecute( s ) ;
/* Process all returned result sets. The outer while loop repeats */
-
/* until there are no more result sets. */
-while ((rc = SQLMoreResults(s)) != SQL_NO_DATA)
+while ( ( rc = SQLMoreResults( s ) ) != SQL_NO_DATA )
{
/* The inner while loop processes each row of the current result set */
- while (SQL_SUCCEEDED(rc = SQLFetch(hStmt)))
+ while ( SQL_SUCCEEDED( rc = SQLFetch( hStmt ) ) )
{
/* Process the row */
}
}
+----
+[[calling-spjs-from-a-jdbc-client-application]]
== Calling SPJs From a JDBC Client Application
You can execute a CALL statement in a JDBC client application by using
the JDBC CallableStatement interface. The HP JDBC Type 4 driver requires
that you put the CALL statement in an escape clause:
-```
-{call _procedure-name_ ([__parameter__[{, __parameter__}...]])}
-```
+[source, sql]
+----
+{ CALL procedure-name ( [ parameter [ { , parameter } ... ] ] ) }
+----
-Set input values for IN and INOUT parameters by using the set__type__()
-methods of the CallableStatement interface.
+Set input values for IN and INOUT parameters by using the `set_type()`
+methods of the `CallableStatement` interface.
Retrieve output values from OUT and INOUT parameters by using the
-get__type__() methods of the CallableStatement interface.
+`get_type()` methods of the `CallableStatement` interface.
-If the parameter mode is OUT or INOUT, you must register the parameter
-as an output parameter by using the registerOutParameter() method of the
-CallableStatement interface before executing the CALL statement.
+If the parameter mode is OUT or INOUT, then you must register the parameter
+as an output parameter by using the `registerOutParameter()` method of the
+`CallableStatement` interface before executing the CALL statement.
In this example, a CALL statement is executed from a JDBC client application:
-```
+[source, java]
+----
CallableStatement stmt =
+ con.prepareCall( "{ CALL demo.persnl.adjustsalary( ?, ?, ? ) }" ) ;
-con.prepareCall("{call demo.persnl.adjustsalary(?,?,?)}");
+stmt.setBigDecimal( 1, 202 ) ; // x = 202
+stmt.setDouble( 2, 5.5 ) ; // y = 5.5
+stmt.registerOutParameter( 3, java.sql.Types.NUMERIC ) ;
+stmt.execute() ;
-stmt.setBigDecimal(1,202); // x = 202 stmt.setDouble(2,5.5); // y = 5.5
-stmt.registerOutParameter(3, java.sql.Types.NUMERIC);
+BigDecimal z = stmt.getBigDecimal( 3 ) ; // Retrieve the value of the OUT parameter
+----
-stmt.execute();
+////
+GTA 20160321: The JDBC T4 manual does not exist yet. Enable this line
+once written.
-BigDecimal z = stmt.getBigDecimal(3); // Retrieve the value of the
-// OUT parameter
-```
-For more information about the HP JDBC Type 4 driver and mappings of SQL
-to JDBC data types, see the __Neoview JDBC Type 4 Driver Programmer's
-Reference__.
+For more information about the Trafodion JDBC Type 4 driver and mappings of SQL to JDBC data types,
+see the
+http://trafodion.incubator.apache.org/docs/jdbct4_reference/index.html[Trafodion JDBC Type 4 Driver Programmer's Reference].
+////
+
+[[returning-result-sets-in-a-jdbc-client-application]]
=== Returning Result Sets in a JDBC Client Application
This example shows serial result set processing in a JDBC client
application where the result sets are processed in order and one at a
time after the CALL statement executes. The
-java.sql.Statement.getMoreResults() method closes the current result set
+`java.sql.Statement.getMoreResults()` method closes the current result set
and moves processing to the next available result set.
-```
+[source, java]
+----
// Prepare a CALL statement
+java.sql.CallableStatement s =
+ myConnection.prepareCall( "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) }" ) ;
-java.sql.CallableStatement s = myConnection.prepareCall ( "{call
-demo.sales.ordersummary('01-01-2011', ?)}" );
-
-// Register an output parameter s.registerOutParameter(1,
-java.sql.Types.BIGINT);
+// Register an output parameter
+s.registerOutParameter( 1, java.sql.Types.BIGINT ) ;
// Execute the CALL
-
-boolean rsAvailable = s.execute();
+boolean rsAvailable = s.execute() ;
// Process all returned result sets. The outer while loop continues
-
-// until there are no more result sets. while (rsAvailable)
-
+// until there are no more result sets.
+while ( rsAvailable )
{
-
-// The inner while loop processes each row of the current result set
-java.sql.ResultSet rs = s.getResultSet();
-
-while (rs.next())
-
-{
-
-// Process the row
-
-}
-
-rsAvailable = s.getMoreResults();
-
+ // The inner while loop processes each row of the current result set
+ java.sql.ResultSet rs = s.getResultSet() ;
+ while ( rs.next() )
+ {
+ // Process the row
+ }
+
+ rsAvailable = s.getMoreResults() ;
}
-```
+----
This example shows how a JDBC client application can have more than one
stored procedure result set open at a given time. The
@@ -658,73 +698,72 @@ uses its input argument to decide whether currently open result sets
should remain open or be closed before the next result set is made
available.
-```
+[source, java]
+----
// Prepare a CALL statement
+java.sql.CallableStatement s =
+ myConnection.prepareCall ( "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) }" ) ;
-java.sql.CallableStatement s = myConnection.prepareCall ( "{call
-demo.sales.ordersummary('01-01-2011', ?)}" );
+// Register an output parameter
+s.registerOutParameter( 1, java.sql.Types.BIGINT ) ;
-// Register an output parameter s.registerOutParameter(1,
-java.sql.Types.BIGINT);
-
-// Execute the CALL s.execute();
+// Execute the CALL
+s.execute() ;
-// Open the FIRST result set java.sql.ResultSet firstRS =
-s.getResultSet();
+// Open the FIRST result set
+java.sql.ResultSet firstRS = s.getResultSet() ;
// Open the SECOND result set but do not close the FIRST
-s.getMoreResults(java.sql.Statement.KEEP_CURRENT_RESULT);
-java.sql.ResultSet secondRS = s.getResultSet();
+s.getMoreResults( java.sql.Statement.KEEP_CURRENT_RESULT ) ;
+java.sql.ResultSet secondRS = s.getResultSet() ;
// The outer loop processes each row of the FIRST result set while
-(firstRS.next())
-
+( firstRS.next())
{
-
-// Process a row from the FIRST result set
-// The inner loop processes some number of rows from the SECOND
-// result set. The number depends on data extracted from the
-// current row of the FIRST result set.
-
-for (int i = 0; i < NUM_ROWS_TO_PROCESS; i++)
-
-{
-
-// Process a row from the SECOND result set secondRS.next();
-
+ // Process a row from the FIRST result set
+ // The inner loop processes some number of rows from the SECOND
+ // result set. The number depends on data extracted from the
+ // current row of the FIRST result set.
+ for ( int i = 0 ; i < NUM_ROWS_TO_PROCESS ; i++ )
+ {
+ // Process a row from the SECOND result set
+ secondRS.next() ;
+ }
}
+----
-}
-```
+////
+GTA 20160321: Triggers aren't supported yet. Uncommented as needed.
+[[calling-an-spj-in-a-trigger]]
== Calling an SPJ in a Trigger
A trigger is a mechanism in the database that enables the database
engine to perform certain actions when a specified event occurs. SPJs
are useful as triggered actions because they can help you encapsulate
and enforce rules in the database. For more information about the
-benefits of using SPJs, see link:#_bookmark11["Benefits of SPJs" (page
-11)].
+benefits of using SPJs, see <<benefits-of-spjs, Benefits of SPJs>>
Trafodion SQL supports a CALL statement in a trigger provided that the
SPJ in the CALL statement does not have any OUT or INOUT parameters or
return any result sets. For more information, see
-link:#_bookmark48["Returning Output Values From the Java Method" (page
-19)], link:#_bookmark183["Output Parameter Arguments"]
-link:#_bookmark183[(page 52)], or link:#_bookmark54["Returning Stored
-Procedure Result Sets" (page 20)].
+<<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>,
+<<output-parameter-arguments, Output Parameter Arguments>>, or
+<<returning-stored-procedure-result-sets, Returning Stored Procedure Result Sets>>.
This example creates a trigger that executes an SPJ named LOWERPRICE
when the QTY_ON_HAND column of the PARTLOC table is updated and exceeds
500 parts:
-```
+[source, sql]
+----
CREATE TRIGGER demo.sales.setsalesprice AFTER UPDATE OF qty_on_hand
-ON demo.invent.partloc FOR EACH STATEMENT
-REFERENCING NEW as newqty
-WHEN ( SUM(newqty.qty_on_hand) > 500 ) CALL demo.sales.lowerprice();
-```
-
-For information about the CREATE TRIGGER syntax, see the __Trafodion SQL
-Reference Manual__.
-
+ON demo.invent.partloc
+FOR EACH STATEMENT REFERENCING NEW as newqty
+ WHEN ( SUM( newqty.qty_on_hand ) > 500 )
+ CALL demo.sales.lowerprice() ;
+----
+
+For information about the CREATE TRIGGER syntax, see the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+////
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
index 9ff668c..ac76226 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
@@ -21,7 +21,7 @@
////
[[grant-privileges]]
-== Grant Privileges
+= Grant Privileges
Security for SPJs is implemented by schema ownership rules and by
granting privileges to specified database users and roles.
@@ -33,47 +33,40 @@ automatically has these privileges:
* Ability to create and drop SPJs in the schema. You can create SPJs in
the schema provided that you also have the CREATE_PROCEDURE privilege
-for the SQL_OPERATIONS component. For more information, see the
-component privileges in the _HP Database Manager (HPDM) User Guide_ or
-the online help in HPDM
+for the SQL_OPERATIONS component.
* EXECUTE and WITH GRANT OPTION privileges on the SPJs in the schema
To create or drop an SPJ in a schema, you must be the schema owner or
have the appropriate create or drop privileges for the schema. For more
-information, see link:#_bookmark114["Required Privileges for Creating]
-link:#_bookmark114[or Dropping an SPJ" (page 37)]. To invoke an SPJ, you
-must have the EXECUTE privilege on the SPJ. The EXECUTE privilege allows
-a user to invoke an SPJ by issuing a CALL statement. The WITH GRANT
+information, see
+<<required-privileges-for-creating-or-dropping-an-spj, Required Privileges for Creating or Dropping an SPJ>>.
+
+You must have the EXECUTE privilege on the SPJ to it. The EXECUTE privilege
+allows a user to invoke an SPJ by issuing a CALL statement. The WITH GRANT
OPTION privilege allows a user to grant the EXECUTE and WITH GRANT
OPTION privileges to other users and roles. For more information, see:
-* link:#_bookmark141["Granting Execute Privileges on an SPJ" (page 45)]
-* link:#_bookmark143["Granting Privileges on Referenced Database
-Objects" (page 46)]
-* link:#_bookmark145["Revoking Execute Privileges on an SPJ" (page 47)]
-* link:#_bookmark147["Using Script Files to Grant and Revoke Privileges"
-(page 47)]
+* <<granting-execute-privileges-on-an-spj, Granting Execute Privileges on an SPJ>>
+* <<granting-privileges-on-referenced-database-objects, Granting Privileges on Referenced Database Objects>>
+* <<revoking-execute-privileges-on-an-spj, Revoking Execute Privileges on an SPJ>>
+* <<using-script-files-to-grant-and-revoke-privileges, Using Script Files to Grant and Revoke Privileges>>
To display the current ownership and privileges, see
-link:#bookmark130["Display Procedures and Their Properties"]
-link:#bookmark130[(page 42)].
-
-NOTE: You can also grant or revoke the EXECUTE privilege on an SPJ by
-using the Grant/Revoke Privileges Tool in HPDM. For more information,
-see the _HP Database Manager (HPDM) User Guide_ or the online help in
-HPDM.
+<<display-procedures-and-their-properties, Display Procedures and Their Properties>>.
+[[granting-execute-privileges-on-an-spj]]
== Granting Execute Privileges on an SPJ
Use the GRANT PROCEDURE or GRANT statement to assign the EXECUTE and
WITH GRANT OPTION privileges on an SPJ to specific database users and
roles. In a GRANT statement, specify ALL PRIVILEGES to grant the EXECUTE
privilege on an SPJ. For the syntax of the GRANT PROCEDURE and GRANT
-statements, see the __Trafodion SQL Reference Manual__.
+statements, see the
+http://trafodion.incubator.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
-If you own the SPJ, you can grant the EXECUTE and WITH GRANT OPTION
+If you own the SPJ, then you can grant the EXECUTE and WITH GRANT OPTION
privileges on the SPJ to any database user or role. If you are not the
-owner of the SPJ, you must have been granted the EXECUTE and WITH GRANT
+owner of the SPJ, then you must have been granted the EXECUTE and WITH GRANT
OPTION privileges on the SPJ to grant privileges to other database users
and roles, or you must be associated with a role that has the EXECUTE
and WITH GRANT OPTION privileges on the SPJ.
@@ -82,62 +75,69 @@ As the owner of an SPJ, you can selectively grant the EXECUTE and WITH
GRANT OPTION privileges to specified database users and roles. For some
SPJs, particularly ones that handle sensitive information or modify
data, you should grant the EXECUTE and WITH GRANT OPTION privileges to a
-restricted group of users or roles. For example, the SPJ named
-ADJUSTSALARY changes an employee's salary in the database. Therefore,
-only specific users or roles should be allowed to invoke this SPJ. In
-this example, the SPJ owner (or creator) grants the EXECUTE and WITH
-GRANT OPTION privileges on ADJUSTSALARY to the Payroll directors.
+restricted group of users or roles.
-```
-GRANT EXECUTE
+For example, the SPJ named ADJUSTSALARY changes an employee's salary in the
+database. Therefore, only specific users or roles should be allowed to invoke
+this SPJ. In this example, the SPJ owner (or creator) grants the EXECUTE and
+WITH GRANT OPTION privileges on ADJUSTSALARY to the Payroll directors.
+[source, sql]
+----
+GRANT EXECUTE
ON PROCEDURE demo.persnl.adjustsalary
-
-TO "payrolldir1", "payrolldir2" WITH GRANT OPTION;
-```
+TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
+----
One of the Payroll directors grants the EXECUTE privilege on
ADJUSTSALARY to the regional department managers:
-```
+[source, sql]
+----
GRANT EXECUTE
ON PROCEDURE demo.persnl.adjustsalary TO "rgn1mgr", "rgn2mgr", "rgn3mgr"
-WITH GRANT OPTION;
-```
+WITH GRANT OPTION ;
+----
In some cases, all users of a database system might need to invoke an
-SPJ. For example, the SPJ named TOTALPRICE calculates the total price of
+SPJ.
+
+For example, the SPJ named TOTALPRICE calculates the total price of
an item, including tax and shipping charges. This SPJ does not handle
sensitive information or modify data and might be useful to customers or
-anyone within the company. Therefore, the SPJ owner (or creator) grants
-the EXECUTE privilege on TOTALPRICE to PUBLIC, meaning all present and
-future database users and roles:
+anyone within the company.
-```
+Therefore, the SPJ owner (or creator) grants the EXECUTE privilege on
+TOTALPRICE to PUBLIC, meaning all present and future database users and roles:
+
+[source, sql]
+----
GRANT EXECUTE
-ON PROCEDURE demo.sales.totalprice TO PUBLIC;
-```
+ON PROCEDURE demo.sales.totalprice TO PUBLIC ;
+----
After granting the EXECUTE privilege to PUBLIC, you cannot revoke the
privilege from a subset of database users or roles. You must revoke the
privilege from PUBLIC and then grant the privilege to specific database
users and roles.
+[[granting-privileges-on-referenced-database-objects]]
== Granting Privileges on Referenced Database Objects
If the SPJ operates on a database object and the SPJ has been created
with the external security specified as invoker (EXTERNAL SECURITY
-INVOKER), the database users that invoke the SPJ must have the
-appropriate privileges on that database object. If the SPJ has been
-created with the external security specified as definer (EXTERNAL
-SECURITY DEFINER), users other than the procedure's creator may invoke
+INVOKER), then the database users that invoke the SPJ must have the
+appropriate privileges on that database object.
+
+If the SPJ has been created with the external security specified as definer (EXTERNAL
+SECURITY DEFINER), then users other than the procedure's creator may invoke
the SPJ without needing privileges on the underlying database objects.
+
When the SPJ's external security is definer, users execute, or invoke,
the stored procedure using the privileges of the user who created the
stored procedure. The user who creates the stored procedure must have
the appropriate privileges on the underlying database objects. For more
-information, see link:#_bookmark124["Understand External Security" (page
-41)].
+information, see <<understand-external-security, Understand External Security>>.
For example, users with the EXECUTE privilege on the SPJ named
ADJUSTSALARY, which is defined with EXTERNAL SECURITY INVOKER and which
@@ -145,20 +145,22 @@ selects data from and updates the EMPLOYEE table, must have the SELECT
and UPDATE privileges on that SQL table. The SPJ owner (or creator)
grants these access privileges to the Payroll directors:
-```
+[source, sql]
+----
GRANT SELECT, UPDATE (salary)
ON TABLE demo.persnl.employee
-TO "payrolldir1", "payrolldir2" WITH GRANT OPTION;
-```
+TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
+----
One of the Payroll directors then grants these access privileges to the
regional department managers:
-```
+[source, sql]
+----
GRANT SELECT, UPDATE (salary)
ON TABLE demo.persnl.employee
-TO "rgn1mgr", "rgn2mgr", "rgn3mgr";
-```
+TO "rgn1mgr", "rgn2mgr", "rgn3mgr" ;
+----
Users with the EXECUTE privilege on the SPJ named TOTALPRICE, which does
not access the database, are not required to have privileges on any
@@ -168,74 +170,89 @@ The types of SQL statements in the underlying SPJ method, such as
SELECT, UPDATE, DELETE, and INSERT, indicate which types of privileges
are required for the referenced database objects.
-For the syntax of the GRANT statement, see the __Trafodion SQL Reference
-Manual__.
+For the syntax of the GRANT statement, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+[[revoking-execute-privileges-on-an-spj]]
== Revoking Execute Privileges on an SPJ
Use the REVOKE PROCEDURE or REVOKE statement to remove the EXECUTE or
WITH GRANT OPTION privilege on an SPJ from specific database users or
roles. In a REVOKE statement, specify ALL PRIVILEGES to revoke the
EXECUTE privilege on an SPJ. For the syntax of the REVOKE PROCEDURE and
-REVOKE statements, see the __Trafodion SQL Reference Manual__.
+REVOKE statements, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#revoke_statement[Trafodion SQL Reference Manual].
-If you own the SPJ, you can revoke the EXECUTE and WITH GRANT OPTION
+If you own the SPJ, then you can revoke the EXECUTE and WITH GRANT OPTION
privileges on the SPJ from any database user or role to whom you granted
those privileges or, if you did not directly grant those privileges, on
behalf of the role that granted those privileges, provided that you were
-granted that role. If you are not the owner of the SPJ, you must have
-been granted the EXECUTE and WITH GRANT OPTION privileges on the SPJ to
+granted that role.
+
+If you are not the owner of the SPJ, then you must have been granted the
+EXECUTE and WITH GRANT OPTION privileges on the SPJ to
revoke privileges from other database users or roles, and you can revoke
the privileges only from other users or roles to whom you have granted
those privileges or, if you did not directly grant those privileges, on
behalf of the role that granted those privileges, provided that you were
-granted that role. For example, the payrolldir1 user can revoke the
-EXECUTE privilege on ADJUSTSALARY from one or more regional department
-managers to whom the payrolldir1 user granted those privileges. In this
-example, the payrolldir1 user revokes the EXECUTE privilege from the
+granted that role.
+
+For example, the `payrolldir1` user can revoke the EXECUTE privilege on
+ADJUSTSALARY from one or more regional department managers to whom the
+`payrolldir1` user granted those privileges.
+
+In this example, the `payrolldir1` user revokes the EXECUTE privilege from the
Region 2 department manager:
-```
+[source, sql]
+----
REVOKE EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "rgn2mgr";
-```
+ON PROCEDURE demo.persnl.adjustsalary FROM "rgn2mgr" ;
+----
-The payrolldir1 user cannot revoke the EXECUTE or WITH GRANT OPTION
-privilege from the payrolldir2 user because it was the SPJ owner (or
+The `payrolldir1` user cannot revoke the EXECUTE or WITH GRANT OPTION
+privilege from the `payrolldir2` user because it was the SPJ owner (or
creator) who granted those privileges.
A user can revoke the WITH GRANT OPTION privilege on ADJUSTSALARY from
-any user or role to whom the user granted this privilege. In this
-example, the SPJ owner (or creator) revokes the WITH GRANT OPTION
-privilege from the payrolldir1 user:
+any user or role to whom the user granted this privilege.
-```
+In this example, the SPJ owner (or creator) revokes the WITH GRANT OPTION
+privilege from the `payrolldir1` user:
+
+[source, sql]
+----
REVOKE GRANT OPTION FOR EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1";
-```
+ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1" ;
+----
A user can also revoke the EXECUTE privilege from any user or role to
whom the user granted this privilege and from any dependent privileges
-by using the CASCADE option. In this example, the SPJ owner (or creator)
-revokes the EXECUTE privilege from the payrolldir1 user and from the
-regional department managers to whom the payrolldir1 user granted
-privileges:
+by using the CASCADE option.
-```
+In this example, the SPJ owner (or creator) revokes the EXECUTE privilege
+from the `payrolldir1` user and from the regional department managers to
+whom the `payrolldir1` user granted privileges:
+
+[source, sql]
+----
REVOKE GRANT OPTION FOR EXECUTE
ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1"
-CASCADE;
-```
+CASCADE ;
+----
For SPJs on which all users (that is, PUBLIC) have privileges, you can
revoke privileges from PUBLIC but not from one or more specific users or
-roles. For example, this statement revokes the EXECUTE privilege on the
+roles.
+
+For example, this statement revokes the EXECUTE privilege on the
SPJ named TOTALPRICE from all users and roles (that is, PUBLIC):
-```
+[source, sql]
+----
REVOKE EXECUTE
ON PROCEDURE demo.sales.totalprice FROM PUBLIC;
-```
+----
== Using Script Files to Grant and Revoke Privileges
@@ -246,62 +263,68 @@ as needed.
=== Script File for Granting Privileges
You can use another or the same script file to grant privileges on a
-series of SPJs. For example, the script file, grantprocs.sql, contains a
-series of GRANT PROCEDURE and GRANT statements:
+series of SPJs.
-```
+For example, the script file, `grantprocs.sql`, contains a series of
+GRANT PROCEDURE and GRANT statements:
+
+[source, sql]
+----
?SECTION GrantSalesProcs
GRANT EXECUTE
ON demo.sales.monthlyorders
-TO PUBLIC;
+TO PUBLIC ;
GRANT SELECT
-ON TABLE demo.sales.orders TO PUBLIC;
+ON TABLE demo.sales.orders TO PUBLIC ;
?SECTION GrantPersnlProcs
GRANT EXECUTE
ON PROCEDURE demo.persnl.adjustsalary TO "payrolldir1", "payrolldir2"
-WITH GRANT OPTION;
+WITH GRANT OPTION ;
GRANT SELECT, UPDATE(salary)
ON TABLE demo.persnl.employee
-TO "payrolldir1", "payrolldir2" WITH GRANT OPTION;
-```
+TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
+----
To grant privileges on the SPJs, run the script file in the trafci
interface:
```
-obey c:\grantprocs.sql (GrantSalesProcs)
+OBEY c:\grantprocs.sql (GrantSalesProcs)
```
=== Script File for Revoking Privileges
You can use another or the same script file to revoke privileges on a
-series of SPJs. For example, the script file, revokeprocs.sql, contains
+series of SPJs.
+
+For example, the script file, `revokeprocs.sql`, contains
a series of REVOKE PROCEDURE and REVOKE statements:
-```
+[source, sql]
+----
?SECTION RevokeSalesProcs
REVOKE EXECUTE
-ON PROCEDURE demo.sales.monthlyorders FROM PUBLIC;
+ON PROCEDURE demo.sales.monthlyorders FROM PUBLIC ;
REVOKE SELECT
-ON TABLE demo.sales.orders FROM PUBLIC;
+ON TABLE demo.sales.orders FROM PUBLIC ;
?SECTION RevokePersnlProcs
REVOKE EXECUTE
ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1", "payrolldir2"
-CASCADE;
+CASCADE ;
REVOKE SELECT, UPDATE(salary)
ON TABLE demo.persnl.employee
-FROM "payrolldir1", "payrolldir2" CASCADE;
-```
+FROM "payrolldir1", "payrolldir2" CASCADE ;
+----
To revoke privileges on the SPJs, run the script file in the trafci
interface:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
index a9fbe86..4d12dd3 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
@@ -27,10 +27,9 @@ This chapter describes how to improve and monitor the performance of
SPJs on the Trafodion platform and provides guidelines for
troubleshooting common problems:
-* link:#_bookmark209["Troubleshooting Common Problems"]
-* link:#_bookmark212["Performance Tip"]
-* link:#_bookmark214["Displaying an Execution Plan of a CALL Statement"
-(page 59)]
+* <<troubleshooting-common-problems, Troubleshooting Common Problems>>
+* <<performance-tip, Performance Tip>>
+* <<displaying-an-execution-plan-of-a-call-statement, Displaying an Execution Plan of a CALL Statement>>
[[troubleshooting-common-problems]]
== Troubleshooting Common Problems
@@ -39,66 +38,74 @@ To resolve problems that occur when you register or execute an SPJ,
follow these guidelines:
* Note the SQLCODE or SQLSTATE value of the error messages and locate
-the information in the __Neoview Messages Manual__, which provides
-cause, effect, and recovery information for all SQL errors.
+the information in the
+http://trafodion.apache.org/docs/messages_guide/index.html[[Trafodion Messages Manual]],
+which provides cause, effect, and recovery information for all SQL errors.
+
* Check that the user has the appropriate permissions to create or call
the SPJ. See these sections:
-** link:#_bookmark114["Required Privileges for Creating or Dropping an
-SPJ" (page 37)]
-** link:#_bookmark156["Required Privileges for Calling an SPJ" (page
-49)]
-* Check the code of the SPJ method. See link:#bookmark36[Chapter 3 (page
-18)]. Fix any problems.
+** <<required-privileges-for-creating-or-dropping-an-spj, Required Privileges for Creating or Dropping an SPJ>>.
+** <<required-privileges-for-calling-an-spj, Required Privileges for Calling an SPJ>>.
+
+* Check the code of the SPJ method. See <<develop-spj-methods, Develop SPJ Methods>>.
+Fix any problems.
+
* If you successfully compiled, deployed, and registered the SPJ but are
receiving errors when calling the SPJ, check that the output parameters
in the Java method are specified as arrays. See
-link:#_bookmark48["Returning Output Values From the Java Method" (page
-19)].
+<<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>.
+
+
* Verify that someone did not alter the library by selecting a JAR file
that contains a different class name, method name, or method signature
than the original JAR file, without dropping and re-creating the SPJ.
In HPDM, compare the library's class name, method name, and method
signature with the procedure's external file (class name), external name
-(method name), and signature. To see the library's class name, method
-name, and method signature, launch the Library Browser dialog box in
-HPDM by right-clicking the name of the library, and selecting Browse
-Library. For more information, see link:#_bookmark109["Use the Library
-Browser" (page 35)]. To see the procedure's external file (class name),
-external name (method name), and signature in HPDM, see
-link:#_bookmark131["Using HPDM] link:#_bookmark131[to Display a
-Procedure in a Schema" (page 42)]. If you notice a discrepancy, see
-link:#_bookmark136["Altering] link:#_bookmark136[an SPJ and Its Java
-Bytecode" (page 44)].
+(method name), and signature.
+
+To see the library's class name, method name, and method signature, launch
+the Library Browser dialog box in HPDM by right-clicking the name of the library,
+and selecting Browse Library.
+
+For more information, see <<use-the-library-browser, Use the Library Browser>>.
+To see the procedure's external file (class name),external name (method name),
+and signature in HPDM, see
+<<using-hpdm-to-display-a-procedure-in-a-schema, Using HPDM to Display a Procedure in a Schema>>.
+If you notice a discrepancy, then see
+<<altering-an-spj-and-its-java-bytecode, Altering an SPJ and Its Java Bytecode>>.
* Check the characteristics of the stored procedure in HPDM and compare
them with the SPJ method that resides on the Trafodion platform. Fix any
discrepancies.
+
* Check the syntax of the CALL statement in the application. See
-link:#bookmark151[Chapter 7 (page 49)]. Fix any problems.
+<<execute-spjs, Execute SPJs>>. Fix any problems.
+
* If the SPJ is supposed to return result sets, but the result sets are
-not being returned to the calling application, check that the SPJ method
-does not explicitly close a java.sql.Connection object. See
-link:#_bookmark66["Use of java.sql.Connection Objects" (page 23)].
-* If a java.lang.ArrayIndexOutOfBoundsException occurs, check that the
+not being returned to the calling application, then check that the SPJ method
+does not explicitly close a `java.sql.Connection` object. See
+<<Use-of-java-sql-Connection-Objects, Use of java.sql.Connection Objects>>.
+
+* If a `java.lang.ArrayIndexOutOfBoundsException` occurs, then check that the
SPJ method is not trying to insert more than one array element into a
-java.sql.ResultSets[] array. For more information, see
-link:#_bookmark54["Returning Stored Procedure Result Sets" (page 20)].
+`java.sql.ResultSets[]` array. For more information, see
+<<returning-stored-procedure-result-sets, Returning Stored Procedure Result Sets>>.
+
* To identify Java-related errors, execute the SPJ method outside the
Trafodion database by invoking the Java method directly in a Java
-application that you run on a client workstation, using the HP JDBC Type
-4 driver to connect to the Trafodion platform.
-* If you are using JDBC tracing and logging, follow these guidelines:
+application that you run on a client workstation, using the Trafodion
+JDBC Type-4 driver to connect to the Trafodion platform.
+
+* If you are using JDBC tracing and logging, then follow these guidelines:
+
** Execute the SPJ method outside the database by invoking the Java
method directly from a Java application that you run on a client
-workstation, using the HP JDBC Type 4 driver to connect to the Trafodion
+workstation, using the Trafodion JDBC Type-4 driver to connect to the Trafodion
platform.
-** Verify that the file directory specified in the T4LogFile property
-exists on the client workstation and that you have write access to it.
-
-For more information about JDBC tracing and logging, see the __Neoview
-JDBC Type 4 Driver Programmer's Reference__.
+** Verify that the file directory specified in the `T4LogFile` property
+exists on the client workstation and that you have write access to it.
[[performance-tip]]
== Performance Tip
@@ -106,7 +113,7 @@ JDBC Type 4 Driver Programmer's Reference__.
To ensure the optimal performance of SPJs on the Trafodion platform,
avoid nesting CALL statements in an SPJ method, which wastes resources
and might diminish performance. For more information, see
-link:#_bookmark62["Nested Java Method Invocations" (page 22)].
+<<nested-java-method-invocations, Nested Java Method Invocations>>.
[[displaying-an-execution-plan-of-a-call-statement]]
== Displaying an Execution Plan of a CALL Statement
@@ -122,133 +129,89 @@ Suppose that you want to display the execution plan for this CALL
statement:
```
-CALL demo.persnl.adjustsalary(202,5.5,?);
+CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
```
Enter this EXPLAIN statement in an trafci session:
-```
-SQL>**prepare spj1 from call demo.persnl.adjustsalary(202,5.5,?);**
+[source, sql]
+----
+SQL> PREPARE spj1 FROM CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
---- SQL command prepared. SQL>**explain spj1;**
+--- SQL command prepared.
------------------------------------------------------------------- PLAN
-SUMMARY MODULE_NAME .............. DYNAMICALLY COMPILED
+SQL> EXPLAIN spj1 ;
+------------------------------------------------------------------ PLAN SUMMARY
+MODULE_NAME .............. DYNAMICALLY COMPILED
STATEMENT_NAME ........... SPJ1
-
PLAN_ID .................. 212206487012085509
-
-ROWS_OUT 1
-
-EST_TOTAL_COST 0
-
-STATEMENT ................ call demo.persnl.adjustsalary(202,5.5,?)
-
------------------------------------------------------------------- NODE
-LISTING ROOT ====================================== SEQ_NO 2 ONLY CHILD
-1 REQUESTS_IN 1
-
-ROWS_OUT 1
-
-EST_OPER_COST 0
-
-EST_TOTAL_COST 0
-
+ROWS_OUT ................. 1
+EST_TOTAL_COST ........... 0
+STATEMENT ................ CALL demo.persnl.adjustsalary( 202, 5.5, ? )
+
+------------------------------------------------------------------ NODE LISTING
+ROOT ====================================== SEQ_NO 2 ONLY CHILD 1
+REQUESTS_IN .............. 1
+ROWS_OUT ................. 1
+EST_OPER_COST ............ 0
+EST_TOTAL_COST ........... 0
DESCRIPTION
-
-max_card_est 1
-
-fragment_id 0
-
-parent_frag ............ (none)
-
-fragment_type .......... master
-
-statement_index 0
-
-affinity_value 3,466,211,324
-
-max_max_cardinality 1
-
-total_overflow_size .... 0.00 KB xn_autoabort_interval -1
-
-plan_version ....... 2,500
-
-LDAP_USERNAME .......... sqluser_admin NVCI_PROCESS ........... ON
-SHOWCONTROL_UNEXTERNALI OFF
-
-SCHEMA ................. DEMO.INVENT
-
-CATALOG ................ NEO
-
-PRIORITY ............... 9 (for table
-HP_SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS) PRIORITY ............... 9 (for
-table HP_SYSTEM_CATALOG.MXCS_SCHEMA.DATASOURC
-
-ES)
-
-PRIORITY ............... 9 (for table
-HP_SYSTEM_CATALOG.MXCS_SCHEMA.ENVIRONME
-
-NTVALUES)
-
-PRIORITY ............... 9 (for table
-HP_SYSTEM_CATALOG.MXCS_SCHEMA.NAME2ID) PRIORITY ............... 9 (for
-table HP_SYSTEM_CATALOG.MXCS_SCHEMA.RESOURCEP
-
-OLICIES) select_list ............ NUMERIC(8,2) SIGNED
-
-input_variables ........ ?
-
-CALL ====================================== SEQ_NO 1 NO CHILDREN
+ max_card_est ........... 1
+ fragment_id ............ 0
+ parent_frag ............ (none)
+ fragment_type .......... master
+ statement_index ........ 0
+ affinity_value ......... 3,466,211,324
+ max_max_cardinality .... 1
+ total_overflow_size .... 0.00 KB xn_autoabort_interval -1
+ plan_version ........... 2,500
+ LDAP_USERNAME .......... sqluser_admin
+ NVCI_PROCESS ........... ON
+ SHOWCONTROL_UNEXTERNALI OFF
+ SCHEMA ................. DEMO.INVENT
+ CATALOG ................ NEO
+ PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS)
+ PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.DATASOURCES)
+ PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.ENVIRONMENTVALUES)
+ PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.NAME2ID)
+ PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.RESOURCEPOLICIES)
+ select_list ............ NUMERIC(8,2) SIGNED
+ input_variables ........ ?
+
+CALL ====================================== SEQ_NO 1 NO CHILDREN
TABLE_NAME ............... DEMO.PERSNL.ADJUSTSALARY
-
-REQUESTS_IN 1
-
-ROWS_OUT 1
-
-EST_OPER_COST 0
-
-EST_TOTAL_COST 0
-
+REQUESTS_IN .............. 1
+ROWS_OUT ................. 1
+EST_OPER_COST ............ 0
+EST_TOTAL_COST ........... 0
DESCRIPTION
-
-max_card_est ........... -1
-
-fragment_id 0
-
-parent_frag ............ (none)
-
-fragment_type .......... master
-
-routine_name ........... DEMO.PERSNL.ADJUSTSALARY
-
-parameter_modes ........ I I O sql_access_mode ........ MODIFIES SQL
-DATA external_name .......... adjustSalary library ................
-DEMO.PERSNL.PAYROLL
-
-external_file .......... Payroll
-
-signature ..............
-(Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V language
-............... JAVA
-
-parameter_style ........ JAVA external_security ...... INVOKER
-max_result_sets 0
-
-parameters ............. cast(202), cast(cast((cast(5.5) / cast(10)))),
-
-NUMERIC(8,2) SIGNED
-
---- SQL operation complete. SQL>
-```
+ max_card_est ........... -1
+ fragment_id ............ 0
+ parent_frag ............ (none)
+ fragment_type .......... master
+ routine_name ........... DEMO.PERSNL.ADJUSTSALARY
+ parameter_modes ........ I I O
+ sql_access_mode ........ MODIFIES SQL DATA
+ external_name .......... adjustSalary
+ library ................ DEMO.PERSNL.PAYROLL
+ external_file .......... Payroll
+ signature .............. (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V
+ language ............... JAVA
+ parameter_style ........ JAVA
+ external_security ...... INVOKER
+ max_result_sets ........ 0
+ parameters ............. cast(202), cast(cast((cast(5.5) / cast(10)))), NUMERIC(8,2) SIGNED
+
+--- SQL operation complete.
+
+SQL>
+----
The EXPLAIN statement generates and displays all the columns of the
result table of the EXPLAIN function. For the syntax of the EXPLAIN
-statement, see the __Trafodion SQL Reference Manual__. For more
-information about optimizing query execution plans, see the __Trafodion
-Query Guide__.
+statement, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#explain_statement[Trafodion SQL Reference Manual].
[[using-the-explain-function]]
=== Using the EXPLAIN Function
@@ -256,161 +219,66 @@ Query Guide__.
You can also prepare the CALL statement and select specific columns from
the result table of the EXPLAIN function, as shown below:
-```
-SQL>**prepare spj1 from call demo.persnl.adjustsalary(202,5.5,?);**
+[source, sql]
+----
+SQL> PREPARE spj1 FROM CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
--- SQL command prepared.
-SQL>**select substring(operator,1,8) as "OPERATOR", operator_cost,**
-
-+>**substring(description,1,500) as "DESCRIPTION"**
-
-+>**from table (explain(null, 'SPJ1'));**
+SQL> SELECT SUBSTRING( operator, 1, 8 ) AS "OPERATOR", operator_cost,
++> SUBSTRING( description, 1, 500 ) AS "DESCRIPTION"
++> FROM TABLE ( EXPLAIN( NULL, 'SPJ1' ) ) ;
OPERATOR OPERATOR_COST DESCRIPTION
-------- -------------- --------------------------------------------------------------------------------------
-
-CALL 0.0 max_card_est: -1 fragment_id: 0 parent_frag: (none)
-fragment_type: master routine_name: DEMO.PERSNL.ADJUSTSALARY
-parameter_modes: I I O sql_access_mode: MODIFIES SQL DATA external_name:
-adjustSalary library: DEMO.PERSNL.PAYROLL external_file: Payroll
-signature: (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V language:
-JAVA parameter_style: JAVA external_security: INVOKER max_result_sets: 0
-parameters: cast(202), cast(cast((cast(5.5) / cast(10)))), NUMERIC(8,2)
-SIGNED
-
-ROOT 0.0 max_card_est: 1 fragment_id: 0 parent_frag: (none)
-fragment_type: master statement_index:
-
-0 affinity_value: 3466211324 max_max_cardinality: 1 total_overflow_size:
-0.00 KB statement: call demo.persnl.adjustsalary(202,5.5,?)
-xn_autoabort_interval: -1 plan_version: 2500 LDAP_USERNAME:
-sqluser_admin NVCI_PROCESS: ON SHOWCONTROL_UNEXTERNALIZED_ATTRS: OFF
-SCHEMA: DEMO.INVENT CATALOG: NEO PRIORITY: 9 (for table
-HP_SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS) PRIORITY: 9 (for table
-HP_SYSTEM_CATALOG.MXCS_SCHEMA.D
+CALL 0.0 max_card_est: -1 fragment_id: 0 parent_frag: (none) fragment_type: master routine_name:
+DEMO.PERSNL.ADJUSTSALARY parameter_modes: I I O sql_access_mode: MODIFIES SQL DATA external_name: adjustSalary
+library: DEMO.PERSNL.PAYROLL external_file: Payroll signature: (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V
+language: JAVA parameter_style: JAVA external_security: INVOKER max_result_sets: 0 parameters: cast(202),
+cast(cast((cast(5.5) / cast(10)))), NUMERIC(8,2) SIGNED
+ROOT 0.0 max_card_est: 1 fragment_id: 0 parent_frag: (none) fragment_type: master statement_index:
+ 0 affinity_value: 3466211324 max_max_cardinality: 1 total_overflow_size: 0.00 KB statement: call
+demo.persnl.adjustsalary( 202, 5.5 ,? ) xn_autoabort_interval: -1 plan_version: 2500 LDAP_USERNAME: sqluser_admin
+NVCI_PROCESS: ON SHOWCONTROL_UNEXTERNALIZED_ATTRS: OFF SCHEMA: DEMO.INVENT CATALOG: NEO PRIORITY: 9 (for table
+SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS) PRIORITY: 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.D
--- 2 row(s) selected. SQL>
-```
+----
For a CALL statement, the OPERATOR column of the result table contains a
row named CALL. The DESCRIPTION column contains special token pairs for
the CALL operator. For descriptions of the token pairs, see this table:
-Token
-
-Token Description
-
-Data Type
-
-max_card_est
-
-The upper limit for the operator cardinality in the query tree.
-
-integer
-
-fragment_id
-
-A sequential number assigned to the fragment. 0 is always the master
-executor, and 1 is reserved for the Explain plan. Numbers 2 to _n_ will
-be ESP or TSE fragments.
-
-integer
-
-parent_frag
-
-The fragment_id for the parent fragment of the current fragment. The
-value is (none) for the master executor.
-
-integer
-
-fragment_type
-
-Type of fragment, which can be either master, ESP, or TSE.
-
-text
-
-routine_name
-
-ANSI name of the procedure.
-
-text
-
-parameter_modes
-
-A sequence of characters that specifies SQL parameter modes for the
+.Token Pairs Description
+[cols="30%,60%,10%", options="header"]
+|===
+| Token | Token Description | Data Type
+| `max_card_est` | The upper limit for the operator cardinality in the query tree. | integer
+| `fragment_id` | A sequential number assigned to the fragment. 0 is always the master
+executor, and 1 is reserved for the Explain plan. Numbers 2 to _n_ are ESP or storage-engine fragments. | integer
+| `parent_frag` | The fragment_id for the parent fragment of the current fragment. The
+value is (none) for the master executor. | integer
+| `fragment_type` | Type of fragment, which can be either master, ESP, or storage engine. | text
+| `routine_name` | ANSI name of the procedure. | text
+| `parameter_modes` | A sequence of characters that specifies SQL parameter modes for the
procedure. I is used for an IN parameter, O for an OUT parameter, and N
for an INOUT parameter. Characters are separated by a single space. The
-value none is returned if the procedure has no SQL parameters.
-
-text
-
-sql_access_mode
-
-SQL access mode of the procedure.
-
-text
-
-external_name
-
-Java method name.
-
-text
-
-library
-
-ANSI name of the library object that maps to the procedure's JAR file.
-
-text
-
-external_file
-
-Java class name, possibly prefixed by a package name, that contains the
-SPJ method.
-
-text
-
-signature
-
-Java signature of the SPJ method in internal Java Virtual Machine (JVM)
-format.
-
-text
-
-language
-
-Language in which the SPJ method is written, which is always Java.
-
-text
-
-parameter_style
-
-Convention of passing parameter arguments to the stored procedure, which
-conforms to the Java language for SPJs.
-
-text
-
-external_security
-
-External security of the stored procedure, indicating the privileges or
-rights that users have when executing (or calling) the procedure. The
-value is either INVOKER or DEFINER. For more information, see
-link:#_bookmark124["Understand External Security" (page 41)].
-
-text
-
-max_result_sets
-
-The maximum number of result sets that this procedure can return.
-
-integer
-
-parameters
-
-The parameter arguments that are passed to or from the procedure.
-
-text
-
-For the syntax of the EXPLAIN function, see the __Trafodion SQL Reference
-Manual__.
+value none is returned if the procedure has no SQL parameters. | text
+| `sql_access_mode` | SQL access mode of the procedure. ` | text
+| `external_name` | Java method name. | text
+| `library` | ANSI name of the library object that maps to the procedure's JAR file. | text
+| `external_file` | Java class name, possibly prefixed by a package name, that contains the SPJ method. | text
+| `signature` | Java signature of the SPJ method in internal Java Virtual Machine (JVM) format. | text
+| `language` | Language in which the SPJ method is written, which is always Java. | text
+| `parameter_style` | Convention of passing parameter arguments to the stored procedure, which
+conforms to the Java language for SPJs. | text
+| `external_security` | External security of the stored procedure, indicating the privileges or
+rights that users have when executing (or calling) the procedure. The value is either INVOKER or
+DEFINER. For more information, see <<understand-external-security, Understand External Security>>. | text
+| `max_result_sets` | The maximum number of result sets that this procedure can return. | integer
+| `parameters` | The parameter arguments that are passed to or from the procedure. | text
+|===
+
+For the syntax of the EXPLAIN function, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#explain_statement[Trafodion SQL Reference Manual].
[07/14] incubator-trafodion git commit: Backup checkin
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/orderSummary.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/orderSummary.java b/docs/spj_guide/src/resources/source/orderSummary.java
index d10e98a..8b8e5bb 100644
--- a/docs/spj_guide/src/resources/source/orderSummary.java
+++ b/docs/spj_guide/src/resources/source/orderSummary.java
@@ -25,7 +25,7 @@ public static void orderSummary( java.lang.String onOrAfter
DriverManager.getConnection( "jdbc:default:connection" ) ;
// Get the number of orders on or after this date
- s = "SELECT COUNT(ordernum) FROM demo.sales.orders "
+ s = "SELECT COUNT(ordernum) FROM trafodion.sales.orders "
+ "WHERE order_date >= CAST(? AS DATE) "
;
@@ -44,13 +44,13 @@ public static void orderSummary( java.lang.String onOrAfter
+ " o.ordernum "
+ " , COUNT(d.partnum) AS num_parts "
+ " , SUM(d.unit_price * d.qty_ordered) AS amount "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
+ + " FROM trafodion.sales.orders o, trafodion.sales.odetail d "
+ " WHERE o.ordernum = d.ordernum "
+ " AND o.order_date >= CAST(? AS DATE) "
+ " GROUP BY o.ordernum "
+ " ) amounts "
- + " , demo.sales.orders orders "
- + " , demo.persnl.employee emps "
+ + " , trafodion.sales.orders orders "
+ + " , trafodion.persnl.employee emps "
+ "WHERE amounts.ordernum = orders.ordernum "
+ " AND orders.salesrep = emps.empnum "
+ "ORDER BY orders.ordernum "
@@ -62,7 +62,7 @@ public static void orderSummary( java.lang.String onOrAfter
// Open a result set for order detail rows
s = "SELECT d.*, p.partdesc "
- + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
+ + "FROM trafodion.sales.odetail d, trafodion.sales.parts p, trafodion.sales.orders O "
+ "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
+ " AND o.order_date >= CAST(? AS DATE) "
+ "ORDER BY d.ordernum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/partData.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/partData.java b/docs/spj_guide/src/resources/source/partData.java
index d85f980..f8bf8e1 100644
--- a/docs/spj_guide/src/resources/source/partData.java
+++ b/docs/spj_guide/src/resources/source/partData.java
@@ -27,7 +27,7 @@ public static void partData( int partNum
// Retrieve detail about this part into the output parameters
PreparedStatement getPartInfo =
conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
- + "FROM demo.sales.parts P "
+ + "FROM trafodion.sales.parts P "
+ "WHERE partnum = ? "
) ;
@@ -47,9 +47,9 @@ public static void partData( int partNum
// quantity of this part that was ordered.
PreparedStatement getOrders =
conn.prepareStatement( "SELECT O.*, QTY.QTY_ORDERED "
- + "FROM demo.sales.orders O "
+ + "FROM trafodion.sales.orders O "
+ " , ( select ordernum, sum(qty_ordered) as QTY_ORDERED "
- + " from demo.sales.odetail "
+ + " from trafodion.sales.odetail "
+ " where partnum = ? "
+ " group by ordernum ) QTY "
+ "WHERE O.ordernum = QTY.ordernum "
@@ -65,7 +65,7 @@ public static void partData( int partNum
// have on hand.
PreparedStatement getLocations =
conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partloc "
+ + "FROM trafodion.invent.partloc "
+ " WHERE partnum = ? "
) ;
@@ -76,7 +76,7 @@ public static void partData( int partNum
// suppliers who supply this part.
PreparedStatement getSuppliers =
conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partsupp "
+ + "FROM trafodion.invent.partsupp "
+ "WHERE partnum = ? "
) ;
@@ -87,10 +87,10 @@ public static void partData( int partNum
// sales reps that have sold this part.
PreparedStatement getReps =
conn.prepareStatement( "SELECT * "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum in ( SELECT O.salesrep "
- + " FROM demo.sales.orders O, "
- + " demo.sales.odetail D "
+ + " FROM trafodion.sales.orders O, "
+ + " trafodion.sales.odetail D "
+ " D.partnum = ? "
+ " O.ordernum = D.ordernum ) "
+ "ORDER BY empnum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/partlocations.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/partlocations.java b/docs/spj_guide/src/resources/source/partlocations.java
index 2a4df24..88cdaae 100644
--- a/docs/spj_guide/src/resources/source/partlocations.java
+++ b/docs/spj_guide/src/resources/source/partlocations.java
@@ -16,7 +16,7 @@ public static void partLocations( int partNum
PreparedStatement getLocationsExact =
conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
+ + "FROM trafodion.invent.partloc L "
+ "WHERE L.partnum = ? "
+ " AND L.qty_on_hand = ? "
+ " ORDER BY L.partnum "
@@ -27,7 +27,7 @@ public static void partLocations( int partNum
PreparedStatement getLocationsMoreThan =
conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
+ + "FROM trafodion.invent.partloc L "
+ "WHERE L.partnum = ? "
+ " AND L.qty_on_hand > ? "
+ "ORDER BY L.partnum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/persnl_dept_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_dept_table.sql b/docs/spj_guide/src/resources/source/persnl_dept_table.sql
index 85b4d19..91b35f3 100644
--- a/docs/spj_guide/src/resources/source/persnl_dept_table.sql
+++ b/docs/spj_guide/src/resources/source/persnl_dept_table.sql
@@ -1,10 +1,10 @@
-CREATE TABLE demo.persnl.dept
+CREATE TABLE trafodion.persnl.dept
( deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, deptname CHARACTER (12) NO DEFAULT NOT NULL
, manager NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, rptdept NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
, location VARCHAR (18) DEFAULT ' ' NOT NULL
-, PRIMARY KEY (deptnum)
+, PRIMARY KEY ( deptnum )
) ;
CREATE INDEX xdeptmgr ON dept
@@ -15,12 +15,12 @@ CREATE INDEX xdeptrpt ON dept
( rptdept
) ;
-ALTER TABLE demo.persnl.dept
+ALTER TABLE trafodion.persnl.dept
ADD CONSTRAINT mgrnum_constrnt
CHECK (manager BETWEEN 0000 AND 9999)
;
-ALTER TABLE demo.persnl.dept
+ALTER TABLE trafodion.persnl.dept
ADD CONSTRAINT deptnum_constrnt
CHECK ( deptnum IN
( 1000
@@ -39,7 +39,7 @@ ALTER TABLE demo.persnl.dept
)
;
3
-CREATE VIEW demo.persnl.mgrlist
+CREATE VIEW trafodion.persnl.mgrlist
( first_name
, last_name
, department
@@ -52,7 +52,7 @@ FROM dept, employee
WHERE dept.manager = employee.empnum
;
-INSERT INTO demo.persnl.dept VALUES
+INSERT INTO trafodion.persnl.dept VALUES
( 1000, 'FINANCE', 23, 9000, 'CHICAGO' )
, ( 1500, 'PERSONNEL', 213, 1000, 'CHICAGO' )
, ( 2000, 'INVENTORY', 32, 9000, 'LOS ANGELES' )
@@ -67,4 +67,4 @@ INSERT INTO demo.persnl.dept VALUES
, ( 9000, 'xxCORPORATE', 1, 9000, 'CHICAGO' )
;
-UPDATE STATISTICS FOR TABLE demo.persnl.dept ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.persnl.dept ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/persnl_employee_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_employee_table.sql b/docs/spj_guide/src/resources/source/persnl_employee_table.sql
index 1af4323..58bac1f 100644
--- a/docs/spj_guide/src/resources/source/persnl_employee_table.sql
+++ b/docs/spj_guide/src/resources/source/persnl_employee_table.sql
@@ -1,15 +1,15 @@
-CREATE TABLE demo.persnl.employee
+CREATE TABLE trafodion.persnl.employee
( empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, first_name CHARACTER (15) DEFAULT ' ' NOT NULL
, last_name CHARACTER (20) DEFAULT ' ' NOT NULL
, deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, jobcode NUMERIC (4) UNSIGNED DEFAULT NULL
, salary NUMERIC (8, 2) UNSIGNED DEFAULT NULL
-, PRIMARY KEY (empnum)
+, PRIMARY KEY ( empnum )
) ;
-ALTER TABLE demo.persnl.employee
- ADD CONSTRAINT empnum_constrnt CHECK (empnum BETWEEN 0001 AND 9999)
+ALTER TABLE trafodion.persnl.employee
+ ADD CONSTRAINT empnum_constrnt CHECK ( empnum BETWEEN 0001 AND 9999 )
;
CREATE INDEX xempname ON employee
@@ -21,7 +21,7 @@ CREATE INDEX xempdept ON employee
( deptnum
) ;
-CREATE VIEW demo.persnl.emplist AS
+CREATE VIEW trafodion.persnl.emplist AS
SELECT
empnum
, first_name
@@ -31,69 +31,69 @@ SELECT
FROM employee
;
-INSERT INTO demo.persnl.employee VALUES
- ( 1, 'ROGER', 'GREEN', 9000, 100, 175500.00 )
-, ( 23, 'JERRY', 'HOWARD', 1000, 100, 137000.10 )
-, ( 29, 'JANE', 'RAYMOND', 3000, 100, 136000.00 )
-, ( 32, 'THOMAS', 'RUDLOFF', 2000, 100, 138000.40 )
-, ( 39, 'KLAUS ', 'SAFFERT', 3200, 100, 75000.00 )
-, ( 43, 'PAUL', 'WINTER', 3100, 100, 90000.00 )
-, ( 65, 'RACHEL', 'MCKAY', 4000, 100, 118000.00 )
-, ( 72, 'GLENN', 'THOMAS', 3300, 100, 80000.00 )
-, ( 75, 'TIM', 'WALKER', 3000, 300, 32000.00 )
-, ( 87, 'ERIC', 'BROWN', 4000, 400, 89000.00 )
-, ( 89, 'PETER', 'SMITH', 3300, 300, 37000.40 )
-, ( 93, 'DONALD', 'TAYLOR', 3100, 300, 33000.00 )
-, ( 104, 'DAVID', 'STRAND', 4000, 400, 69000.00 )
-, ( 109, 'STEVE', 'COOK', 4000, 400, 68000.00 )
-, ( 111, 'SHERRIE', 'WONG', 3500, 100, 70000.00 )
-, ( 178, 'JOHN', 'CHOU', 3500, 900, 28000.00 )
-, ( 180, 'MANFRED', 'CONRAD', 4000, 450, 32000.00 )
-, ( 201, 'JIM', 'HERMAN', 3000, 300, 19000.00 )
-, ( 202, 'LARRY', 'CLARK', 1000, 500, 25000.75 )
-, ( 203, 'KATHRYN', 'HALL', 4000, 400, 96000.00 )
-, ( 205, 'GINNY', 'FOSTER', 3300, 900, 30000.00 )
-, ( 206, 'DAVE', 'FISHER', 3200, 900, 25000.00 )
-, ( 207, 'MARK', 'FOLEY', 4000, 420, 33000.00 )
-, ( 208, 'SUE', 'CRAMER', 1000, 900, 19000.00 )
-, ( 209, 'SUSAN', 'CHAPMAN', 1500, 900, 17000.00 )
-, ( 210, 'RICHARD', 'BARTON', 1000, 500, 29000.00 )
-, ( 211, 'JIMMY', 'SCHNEIDER', 1500, 600, 26000.00 )
-, ( 212, 'JONATHAN', 'MITCHELL', 1500, 600, 32000.00 )
-, ( 213, 'ROBERT', 'WHITE', 1500, 100, 90000.00 )
-, ( 214, 'JULIA', 'KELLY', 1000, 500, 50000.00 )
-, ( 215, 'WALTER', 'LANCASTER', 4000, 450, 33000.50 )
-, ( 216, 'JOHN', 'JONES', 4000, 450, 40000.00 )
-, ( 217, 'MARLENE', 'BONNY', 4000, 900, 24000.90 )
-, ( 218, 'GEORGE', 'FRENCHMAN', 4000, 420, 36000.00 )
-, ( 219, 'DAVID', 'TERRY', 2000, 250, 27000.12 )
-, ( 220, 'JOHN', 'HUGHES', 3200, 300, 33000.10 )
-, ( 221, 'OTTO', 'SCHNABL', 3200, 300, 33000.00 )
-, ( 222, 'MARTIN', 'SCHAEFFER', 3200, 300, 31000.00 )
-, ( 223, 'HERBERT', 'KARAJAN', 3200, 300, 29000.00 )
-, ( 224, 'MARIA', 'JOSEF', 4000, 420, 18000.10 )
-, ( 225, 'KARL', 'HELMSTED', 4000, 450, 32000.00 )
-, ( 226, 'HEIDI', 'WEIGL', 3200, 300, 22000.00 )
-, ( 227, 'XAVIER', 'SEDLEMEYER', 3300, 300, 30000.00 )
-, ( 228, 'PETE', 'WELLINGTON', 3100, 300, 32000.20 )
-, ( 229, 'GEORGE', 'STRICKER', 3100, 300, 32222.00 )
-, ( 230, 'ROCKY', 'LEWIS', 2000, 200, 24000.00 )
-, ( 231, 'HERB', 'ALBERT', 3300, 300, 33000.00 )
-, ( 232, 'THOMAS', 'SPINNER', 4000, 450, 45000.00 )
-, ( 233, 'TED', 'MCDONALD', 2000, 250, 29000.00 )
-, ( 234, 'MARY', 'MILLER', 2500, 100, 56000.00 )
-, ( 235, 'MIRIAM', 'KING', 2500, 900, 18000.00 )
-, ( 321, 'BILL', 'WINN', 2000, 900, 32000.00 )
-, ( 337, 'DINAH', 'CLARK', 9000, 900, 37000.00 )
-, ( 343, 'ALAN', 'TERRY', 3000, 900, 39500.00 )
-, ( 557, 'BEN', 'HENDERSON', 4000, 400, 65000.00 )
-, ( 568, 'JESSICA', 'CRINER', 3500, 300, 39500.00 )
-, ( 990, 'THOMAS', 'STIBBS', 3500, NULL, NULL )
-, ( 991, 'WAYNE', 'O''NEIL', 3500, NULL, NULL )
-, ( 992, 'BARRY', 'KINNEY', 3500, NULL, NULL )
-, ( 993, 'PAUL', 'BUSKETT', 3100, NULL, NULL )
-, ( 994, 'EMMY', 'BUSKETT', 3100, NULL, NULL )
-, ( 995, 'WALT', 'FARLEY', 3100, NULL, NULL )
+INSERT INTO trafodion.persnl.employee VALUES
+ ( 1, 'ROGER', 'GREEN', 9000, 100, 175500.00 )
+, ( 23, 'JERRY', 'HOWARD', 1000, 100, 137000.10 )
+, ( 29, 'JANE', 'RAYMOND', 3000, 100, 136000.00 )
+, ( 32, 'THOMAS', 'RUDLOFF', 2000, 100, 138000.40 )
+, ( 39, 'KLAUS ', 'SAFFERT', 3200, 100, 75000.00 )
+, ( 43, 'PAUL', 'WINTER', 3100, 100, 90000.00 )
+, ( 65, 'RACHEL', 'MCKAY', 4000, 100, 118000.00 )
+, ( 72, 'GLENN', 'THOMAS', 3300, 100, 80000.00 )
+, ( 75, 'TIM', 'WALKER', 3000, 300, 32000.00 )
+, ( 87, 'ERIC', 'BROWN', 4000, 400, 89000.00 )
+, ( 89, 'PETER', 'SMITH', 3300, 300, 37000.40 )
+, ( 93, 'DONALD', 'TAYLOR', 3100, 300, 33000.00 )
+, ( 104, 'DAVID', 'STRAND', 4000, 400, 69000.00 )
+, ( 109, 'STEVE', 'COOK', 4000, 400, 68000.00 )
+, ( 111, 'SHERRIE', 'WONG', 3500, 100, 70000.00 )
+, ( 178, 'JOHN', 'CHOU', 3500, 900, 28000.00 )
+, ( 180, 'MANFRED', 'CONRAD', 4000, 450, 32000.00 )
+, ( 201, 'JIM', 'HERMAN', 3000, 300, 19000.00 )
+, ( 202, 'LARRY', 'CLARK', 1000, 500, 25000.75 )
+, ( 203, 'KATHRYN', 'HALL', 4000, 400, 96000.00 )
+, ( 205, 'GINNY', 'FOSTER', 3300, 900, 30000.00 )
+, ( 206, 'DAVE', 'FISHER', 3200, 900, 25000.00 )
+, ( 207, 'MARK', 'FOLEY', 4000, 420, 33000.00 )
+, ( 208, 'SUE', 'CRAMER', 1000, 900, 19000.00 )
+, ( 209, 'SUSAN', 'CHAPMAN', 1500, 900, 17000.00 )
+, ( 210, 'RICHARD', 'BARTON', 1000, 500, 29000.00 )
+, ( 211, 'JIMMY', 'SCHNEIDER', 1500, 600, 26000.00 )
+, ( 212, 'JONATHAN', 'MITCHELL', 1500, 600, 32000.00 )
+, ( 213, 'ROBERT', 'WHITE', 1500, 100, 90000.00 )
+, ( 214, 'JULIA', 'KELLY', 1000, 500, 50000.00 )
+, ( 215, 'WALTER', 'LANCASTER', 4000, 450, 33000.50 )
+, ( 216, 'JOHN', 'JONES', 4000, 450, 40000.00 )
+, ( 217, 'MARLENE', 'BONNY', 4000, 900, 24000.90 )
+, ( 218, 'GEORGE', 'FRENCHMAN', 4000, 420, 36000.00 )
+, ( 219, 'DAVID', 'TERRY', 2000, 250, 27000.12 )
+, ( 220, 'JOHN', 'HUGHES', 3200, 300, 33000.10 )
+, ( 221, 'OTTO', 'SCHNABL', 3200, 300, 33000.00 )
+, ( 222, 'MARTIN', 'SCHAEFFER', 3200, 300, 31000.00 )
+, ( 223, 'HERBERT', 'KARAJAN', 3200, 300, 29000.00 )
+, ( 224, 'MARIA', 'JOSEF', 4000, 420, 18000.10 )
+, ( 225, 'KARL', 'HELMSTED', 4000, 450, 32000.00 )
+, ( 226, 'HEIDI', 'WEIGL', 3200, 300, 22000.00 )
+, ( 227, 'XAVIER', 'SEDLEMEYER', 3300, 300, 30000.00 )
+, ( 228, 'PETE', 'WELLINGTON', 3100, 300, 32000.20 )
+, ( 229, 'GEORGE', 'STRICKER', 3100, 300, 32222.00 )
+, ( 230, 'ROCKY', 'LEWIS', 2000, 200, 24000.00 )
+, ( 231, 'HERB', 'ALBERT', 3300, 300, 33000.00 )
+, ( 232, 'THOMAS', 'SPINNER', 4000, 450, 45000.00 )
+, ( 233, 'TED', 'MCDONALD', 2000, 250, 29000.00 )
+, ( 234, 'MARY', 'MILLER', 2500, 100, 56000.00 )
+, ( 235, 'MIRIAM', 'KING', 2500, 900, 18000.00 )
+, ( 321, 'BILL', 'WINN', 2000, 900, 32000.00 )
+, ( 337, 'DINAH', 'CLARK', 9000, 900, 37000.00 )
+, ( 343, 'ALAN', 'TERRY', 3000, 900, 39500.00 )
+, ( 557, 'BEN', 'HENDERSON', 4000, 400, 65000.00 )
+, ( 568, 'JESSICA', 'CRINER', 3500, 300, 39500.00 )
+, ( 990, 'THOMAS', 'STIBBS', 3500, NULL, NULL )
+, ( 991, 'WAYNE', 'O''NEIL', 3500, NULL, NULL )
+, ( 992, 'BARRY', 'KINNEY', 3500, NULL, NULL )
+, ( 993, 'PAUL', 'BUSKETT', 3100, NULL, NULL )
+, ( 994, 'EMMY', 'BUSKETT', 3100, NULL, NULL )
+, ( 995, 'WALT', 'FARLEY', 3100, NULL, NULL )
;
-UPDATE STATISTICS FOR TABLE demo.persnl.employee ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.persnl.employee ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/persnl_job_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_job_table.sql b/docs/spj_guide/src/resources/source/persnl_job_table.sql
index 0692af0..29d59f1 100644
--- a/docs/spj_guide/src/resources/source/persnl_job_table.sql
+++ b/docs/spj_guide/src/resources/source/persnl_job_table.sql
@@ -1,10 +1,10 @@
-CREATE TABLE demo.persnl.job
+CREATE TABLE trafodion.persnl.job
( jobcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, jobdesc VARCHAR (18) DEFAULT ' ' NOT NULL
-, PRIMARY KEY (jobcode)
+, PRIMARY KEY ( jobcode )
) ;
-INSERT INTO demo.persnl.job VALUES
+INSERT INTO trafodion.persnl.job VALUES
( 100, 'MANAGER' )
, ( 200, 'PRODUCTION SUPV' )
, ( 250, 'ASSEMBLER' )
@@ -17,4 +17,4 @@ INSERT INTO demo.persnl.job VALUES
, ( 900, 'SECRETARY' )
;
-UPDATE STATISTICS FOR TABLE demo.persnl.job ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.persnl.job ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/persnl_project_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_project_table.sql b/docs/spj_guide/src/resources/source/persnl_project_table.sql
index 35c2999..21526ec 100644
--- a/docs/spj_guide/src/resources/source/persnl_project_table.sql
+++ b/docs/spj_guide/src/resources/source/persnl_project_table.sql
@@ -1,14 +1,14 @@
-CREATE TABLE demo.persnl.project
+CREATE TABLE trafodion.persnl.project
( projcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, projdesc VARCHAR (18) DEFAULT ' ' NOT NULL
, start_date DATE DEFAULT DATE '2011-07-01' NOT NULL
, ship_timestamp TIMESTAMP DEFAULT TIMESTAMP '2011-08-01:12:00:00.000000' NOT NULL
, est_complete INTERVAL DAY DEFAULT INTERVAL '30' DAY NOT NULL
-, PRIMARY KEY (projcode, empnum)
+, PRIMARY KEY ( projcode, empnum )
) ;
-INSERT INTO demo.persnl.project
+INSERT INTO trafodion.persnl.project
VALUES
( 1000, 213, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
, ( 1000, 211, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
@@ -42,4 +42,4 @@ VALUES
, ( 5000, 218, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
;
-UPDATE STATISTICS FOR TABLE demo.persnl.project ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.persnl.project ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/persnl_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/persnl_schema.sql b/docs/spj_guide/src/resources/source/persnl_schema.sql
index bad0734..140ab97 100644
--- a/docs/spj_guide/src/resources/source/persnl_schema.sql
+++ b/docs/spj_guide/src/resources/source/persnl_schema.sql
@@ -1,2 +1,2 @@
-CREATE SCHEMA DEMO.PERSNL ;
-SET SCHEMA DEMO.PERSNL ;
+CREATE SCHEMA trafodion.persnl ;
+SET SCHEMA trafodion.persnl ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/projectTeam.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/projectTeam.java b/docs/spj_guide/src/resources/source/projectTeam.java
index 039b534..0d150c4 100644
--- a/docs/spj_guide/src/resources/source/projectTeam.java
+++ b/docs/spj_guide/src/resources/source/projectTeam.java
@@ -13,7 +13,7 @@ public static void projectTeam( int projectCode
PreparedStatement getMembers =
conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, D.location "
- + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
+ + "FROM trafodion.persnl.employee E, trafodion.persnl.dept D, trafodion.persnl.project P "
+ "WHERE P.projcode = ? "
+ " AND P.empnum = E.empnum "
+ " AND E.deptnum = D.deptnum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/sales_customer_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_customer_table.sql b/docs/spj_guide/src/resources/source/sales_customer_table.sql
index 96a1c7c..31efef0 100644
--- a/docs/spj_guide/src/resources/source/sales_customer_table.sql
+++ b/docs/spj_guide/src/resources/source/sales_customer_table.sql
@@ -1,4 +1,4 @@
-CREATE TABLE demo.sales.customer
+CREATE TABLE trafodion.sales.customer
( custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, custname CHARACTER (18) NO DEFAULT NOT NULL
, street CHARACTER (22) NO DEFAULT NOT NULL
@@ -6,10 +6,10 @@ CREATE TABLE demo.sales.customer
, state CHARACTER (12) DEFAULT ' ' NOT NULL
, postcode CHARACTER (10) NO DEFAULT NOT NULL
, credit CHARACTER (2) DEFAULT 'C1' NOT NULL
-, PRIMARY KEY (custnum)
+, PRIMARY KEY ( custnum )
) ;
-INSERT INTO demo.sales.customer VALUES
+INSERT INTO trafodion.sales.customer VALUES
( 21, 'CENTRAL UNIVERSITY', 'UNIVERSITY WAY', 'PHILADELPHIA', 'PENNSYLVANIA', '19104', 'A1' )
, ( 123, 'BROWN MEDICAL CO', '100 CALIFORNIA STREET', 'SAN FRANCISCO', 'CALIFORNIA', '94944', 'C2' )
, ( 143, 'STEVENS SUPPLY', '2020 HARRIS STREET', 'DENVER', 'COLORADO', '80734', 'A2' )
@@ -27,4 +27,4 @@ INSERT INTO demo.sales.customer VALUES
, ( 9033, 'ART SUPPLIES, INC.', '22 SWEET ST.', 'PITTSBURGH', 'PENNA.', '08333', 'C3' )
;
-UPDATE STATISTICS FOR TABLE demo.sales.customer ON EVERY COLUMN;
+UPDATE STATISTICS FOR TABLE trafodion.sales.customer ON EVERY COLUMN;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/sales_odetail_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_odetail_table.sql b/docs/spj_guide/src/resources/source/sales_odetail_table.sql
index 13cfb61..da6fa37 100644
--- a/docs/spj_guide/src/resources/source/sales_odetail_table.sql
+++ b/docs/spj_guide/src/resources/source/sales_odetail_table.sql
@@ -1,84 +1,84 @@
-CREATE TABLE demo.sales.odetail
+CREATE TABLE trafodion.sales.odetail
( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, unit_price NUMERIC (8, 2) NO DEFAULT NOT NULL
, qty_ordered NUMERIC (5) UNSIGNED NO DEFAULT NOT NULL
-, PRIMARY KEY (ordernum,partnum)
+, PRIMARY KEY ( ordernum, partnum )
) ;
-INSERT INTO demo.sales.odetail VALUES
- ( 100210, 244, 3500.00, 3 )
-, ( 100210,2001, 1100.00, 3 )
-, ( 100210,2403, 620.00, 6 )
-, ( 100210,5100, 150.00, 10 )
-, ( 100250, 244, 3500.00, 4 )
-, ( 100250,5103, 400.00, 10 )
-, ( 100250,6301, 245.00, 15 )
-, ( 100250,6500, 95.00, 10 )
-, ( 101220, 255, 3900.00, 10 )
-, ( 101220,5103, 400.00, 3 )
-, ( 101220,7102, 275.00, 7 )
-, ( 101220,7301, 425.00, 8 )
-, ( 200300, 244, 3500.00, 8 )
-, ( 200300,2001, 1000.00, 10 )
-, ( 200300,2002, 1400.00, 10 )
-, ( 200320,5504, 165.00, 5 )
-, ( 200320,6201, 195.00, 16 )
-, ( 200320,6301, 245.00, 6 )
-, ( 200320,6400, 540.00, 7 )
-, ( 200490,3210, 715.00, 1 )
-, ( 200490,5505, 350.00, 1 )
-, ( 300350, 244, 2800.00, 20 )
-, ( 300350,5100, 150.00, 5 )
-, ( 300350,5110, 525.00, 12 )
-, ( 300350,6301, 245.00, 5 )
-, ( 300350,6400, 550.00, 5 )
-, ( 300380, 244, 3000.00, 6 )
-, ( 300380,2402, 320.00, 12 )
-, ( 300380,2405, 760.00, 8 )
-, ( 400410, 212, 2450.00, 12 )
-, ( 400410, 255, 3800.00, 12 )
-, ( 400410,2001, 1000.00, 36 )
-, ( 400410,6301, 240.00, 48 )
-, ( 400410,6400, 500.00, 70 )
-, ( 400410,7301, 415.00, 36 )
-, ( 500450, 212, 2500.00, 8 )
-, ( 500450, 255, 3900.00, 12 )
-, ( 500450,2001, 1100.00, 16 )
-, ( 500450,2002, 1500.00, 16 )
-, ( 500450,2402, 330.00, 48 )
-, ( 600480,2001, 1000.00, 60 )
-, ( 600480,2002, 1450.00, 20 )
-, ( 600480,2003, 1900.00, 40 )
-, ( 600480,3103, 4000.00, 40 )
-, ( 600480,3205, 625.00, 20 )
-, ( 600480,5100, 135.00, 60 )
-, ( 600480,5103, 390.00, 20 )
-, ( 600480,7301, 425.00, 40 )
-, ( 700410,2003, 1900.00, 65 )
-, ( 700410,2403, 650.00, 10 )
-, ( 700510, 255, 4000.00, 4 )
-, ( 700510,6500, 95.00, 8 )
-, ( 700510,7102, 275.00, 5 )
-, ( 800660, 244, 3000.00, 6 )
-, ( 800660,2001, 1000.00, 30 )
-, ( 800660,2403, 600.00, 48 )
-, ( 800660,2405, 795.00, 10 )
-, ( 800660,3201, 525.00, 6 )
-, ( 800660,3205, 600.00, 18 )
-, ( 800660,3210, 715.00, 6 )
-, ( 800660,4102, 26.00, 130 )
-, ( 800660,5100, 150.00, 12 )
-, ( 800660,5101, 200.00, 6 )
-, ( 800660,5110, 490.00, 48 )
-, ( 800660,5504, 165.00, 18 )
-, ( 800660,6201, 195.00, 6 )
-, ( 800660,6301, 235.00, 24 )
-, ( 800660,6400, 525.00, 30 )
-, ( 800660,6401, 700.00, 36 )
-, ( 800660,6500, 95.00, 22 )
-, ( 800660,7102, 275.00, 6 )
-, ( 800660,7301, 425.00, 12 )
+INSERT INTO trafodion.sales.odetail VALUES
+ ( 100210, 244, 3500.00, 3 )
+, ( 100210, 2001, 1100.00, 3 )
+, ( 100210, 2403, 620.00, 6 )
+, ( 100210, 5100, 150.00, 10 )
+, ( 100250, 244, 3500.00, 4 )
+, ( 100250, 5103, 400.00, 10 )
+, ( 100250, 6301, 245.00, 15 )
+, ( 100250, 6500, 95.00, 10 )
+, ( 101220, 255, 3900.00, 10 )
+, ( 101220, 5103, 400.00, 3 )
+, ( 101220, 7102, 275.00, 7 )
+, ( 101220, 7301, 425.00, 8 )
+, ( 200300, 244, 3500.00, 8 )
+, ( 200300, 2001, 1000.00, 10 )
+, ( 200300, 2002, 1400.00, 10 )
+, ( 200320, 5504, 165.00, 5 )
+, ( 200320, 6201, 195.00, 16 )
+, ( 200320, 6301, 245.00, 6 )
+, ( 200320, 6400, 540.00, 7 )
+, ( 200490, 3210, 715.00, 1 )
+, ( 200490, 5505, 350.00, 1 )
+, ( 300350, 244, 2800.00, 20 )
+, ( 300350, 5100, 150.00, 5 )
+, ( 300350, 5110, 525.00, 12 )
+, ( 300350, 6301, 245.00, 5 )
+, ( 300350, 6400, 550.00, 5 )
+, ( 300380, 244, 3000.00, 6 )
+, ( 300380, 2402, 320.00, 12 )
+, ( 300380, 2405, 760.00, 8 )
+, ( 400410, 212, 2450.00, 12 )
+, ( 400410, 255, 3800.00, 12 )
+, ( 400410, 2001, 1000.00, 36 )
+, ( 400410, 6301, 240.00, 48 )
+, ( 400410, 6400, 500.00, 70 )
+, ( 400410, 7301, 415.00, 36 )
+, ( 500450, 212, 2500.00, 8 )
+, ( 500450, 255, 3900.00, 12 )
+, ( 500450, 2001, 1100.00, 16 )
+, ( 500450, 2002, 1500.00, 16 )
+, ( 500450, 2402, 330.00, 48 )
+, ( 600480, 2001, 1000.00, 60 )
+, ( 600480, 2002, 1450.00, 20 )
+, ( 600480, 2003, 1900.00, 40 )
+, ( 600480, 3103, 4000.00, 40 )
+, ( 600480, 3205, 625.00, 20 )
+, ( 600480, 5100, 135.00, 60 )
+, ( 600480, 5103, 390.00, 20 )
+, ( 600480, 7301, 425.00, 40 )
+, ( 700410, 2003, 1900.00, 65 )
+, ( 700410, 2403, 650.00, 10 )
+, ( 700510, 255, 4000.00, 4 )
+, ( 700510, 6500, 95.00, 8 )
+, ( 700510, 7102, 275.00, 5 )
+, ( 800660, 244, 3000.00, 6 )
+, ( 800660, 2001, 1000.00, 30 )
+, ( 800660, 2403, 600.00, 48 )
+, ( 800660, 2405, 795.00, 10 )
+, ( 800660, 3201, 525.00, 6 )
+, ( 800660, 3205, 600.00, 18 )
+, ( 800660, 3210, 715.00, 6 )
+, ( 800660, 4102, 26.00, 130 )
+, ( 800660, 5100, 150.00, 12 )
+, ( 800660, 5101, 200.00, 6 )
+, ( 800660, 5110, 490.00, 48 )
+, ( 800660, 5504, 165.00, 18 )
+, ( 800660, 6201, 195.00, 6 )
+, ( 800660, 6301, 235.00, 24 )
+, ( 800660, 6400, 525.00, 30 )
+, ( 800660, 6401, 700.00, 36 )
+, ( 800660, 6500, 95.00, 22 )
+, ( 800660, 7102, 275.00, 6 )
+, ( 800660, 7301, 425.00, 12 )
;
-UPDATE STATISTICS FOR TABLE demo.sales.odetail ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.sales.odetail ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/sales_orders_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_orders_table.sql b/docs/spj_guide/src/resources/source/sales_orders_table.sql
index 45dd0a0..b418082 100644
--- a/docs/spj_guide/src/resources/source/sales_orders_table.sql
+++ b/docs/spj_guide/src/resources/source/sales_orders_table.sql
@@ -1,14 +1,14 @@
-CREATE TABLE demo.sales.orders
+CREATE TABLE trafodion.sales.orders
( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
, order_date DATE DEFAULT DATE '2011-07-01' NOT NULL
, deliv_date DATE DEFAULT DATE '2011-08-01' NOT NULL
, salesrep NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
, custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, PRIMARY KEY (ordernum)
+, PRIMARY KEY ( ordernum )
) ;
-ALTER TABLE demo.sales.orders
- ADD CONSTRAINT demo.sales.date_constrnt CHECK (deliv_date >= order_date)
+ALTER TABLE trafodion.sales.orders
+ ADD CONSTRAINT trafodion.sales.date_constrnt CHECK ( deliv_date >= order_date )
;
CREATE INDEX xordrep ON orders
@@ -19,15 +19,15 @@ CREATE INDEX xordcus ON orders
( custnum
) ;
-CREATE VIEW demo.sales.ordrep AS SELECT
+CREATE VIEW trafodion.sales.ordrep AS SELECT
empnum
, last_name
, ordernum
, o.custnum
FROM
- demo.persnl.employee e
-, demo.sales.orders o
-, demo.sales.customer c
+ trafodion.persnl.employee e
+, trafodion.sales.orders o
+, trafodion.sales.customer c
WHERE e.empnum = o.salesrep
AND o.custnum = C.custnum
;
@@ -37,17 +37,17 @@ CREATE INDEX xcustnam ON customer
custname
) ;
-CREATE VIEW demo.sales.custlist AS SELECT
+CREATE VIEW trafodion.sales.custlist AS SELECT
custnum
, custname
, street
, city
, state
, postcode
-FROM demo.sales.customer
+FROM trafodion.sales.customer
;
-INSERT INTO demo.sales.orders VALUES
+INSERT INTO trafodion.sales.orders VALUES
( 100210, DATE '2011-04-10', DATE '2011-04-10', 220, 1234 )
, ( 100250, DATE '2011-01-23', DATE '2011-06-15', 220, 7777 )
, ( 101220, DATE '2011-07-21', DATE '2011-12-15', 221, 5635 )
@@ -63,4 +63,4 @@ INSERT INTO demo.sales.orders VALUES
, ( 800660, DATE '2011-10-09', DATE '2011-11-01', 568, 3210 )
;
-UPDATE STATISTICS FOR TABLE demo.sales.orders ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.sales.orders ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/sales_parts_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_parts_table.sql b/docs/spj_guide/src/resources/source/sales_parts_table.sql
index ed7d2fc..267a814 100644
--- a/docs/spj_guide/src/resources/source/sales_parts_table.sql
+++ b/docs/spj_guide/src/resources/source/sales_parts_table.sql
@@ -1,16 +1,16 @@
-CREATE TABLE demo.sales.parts
+CREATE TABLE trafodion.sales.parts
( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, partdesc CHARACTER (18) NO DEFAULT NOT NULL
, price NUMERIC (8, 2) NO DEFAULT NOT NULL
, qty_available NUMERIC (5) DEFAULT 0 NOT NULL
-, PRIMARY KEY (partnum)
+, PRIMARY KEY ( partnum )
) ;
CREATE INDEX xpartdes ON parts
( partdesc
) ;
-INSERT INTO demo.sales.parts VALUES
+INSERT INTO trafodion.sales.parts VALUES
( 186, '186 MegaByte Disk', 186186.86, 186 )
, ( 212, 'PC SILVER, 20 MB', 2500.00, 3525 )
, ( 244, 'PC GOLD, 30 MB', 3000.00, 4426 )
@@ -37,9 +37,9 @@ INSERT INTO demo.sales.parts VALUES
, ( 6400, 'STREAMING TAPE,M20', 550.00, 1268 )
, ( 6401, 'STREAMING TAPE,M60', 725.00, 1308 )
, ( 6500, 'DISK CONTROLLER', 95.00, 2532 )
-, ( 6603, 'PRINTER CONTROLLER', 45.00, 430 )
+, ( 6603, 'PRINTER CONTROLLER', 45.00, 430 )
, ( 7102, 'SMART MODEM, 1200', 275.00, 2200 )
, ( 7301, 'SMART MODEM, 2400', 425.00, 2332 )
;
-UPDATE STATISTICS FOR TABLE demo.sales.parts ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.sales.parts ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/sales_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/sales_schema.sql b/docs/spj_guide/src/resources/source/sales_schema.sql
index 3049491..f3867bd 100644
--- a/docs/spj_guide/src/resources/source/sales_schema.sql
+++ b/docs/spj_guide/src/resources/source/sales_schema.sql
@@ -1,2 +1,2 @@
-CREATE SCHEMA DEMO.SALES ;
-SET SCHEMA DEMO.SALES ;
+CREATE SCHEMA trafodion.sales ;
+SET SCHEMA trafodion.sales ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/supplierinfo.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/supplierinfo.java b/docs/spj_guide/src/resources/source/supplierinfo.java
index a75c617..c98a392 100644
--- a/docs/spj_guide/src/resources/source/supplierinfo.java
+++ b/docs/spj_guide/src/resources/source/supplierinfo.java
@@ -18,7 +18,7 @@ public static void supplierInfo( BigDecimal suppNum
PreparedStatement getSupplier =
conn.prepareStatement( "SELECT suppname, street, city, "
+ " state, postcode "
- + "FROM demo.invent.supplier "
+ + "FROM trafodion.invent.supplier "
+ "WHERE suppnum = ?"
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/supplyquantities.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/supplyquantities.java b/docs/spj_guide/src/resources/source/supplyquantities.java
index 466f444..59a6911 100644
--- a/docs/spj_guide/src/resources/source/supplyquantities.java
+++ b/docs/spj_guide/src/resources/source/supplyquantities.java
@@ -16,7 +16,7 @@ public static void supplyQuantities( int[] avgQty
conn.prepareStatement( "SELECT AVG(qty_on_hand), "
+ " MIN(qty_on_hand), "
+ " MAX(qty_on_hand) "
- + "FROM demo.invent.partloc"
+ + "FROM trafodion.invent.partloc"
) ;
ResultSet rs = getQty.executeQuery() ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/topSalesReps.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/topSalesReps.java b/docs/spj_guide/src/resources/source/topSalesReps.java
index 96be5db..beee8ca 100644
--- a/docs/spj_guide/src/resources/source/topSalesReps.java
+++ b/docs/spj_guide/src/resources/source/topSalesReps.java
@@ -26,10 +26,10 @@ public static void topSalesReps( int whichQuarter
PreparedStatement getTopReps =
conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
+ "e.last_name, totals.total "
- + "FROM demo.persnl.employee e, "
+ + "FROM trafodion.persnl.employee e, "
+ " ( SELECT o.salesrep, "
+ " SUM( od.unit_price * od.qty_ordered ) as total "
- + " FROM demo.sales.orders o, demo.sales.odetail od "
+ + " FROM trafodion.sales.orders o, trafodion.sales.odetail od "
+ " WHERE o.ordernum = od.ordernum "
+ " AND QUARTER( o.order_date ) = ? "
+ " GROUP BY o.salesrep "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
----------------------------------------------------------------------
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
index 2a33dcc..4ead225 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
@@ -61,7 +61,7 @@ transaction (BEGIN WORK…COMMIT WORK) or when AUTOCOMMIT is OFF. To run the
[cols="2*", options="headhttp://trafodion.apache.org/docs/sql_reference/index.html#limitser"]
|===
| Statement | What It Does
-| <<alter_library_statement,ALTER LIBRARY Statement>> | Updates the physical filename for a library object in a Trafodion database.
+// | <<alter_library_statement,ALTER LIBRARY Statement>> | Updates the physical filename for a library object in a Trafodion database.
| <<alter_table_statement,ALTER TABLE Statement>> | Changes attributes for a table.
| <<alter_user_statement,ALTER USER Statement>> | Changes attributes for a user.
| <<create_function_statement,CREATE FUNCTION Statement>> | Registers a user-defined function (UDF) written in C as a function within a Trafodion database.
@@ -155,7 +155,7 @@ authorization to access libraries or to execute SPJs or UDFs:
[cols="2*",options="header"]
|===
| Statement | What It Does
-| <<alter_library_statement,ALTER LIBRARY Statement>> | Updates the physical filename for a library object in a Trafodion database.
+// | <<alter_library_statement,ALTER LIBRARY Statement>> | Updates the physical filename for a library object in a Trafodion database.
| <<call_statement,CALL Statement>> | Initiates the execution of a stored procedure in Java (SPJ) in a Trafodion database.
| <<create_function_statement,CREATE FUNCTION Statement>> | Registers a user-defined function (UDF) written in C as a function within a Trafodion database.
| <<create_library_statement,CREATE LIBRARY Statement>> | Registers a library object in a Trafodion database.
@@ -235,6 +235,7 @@ within a table. These statistics are used to devise optimized access plans.
|===
+////
<<<
[[alter_library_statement]]
== ALTER LIBRARY Statement
@@ -258,7 +259,7 @@ ALTER LIBRARY [[catalog-name.]schema-name.]library-name
[[alter_library_syntax]]
=== Syntax Description of ALTER LIBRARY
-* `[[_catalog-name_.]_schema-name_.]_library-name_`
+* `\[[_catalog-name_.]_schema-name_.]_library-name_`
+
specifies the ANSI logical name of the library object, where each part of the name is a valid sql identifier with a maximum of 128 characters.
specify the name of a library object that has already been registered in the schema. if you do not fully qualify the library name, trafodion sql
@@ -305,7 +306,7 @@ ALTER LIBRARY sales.saleslib FILE Sales2.jar;`
```
ALTER LIBRARY myudfs FILE $TMUDFLIB;
```
-
+////
<<<
[[alter_table_statement]]
@@ -757,7 +758,7 @@ argument-list is:
+
specifies an ANSI logical name of the form:
+
-`[[_catalog-name_.]_schema-name_.]_procedure-name_`
+`\[[_catalog-name_.]_schema-name_.]_procedure-name_`
+
where each part of the name is a valid sql identifier with a maximum of 128 characters. for more information, see
<<identifiers,identifiers>> and <<database_object_names,database object names>>.
@@ -1184,7 +1185,7 @@ specifies the name of the function and any SQL parameters that correspond to the
+
specifies an ANSI logical name of the form:
+
-`[[_catalog-name_.]_schema-name_.]_function-name_`
+`\[[_catalog-name_.]_schema-name_.]_function-name_`
+
where each part of the name is a valid sql identifier with a maximum of 128 characters. for more information, see
<<identifiers,identifiers>> and <<database_object_names,database object names>>.
@@ -1241,7 +1242,7 @@ trafodion. see <<data_types,data types>>.
+
specifies the case-sensitive name of the external function’s method.
-* `library [[_catalog-name_.]_schema-name_.]_library-name_`
+* `library \[[_catalog-name_.]_schema-name_.]_library-name_`
+
specifies the ANSI logical name of a library containing the external function. if you do not fully qualify the
library name, trafodion sql qualifies it according to the schema of the current session.
@@ -1519,7 +1520,7 @@ CREATE LIBRARY [[catalog-name.]schema-name.]library-name
[[create_library_syntax]]
=== Syntax Description of CREATE LIBRARY
-* `[[_catalog-name_.]_schema-name_.]_library-name_`
+* `\[[_catalog-name_.]_schema-name_.]_library-name_`
+
specifies the ANSI logical name of the library object, where each part of the name is a valid sql
identifier with a maximum of 128 characters. specify a name that is unique and does not exist for
@@ -1649,26 +1650,26 @@ the SPJ method.
+
specifies an ANSI logical name of the form:
+
-`[[_catalog-name_.]_schema-name_.]_procedure-name_`
+`\[[_catalog-name_.]_schema-name_.]_procedure-name_`
+
-where each part of the name is a valid sql identifier with a maximum of 128 characters. for more information,
+where each part of the name is a valid SQL identifier with a maximum of 128 characters. For more information,
see <<identifiers,identifiers>> and <<database_object_names,database object names>>.
+
-specify a name that is unique and does not exist for any procedure or function in the same schema. trafodion sql
-does not support the overloading of procedure names. that is, you cannot register the same procedure name more than
+specify a name that is unique and does not exist for any procedure or function in the same schema. Trafodion
+does not support the overloading of procedure names. That is, you cannot register the same procedure name more than
once with different underlying SPJ methods.
+
-if you do not fully qualify the procedure name, trafodion sql qualifies it according to the schema of the current session.
+If you do not fully qualify the procedure name, then Trafodion qualifies it according to the schema of the current session.
-** _sql-parameter_
+** `_sql-parameter_`
+
-specifies an sql parameter that corresponds to the signature of the SPJ method:
+specifies an SQL parameter that corresponds to the signature of the SPJ method:
+
`[_parameter-mode_] [_sql-identifier_] _sql-datatype_`
*** `_parameter-mode_`
+
-specifies the mode in, out, or inout of a parameter. the default is in.
+specifies the mode `in`, `out`, or `inout` of a parameter. The default is `in`.
**** `in`
+
@@ -1676,19 +1677,19 @@ specifies a parameter that passes data to an SPJ.
**** `out`
+
-specifies a parameter that accepts data from an SPJ. the parameter must be an array.
+specifies a parameter that accepts data from an SPJ. The parameter must be an array.
**** `inout`
+
-specifies a parameter that passes data to and accepts data from an SPJ. the parameter must be an array.
+specifies a parameter that passes data to and accepts data from an SPJ. The parameter must be an array.
*** `_sql-identifier_`
+
-specifies an sql identifier for the parameter. for more information, see <<identifiers,identifiers>>.
+specifies an SQL identifier for the parameter. For more information, see <<identifiers,identifiers>>.
*** `_sql-datatype_`
+
-specifies an sql data type that corresponds to the java parameter of the SPJ method.
+specifies an SQL data type that corresponds to the Java parameter of the SPJ method.
+
_sql-datatype_ can be:
+
@@ -1733,11 +1734,11 @@ specifies the case-sensitive name of the SPJ method of the form:
+
`[_package-name_.]_class-name_._method-name_`
+
-the java method must exist in a java class file, _class-name_.class, within a library registered in the database.
-the java method must be defined as public and static and have a return type of void.
+The Java method must exist in a Java class file, _class-name_.class, within a library registered in the database.
+The Java method must be defined as `public` and `static` and have a return type of `void`.
+
-if the class file that contains the SPJ method is part of a package, you must also specify the package name.
-if you do not specify the package name, the create procedure statement fails to register the SPJ.
+If the class file that contains the SPJ method is part of a package, then you must also specify the package name.
+If you do not specify the package name, the create procedure statement fails to register the SPJ.
** `_java-signature_`
+
@@ -1745,44 +1746,44 @@ specifies the signature of the SPJ method and consists of:
+
`([_java-datatype_[, _java-datatype_]…])`
+
-the java signature is necessary only if you want to specify a java wrapper class (for example, java.lang.integer) instead of a java
-primitive data type (for example, int). an sql data type maps to a java primitive data type by default.
+The Java signature is necessary only if you want to specify a Java wrapper class (for example, `java.lang.integer`) instead of a java
+primitive data type (for example, `int`). An SQL data type maps to a Java primitive data type by default.
++
+The Java signature is case-sensitive and must be placed within parentheses, such as `(java.lang.integer, java.lang.integer`).
+The signature must specify each of the parameter data types in the order they appear in the Java method definition within
+the class file. Each Java data type that corresponds to an out or inout parameter must be followed by empty square
+brackets (`[ ]`), such as `java.lang.integer[]`.
+
-the java signature is case-sensitive and must be placed within parentheses, such as (java.lang.integer, java.lang.integer).
-the signature must specify each of the parameter data types in the order they appear in the java method definition within
-the class file. each java data type that corresponds to an out or inout parameter must be followed by empty square
-brackets ([ ]), such as java.lang.integer[].
-
<<<
*** `_java-datatype_`
+
-specifies a mappable java data type. for the mapping of the java data types to sql data types, see _sql-datatype_.
+Specifies a mappable Java data type. For the mapping of the Java data types to SQL data types, see _sql-datatype_.
-* `library [[_catalog-name_.]_schema-name_.]_library-name_`
+* `library \[[_catalog-name_.]_schema-name_.]_library-name_`
+
-specifies the ANSI logical name of a library containing the SPJ method. if you do not fully qualify the library name,
-trafodion sql qualifies it according to the schema of the current session.
+specifies the ANSI logical name of a library containing the SPJ method. If you do not fully qualify the library name,
+then Trafodion qualifies it according to the schema of the current session.
* `external security _external-security-type_`
+
determines the privileges, or rights, that users have when executing (or calling) the SPJ. An SPJ can have one of these
types of external security:
-** invoker determines that users can execute, or invoke, the stored procedure using the privileges of the user who invokes
-the stored procedure. this behavior is referred to as _invoker rights_ and is the default behavior if external security is
-not specified. invoker rights allow a user who has the execute privilege on the SPJ to call the SPJ using his or her existing
-privileges. in this case, the user must be granted privileges to access the underlying database objects on which the SPJ operates.
+** `invoker` determines that users can execute, or invoke, the stored procedure using the privileges of the user who invokes
+the stored procedure. This behavior is referred to as _invoker rights_ and is the default behavior if external security is
+not specified. Invoker rights allow a user who has the execute privilege on the SPJ to call the SPJ using his or her existing
+privileges. In this case, the user must be granted privileges to access the underlying database objects on which the SPJ operates.
+
-note: granting a user privileges to the underlying database objects gives the user direct access to those database objects,
-which could pose a risk to more sensitive or critical data to which users should not have access. for example, an SPJ
-might operate on a subset of the data in an underlying database object, but that database object might contain other
+NOTE: Granting a user privileges to the underlying database objects gives the user direct access to those database objects,
+which could pose a risk to more sensitive or critical data to which users should not have access. For example, an SPJ
+might operate on a subset of the data in an underlying database object but that database object might contain other
more sensitive or critical data to which users should not have access.
-** definer determines that users can execute, or invoke, the stored procedure using the privileges of the user who created
-the stored procedure. this behavior is referred to as _definer rights_. the advantage of definer rights is that users are
+** `definer` determines that users can execute, or invoke, the stored procedure using the privileges of the user who created
+the stored procedure. This behavior is referred to as _definer rights_. The advantage of definer rights is that users are
allowed to manipulate data by invoking the stored procedure without having to be granted privileges to the underlying
-database objects. that way, users are restricted from directly accessing or manipulating more sensitive or critical data in
-the database. however, be careful about the users to whom you grant execute privilege on an SPJ with definer external security
+database objects. That way, users are restricted from directly accessing or manipulating more sensitive or critical data in
+the database. However, be careful about the users to whom you grant execute privilege on an SPJ with definer external security
because those users will be able to execute the SPJ without requiring privileges to the underlying database objects.
<<<
@@ -1792,46 +1793,46 @@ specifies that the external user-defined routine is written in the java language
* `parameter style java`
+
-specifies that the run-time conventions for arguments passed to the external user-defined routine are those of the java language.
+specifies that the run-time conventions for arguments passed to the external user-defined routine are those of the Java language.
* `no sql`
+
-specifies that the SPJ cannot perform sql operations.
+specifies that the SPJ cannot perform SQL operations.
* `contains sql | modifies sql data | reads sql data`
+
-specifies that the SPJ can perform sql operations. all these options behave the same as contains sql, meaning that the SPJ
-can read and modify sql data. use one of these options to register a method that contains sql statements. if you do not specify
-an sql access mode, the default is contains sql.
+specifies that the SPJ can perform SQL operations. All these options behave the same as `contains sql`, meaning that the SPJ
+can read and modify SQL data. Use one of these options to register a method that contains SQL statements. Ff you do not specify
+an SQL access mode, then the default is `contains sql`.
* `dynamic result sets _integer_`
+
-specifies the maximum number of result sets that the SPJ can return. this option is applicable only if the method signature
-contains a java.sql.resultset[] object. if the method contains a result set object, the valid range is 1 to 255 inclusive.
-the actual number of result sets returned by the SPJ method can be less than or equal to this number. if you do not specify
-this option, the default value is 0 (zero), meaning that the SPJ does not return result sets.
+specifies the maximum number of result sets that the SPJ can return. This option is applicable only if the method signature
+contains a `java.sql.resultset[]` object. If the method contains a result set object, then the valid range is 1 to 255 inclusive.
+The actual number of result sets returned by the SPJ method can be fewer than or equal to this number. If you do not specify
+this option, then the default value is 0 (zero), meaning that the SPJ does not return result sets.
* `transaction required | no transaction required`
+
-determines whether the SPJ must run in a transaction inherited from the calling application (transaction required, the default
-option) or whether the SPJ runs without inheriting the calling application’s transaction (no transaction required). typically,
-you will want the stored procedure to inherit the transaction from the calling application. however, if the SPJ method does
-not access the database or if you want the stored procedure to manage its own transactions, you should set the stored
-procedure’s transaction attribute to no transaction required. for more information, see
+determines whether the SPJ must run in a transaction inherited from the calling application (`transaction required`, the default
+option) or whether the SPJ runs without inheriting the calling application’s transaction (`no transaction required`). Typically,
+you want the stored procedure to inherit the transaction from the calling application. However, if the SPJ method does
+not access the database or if you want the stored procedure to manage its own transactions, then you should set the stored
+procedure’s transaction attribute to no transaction required. For more information, see
<<effects_of_the_transaction_attribute_on_spjs,effects of the transaction attribute on SPJs>>.
<<<
* `deterministic | not deterministic`
+
specifies whether the SPJ always returns the same values for out and inout parameters for a given set of argument values
-(deterministic) or does not return the same values (not deterministic, the default option). if you specify deterministic,
-trafodion sql is not required to call the SPJ each time to produce results; instead, trafodion sql caches the results and
-reuses them during subsequent calls, thus optimizing the call statement.
+(`deterministic`) or does not return the same values (`not deterministic`, the default option). If you specify `deterministic`,
+Trafodion is not required to call the SPJ each time to produce results; instead, Trafodion caches the results and
+reuses them during subsequent calls, thus optimizing the CALL statement.
* `no isolate | isolate`
+
-specifies that the SPJ executes either in the environment of the database server (no isolate) or in an isolated environment
-(isolate, the default option). trafodion sql allows both options but always executes the SPJ in the udr server process (isolate).
+specifies that the SPJ executes either in the environment of the database server (`no isolate`) or in an isolated environment
+(`isolate`, the default option). Trafodion allows both options but always executes the SPJ in the UDR server process (`isolate`).
[[create_procedure_considerations]]
=== Considerations for CREATE PROCEDURE
@@ -1865,15 +1866,15 @@ _Using Transaction Control Statements or Methods_
If you specify TRANSACTION REQUIRED (the default option), a CALL statement automatically initiates a transaction if there is
no active transaction. In this case, you should not use transaction control statements (or equivalent JDBC transaction methods)
in the SPJ method. Transaction control statements include COMMIT WORK and ROLLBACK WORK, and the equivalent JDBC transaction
-methods are Connection.commit() and Connection.rollback(). If you try to use transaction control statements or methods in an
-SPJ method when the stored procedure’s transaction attribute is set to TRANSACTION REQUIRED, the transaction control statements
+methods are `Connection.commit()` and `Connection.rollback()`. If you try to use transaction control statements or methods in an
+SPJ method when the stored procedure’s transaction attribute is set to TRANSACTION REQUIRED, then the transaction control statements
or methods in the SPJ method are ignored, and the Java virtual machine (JVM) does not report any errors or warnings. When the
-stored procedure’s transaction attribute is set to TRANSACTION REQUIRED, you should rely on the transaction control statements
+stored procedure’s transaction attribute is set to TRANSACTION REQUIRED, then you should rely on the transaction control statements
or methods in the application that calls the stored procedure and allow the calling application to manage the transactions.
_Committing or Rolling Back a Transaction_
-If you do not use transaction control statements in the calling application, the transaction initiated by the CALL statement
+If you do not use transaction control statements in the calling application, then the transaction initiated by the CALL statement
might not automatically commit or roll back changes to the database. When AUTOCOMMIT is ON (the default setting), the database
engine automatically commits or rolls back any changes made to the database at the end of the CALL statement execution. However,
when AUTOCOMMIT is OFF, the current transaction remains active until the end of the client session or until you explicitly commit
@@ -1904,7 +1905,7 @@ procedure.
If you specify NO TRANSACTION REQUIRED and if the SPJ method creates a JDBC default connection, that connection will have autocommit
enabled by default. You can either use the autocommit transactions or disable autocommit (conn.setAutoCommit(false);) and use the
-JDBC transaction methods, Connection.commit() and Connection.rollback(), to commit or roll back work where needed.
+JDBC transaction methods, `Connection.commit()` and `Connection.rollback()`, to commit or roll back work where needed.
<<<
[[create_procedure_examples]]
@@ -1923,7 +1924,7 @@ CREATE PROCEDURE lowerprice()
MODIFIES SQL DATA;
```
+
-Because the procedure name is not qualified by a catalog and schema, Trafodion SQL qualifies it according to the current
+Because the procedure name is not qualified by a catalog and schema, Trafodion qualifies it according to the current
session settings, where the catalog is TRAFODION (by default) and the schema is set to SALES. Since the procedure needs
to be able to read and modify SQL data, MODIFIES SQL DATA is specified in the CREATE PROCEDURE statement.
+
@@ -2010,7 +2011,7 @@ CREATE PROCEDURE sales.ordersummary(IN on_or_after_date VARCHAR (20),
To invoke this SPJ, use this CALL statement:
+
```
-CALL neo.sales.ordersummary('01-01-2014', ?);
+CALL trafodion.sales.ordersummary('01-01-2014', ?);
```
+
The ORDERSUMMARY procedure returns this information about the orders on or after the specified date, 01-01-2014:
@@ -3417,7 +3418,7 @@ DROP FUNCTION [[catalog-name.]schema-name.]function-name
[[drop_function_syntax]]
=== Syntax Description of DROP FUNCTION
-* `[[_catalog-name_.]_schema-name_.]_function-name_`
+* `\[[_catalog-name_.]_schema-name_.]_function-name_`
+
specifies the ANSI logical name of the function, where each part of the name is a valid sql identifier with a maximum of
128 characters. specify the name of a function that has already been registered in the schema. if you do not fully qualify
@@ -3530,7 +3531,7 @@ DROP LIBRARY [[catalog-name.]schema-name.]library-name [restrict | cascade]
[[drop_library_syntax]]
=== Syntax Description of DROP LIBRARY
-* `[[_catalog-name_.]_schema-name_.]_library-name_`
+* `\[[_catalog-name_.]_schema-name_.]_library-name_`
+
specifies the ANSI logical name of the library object, where each part of the name is a valid sql identifier with a
maximum of 128 characters. specify the name of a library object that has already been registered in the schema. if
@@ -3600,7 +3601,7 @@ DROP PROCEDURE [[catalog-name.]schema-name.]procedure-name
[[drop_procedure_syntax]]
=== Syntax Description of DROP PROCEDURE
-* `[[_catalog-name_.]_schema-name_.]_procedure-name_`
+* `\[[_catalog-name_.]_schema-name_.]_procedure-name_`
+
specifies the ANSI logical name of the stored procedure in java (SPJ), where each part of the name is a valid sql
identifier with a maximum of 128 characters. specify the name of a procedure that has already been registered in the
@@ -4236,7 +4237,7 @@ displays a list of all the existing components.
displays the names of all the user-defined functions (UDFs) in the catalog and schema of the current session. By default,
the catalog is TRAFODION, and the schema is SEABASE.
-* `FUNCTIONS FOR LIBRARY [[_catalog-name_.]_schema-name_.]_library-name_`
+* `FUNCTIONS FOR LIBRARY \[[_catalog-name_.]_schema-name_.]_library-name_`
+
displays the UDFs that reference the specified library.
@@ -4258,7 +4259,7 @@ displays the libraries in the specified schema.
displays the names of all the procedures in the catalog and schema of the current session. by default, the catalog is trafodion,
and the schema is seabase.
-* `procedures for library [[_catalog-name_.]_schema-name_.]_library-name_`
+* `procedures for library \[[_catalog-name_.]_schema-name_.]_library-name_`
+
displays the procedures that reference the specified library.
@@ -4319,7 +4320,7 @@ and the schema is seabase.
+
displays the names of all the views in the specified schema. for the _catalog-name_, you can specify only trafodion.
-* `views on table [[_catalog-name_.]_schema-name_.]_table-name_`
+* `views on table \[[_catalog-name_.]_schema-name_.]_table-name_`
+
displays the names of all the views that were created for the specified table. if you do not qualify the table name with
catalog and schema names, get uses the catalog and schema of the current session. for the _catalog-name_, you can specify
@@ -4903,7 +4904,7 @@ specifies one or more component privileges to grant. The comma-separated list ca
|===
| Component | Component Privilege | Description
| SQL_OPERATIONS | ALTER | Privilege to alter database objects
-| | ALTER_LIBRARY | Privilege to alter libraries
+// | | ALTER_LIBRARY | Privilege to alter libraries
| | ALTER_TABLE | Privilege to alter tables
| | ALTER_VIEW | Privilege to alter views
| | CREATE | Privilege to create database objects
@@ -5614,7 +5615,7 @@ SQL>prepare empsal from
+>select salary from employee
+>where jobcode = 100;
-*** ERROR[4082] Table, view or stored procedure NEO.INVENT.EMPLOYEE does not exist or is inaccessible.
+*** ERROR[4082] Table, view or stored procedure TRAFODION.INVENT.EMPLOYEE does not exist or is inaccessible.
*** ERROR[8822] The statement was not prepared.
SQL>
```
@@ -6399,7 +6400,7 @@ specifies the row from the old table exposed by the embedded delete. the old tab
operation. new is not allowed. an implicit old.* return list is assumed for a delete operation that does not specify a return list.
<<<
-**** `_col-expr_ [[as] _name_]`
+**** `_col-expr_ [[AS] _name_]`
+
specifies a derived column determined by the evaluation of an sql value expression in the list. any column referred to in a value
expression is from the row in the old table exposed by the delete. the old table refers to column values before the delete operation.
[05/14] incubator-trafodion git commit: Backup checkin. The basic
edit of the guide has been done. Need to change it to refer to trafci
commands to complete.
Posted by db...@apache.org.
Backup checkin. The basic edit of the guide has been done. Need to change
it to refer to trafci commands to complete.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/6f5d4cc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/6f5d4cc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/6f5d4cc4
Branch: refs/heads/master
Commit: 6f5d4cc40b2e3b40e9075cd7c916ec693b11d534
Parents: 10e61eb
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Tue Mar 22 23:57:09 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Tue Mar 22 23:57:09 2016 -0600
----------------------------------------------------------------------
docs/spj_guide/pom.xml | 4 +
.../spj_guide/src/asciidoc/_chapters/about.adoc | 4 +-
.../src/asciidoc/_chapters/create_spjs.adoc | 498 ++--
.../src/asciidoc/_chapters/deploy_spjs.adoc | 366 +--
.../src/asciidoc/_chapters/execute_spjs.adoc | 595 +++--
.../asciidoc/_chapters/grant_privileges.adoc | 229 +-
.../_chapters/performance_troubleshooting.adoc | 458 ++--
.../src/asciidoc/_chapters/sample_database.adoc | 826 +-----
.../src/asciidoc/_chapters/sample_spjs.adoc | 2396 ++++++------------
docs/spj_guide/src/asciidoc/index.adoc | 23 +-
.../src/images/call-statement-elements.jpg | Bin 0 -> 16652 bytes
.../src/resources/source/Inventory.java | 120 +
.../spj_guide/src/resources/source/Payroll.java | 151 ++
docs/spj_guide/src/resources/source/Sales.java | 346 +++
.../src/resources/source/adjustSalary.java | 41 +
.../src/resources/source/employeeJob.java | 32 +
.../resources/source/invent_partloc_table.sql | 56 +
.../resources/source/invent_partsupp_table.sql | 128 +
.../src/resources/source/invent_schema.sql | 2 +
.../resources/source/invent_supplier_table.sql | 35 +
.../src/resources/source/lowerPrice.java | 44 +
.../src/resources/source/numDailyOrders.java | 29 +
.../src/resources/source/numMonthlyOrders.java | 41 +
.../src/resources/source/orderSummary.java | 76 +
.../src/resources/source/partData.java | 103 +
.../src/resources/source/partlocations.java | 42 +
.../src/resources/source/persnl_dept_table.sql | 70 +
.../resources/source/persnl_employee_table.sql | 99 +
.../src/resources/source/persnl_job_table.sql | 20 +
.../resources/source/persnl_project_table.sql | 45 +
.../src/resources/source/persnl_schema.sql | 2 +
.../src/resources/source/projectTeam.java | 25 +
.../resources/source/sales_customer_table.sql | 30 +
.../resources/source/sales_odetail_table.sql | 84 +
.../src/resources/source/sales_orders_table.sql | 66 +
.../src/resources/source/sales_parts_table.sql | 45 +
.../src/resources/source/sales_schema.sql | 2 +
.../src/resources/source/supplierinfo.java | 38 +
.../src/resources/source/supplyquantities.java | 32 +
.../src/resources/source/topSalesReps.java | 43 +
.../src/resources/source/totalPrice.java | 47 +
41 files changed, 3687 insertions(+), 3606 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/spj_guide/pom.xml b/docs/spj_guide/pom.xml
index d569367..8c2b3b4 100644
--- a/docs/spj_guide/pom.xml
+++ b/docs/spj_guide/pom.xml
@@ -184,6 +184,8 @@
<!-- Location of centralized stylesheet -->
<stylesheet>${basedir}/../shared/trafodion-manuals.css</stylesheet>
<project-version>${env.TRAFODION_VER}</project-version>
+ <project-name>${env.PROJECT_NAME}</project-name>
+ <project-logo>${env.PROJECT_LOGO}</project-logo>
<build-date>${maven.build.timestamp}</build-date>
<google-analytics-account>UA-72491210-1</google-analytics-account>
</attributes>
@@ -209,6 +211,8 @@
<idprefix/>
<idseparator>-</idseparator>
<project-version>${env.TRAFODION_VER}</project-version>
+ <project-name>${env.PROJECT_NAME}</project-name>
+ <project-logo>${env.PROJECT_LOGO}</project-logo>
<build-date>${maven.build.timestamp}</build-date>
</attributes>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/about.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/about.adoc b/docs/spj_guide/src/asciidoc/_chapters/about.adoc
index c4b69cd..ebf0801 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/about.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/about.adoc
@@ -24,7 +24,7 @@
////
= About This Document
-This guide describes how to develop, deploy, and manage Stored Procedures in Java (SPJs) on the Trafodion database.
+This guide describes how to develop, deploy, and manage Stored Procedures in Java (SPJs) on the {project-name} database.
== Intended Audience
This manual is intended for application programmers who are writing and compiling Java code for stored procedures
@@ -50,7 +50,7 @@ and lists steps for developing and deploying SPJs on Trafodion.
| *<<get-started, Get Started>>* | Describes the software requirements for using SPJs on the Trafodion database.
| *<<develop-spj-methods, Develop SPJ Methods>>* | Provides guidelines for writing and compiling a Java method to be used as the
body of a stored procedure.
-| *<<xeploy-spj-jar-files, Deploy SPJ JAR Files>>* | Explains how to deploy SPJ JAR files on the Trafodion database.
+| *<<deploy-spj-jar-files, Deploy SPJ JAR Files>>* | Explains how to deploy SPJ JAR files on the Trafodion database.
| *<<create-spjs, Create SPJs>>* | Explains how to create, drop, and alter an SPJ on the Trafodion database.
| *<<grant-privileges, Grant Privileges>>* | Explains how to grant and revoke privileges for executing SPJs on the
Trafodion database.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
index 11c2bc1..3a89bad 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
@@ -30,13 +30,14 @@ drop a procedure from the Trafodion database, use the HP Database Manager
Follow these procedures:
-* link:#_bookmark116["Create a Procedure" (page 37)]
-* link:#_bookmark128["Drop a Procedure" (page 42)]
-* link:#bookmark130["Display Procedures and Their Properties" (page 42)]
+* <<create-a-procedure, Create a Procedure>>
+* <<drop-a-procedure, Drop a Procedure>>
+* <<display-procedures-and-their-properties, Display Procedures and Their Properties>>
+
This chapter also covers:
-* link:#_bookmark114["Required Privileges for Creating or Dropping an
-SPJ" (page 37)]
-* link:#_bookmark136["Altering an SPJ and Its Java Bytecode" (page 44)]
+
+* <<required-privileges-for-creating-or-dropping-an-spj, Required Privileges for Creating or Dropping an SPJ>>
+* <<altering-an-spj-and-its-java-bytecode, Altering an SPJ and Its Java Bytecode>>
== Required Privileges for Creating or Dropping an SPJ
@@ -45,17 +46,16 @@ have the CREATE_PROCEDURE privilege for that schema, and you must have
the CREATE_PROCEDURE privilege for the SQL_OPERATIONS component. You
must also have the USAGE privilege for the library that will be used in
the creation of the stored procedure. For more information, see the
-requirements in link:#_bookmark116["Create a Procedure" (page 37)].
+requirements in <<create-a-procedure, Create a Procedure>>.
To drop an SPJ from a schema, you must be the schema owner, or you must
have the DROP_PROCEDURE privilege for that schema. For more information,
-see the requirements in link:#_bookmark128["Drop] link:#_bookmark128[a
-Procedure" (page 42)].
+see the requirements in <<drop-a-procedure, Drop a Procedure>>.
To display the current ownership and privileges, see
-link:#bookmark130["Display Procedures and Their Properties"]
-link:#bookmark130[(page 42)].
+<<display-procedures-and-their-properties, Display Procedures and Their Properties>>.
+[[create-a-procedure]]
== Create a Procedure
The Create Procedure tool registers an existing Java method as a stored
@@ -63,292 +63,250 @@ procedure in Java (SPJ) within SQL.
NOTE: HPDM creates procedures with default privileges only. For more
information about privileges for SPJs, see the Grant/Revoke Privileges
-Tool in HPDM or the GRANT PROCEDURE statement in the __Trafodion SQL
-Reference Manual__.
+Tool in HPDM or the GRANT PROCEDURE statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
Requirements:
* You must have the CREATE_PROCEDURE privilege for the SQL_OPERATIONS
component. For more information, see the component privileges in the _HP
Database Manager (HPDM) User Guide_ or the online help in HPDM.
+
* You must have been granted the USAGE privilege for the library that
will be used in the creation of the stored procedure. This privilege
provides you with read access to the library's underlying JAR file,
which contains the SPJ Java method. For more information, see the
-Grant/Revoke Privileges Tool in HPDM or the GRANT LIBRARY statement in
-the __Trafodion SQL Reference Manual__.
+Grant/Revoke Privileges Tool in HPDM or the GRANT LIBRARY statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+
* You must either be the owner of the schema or have the
CREATE_PROCEDURE privilege for the schema to create the procedure. The
schema owner can grant such a schema-level privilege to other users or
roles. For more information, see the Grant/Revoke Privileges Tool in
-HPDM or the GRANT SCHEMA statement in the _Trafodion SQL Reference
-Manual_
+HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
To create a procedure:
1. In HPDM, select the Database area.
+
2. Expand the navigation tree pane so that you can see the name of the
schema in which you want to create the procedure and the Procedures
folder under the schema.
+
3. Right-click the Procedures folder, and select Create Procedure. The
Create Procedure dialog box appears.
+
4. In the Procedure Name field, enter a name for the stored procedure.
For detailed information about the Procedure Name field, see
-link:#_bookmark120["Use the Create Procedure Dialog Box" (page 39)].
-5. In the Code group box, click [ Browse ] to find a Java method.
+<<use-the-create-procedure-dialog-box, Use the Create Procedure Dialog Box>>.
+5. In the Code group box, click [ Browse ] to find a Java method.
++
The [ Browse ] button opens Library Browser. Use the browser to select a
-method from a JAR file within a library. See link:#_bookmark109["Use the
-Library Browser" (page 35)]. If a library containing the JAR file does
-not exist on the Trafodion platform, you can create one by clicking the [
-Create ] button in the Library Browser. See link:#_bookmark98["Use the
-Create Library Dialog Box" (page 31)].
+method from a JAR file within a library. See
+<<use-the-library-browser, Use the Library Browser>>. If a library containing the JAR file does
+not exist on the Trafodion platform, you can create one by clicking the
+[ Create ] button in the Library Browser. See
+<<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>.
-1. In the Parameters group box, verify that the SQL parameters are
+6. In the Parameters group box, verify that the SQL parameters are
mapped correctly to the Java parameters of the SPJ method.
-
-NOTE: The result set parameters (java.sql.ResultSet[]) in the Java
++
+NOTE: The result set parameters (`java.sql.ResultSet[]`) in the Java
signature do not have corresponding SQL parameters.
-
++
a. To change an SQL parameter, such as the name of the parameter, the
-SQL data type,
-or the parameter mode or direction (IN, INOUT, or OUT), select the
-parameter and click
-
-[ Edit ]. The Edit Parameter dialog box appears.
-
-a. In the Edit Parameter dialog box, enter a new name for the
+SQL data type, or the parameter mode or direction (IN, INOUT, or OUT), select the
+parameter and click [ Edit ]. The Edit Parameter dialog box appears.
++
+b. In the Edit Parameter dialog box, enter a new name for the
parameter, select a different SQL data type, if permitted, or select a
different parameter mode (direction), if permitted.
-
++
When changing the parameter name, note that the parameter name:
-
++
* Is not case-sensitive
* Must not be a reserved word
* Must not contain spaces
* Must begin with a letter, digit, or underscore
-
++
When changing the SQL data type, select a data type that is appropriate
for the parameter of the underlying Java method. For information about
-SQL data types, see the __Trafodion SQL Reference Manual__.
-
+SQL data types, see the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
++
+////
For character string parameters, select either ISO88591 or UCS2
depending on the column definition in the database. For guidelines, see
the __Trafodion Character Sets Guide__.
+////
++
+c. Click [ OK ] to accept the changes, or click [ Cancel ] to quit the Edit Parameter dialog box.
++
+d. Repeat steps a to c for each parameter that you want to change.
-a. Click [ OK ] to accept the changes, or click [ Cancel ] to quit the
-Edit Parameter dialog box.
-b. Repeat steps a to c for each parameter that you want to change.
-
-1. In the Attributes group box, if your SPJ method returns result sets,
+7. In the Attributes group box, if your SPJ method returns result sets,
enter the maximum number of result sets to be returned for Number of
dynamic result sets. The valid range is 1 to 255 inclusive. The actual
number of result sets returned by the SPJ method can be less than or
equal to this number.
-
++
NOTE: The Number of dynamic result sets control is enabled only if the
method signature contains a java.sql.ResultSet[] object.
-1. If your SPJ method performs any SQL operations, select the Accesses
+8. If your SPJ method performs any SQL operations, select the Accesses
Database option.
-
++
NOTE: If you do not select the Accesses Database option and your SPJ
method performs SQL operations, SQL returns an error when trying to
execute the procedure.
-1. Select either Invoker or Definer for the external security of the
+9. Select either Invoker or Definer for the external security of the
stored procedure.
-
++
* The Invoker setting determines that users can execute, or invoke, the
stored procedure using the privileges of the user who invokes the stored
-procedure. This behavior is referred to as __invoker rights__.
+procedure. This behavior is referred to as _invoker rights_.
++
* The Definer setting determines that users can execute, or invoke, the
stored procedure using the privileges of the user who created the stored
-procedure. This behavior is referred to as __definer rights__. The
+procedure. This behavior is referred to as _definer rights_. The
advantage of definer rights is that users are allowed to manipulate data
by invoking the stored procedure without having to be granted privileges
to the underlying database objects.
++
+For more information, see <<understand-external-security, Understand External Security>>.
-For more information, see link:#_bookmark124["Understand External
-Security" (page 41)].
-
-1. For the Transaction Required attribute, select either Yes to require
+10. For the Transaction Required attribute, select either Yes to require
the procedure to run in a transaction inherited from the calling
application (the default behavior) or No to allow the procedure to run
without an inherited transaction. For more information, see
-link:#_bookmark157["Transaction] link:#_bookmark157[Behavior" (page
-49)].
-2. Click [ Create ] to create the procedure.
+<<transaction-behavior, Transaction Behavior>>.
-Related Topics
-
-link:#_bookmark120["Use the Create Procedure Dialog Box" (page 39)]
+11. Click [ Create ] to create the procedure.
== Use the Create Procedure Dialog Box
This table shows reference information for the Create Procedure dialog
box:
-[cols=",,",options="header",]
+[cols="20%,30%,50%",options="header",]
|===
-Group Box
-Control or Field
-Action
-Name
-____
-
-Catalog
-Name of the catalog where the procedure will be created. This is a
-read-only field.
-Schema
-Name of the schema where the procedure will be created. This is a
-read-only field.
-Procedure Name
-Enter a name for the procedure. The name must be unique and must not
+| Group Box | Control or Field | Action
+| *Name* | Catalog | Name of the catalog where the procedure is created. This is a read-only field.
+| | Schema | Name of the schema where the procedure is created. This is a read-only field.
+| | Procedure Name | Enter a name for the procedure. The name must be unique and must not
exist for any procedure, table, or view in the same schema. The
procedure name is not case-sensitive. The database engine automatically
qualifies the procedure name with the name of the catalog and schema in
-which you are creating the procedure. For example, if you enter
-*monthlyorders* as the procedure name, the database engine stores the
-procedure as
-
-__catalog-name__.__schema-name__.MONTHLYORDERS.
-Code
-Library
-Click [ Browse ] to navigate to a library or JAR file.
-Class Name
-Select a class.
-Method Name
-When you select a class, the method names and parameter types for that
-class appear in the right pane.
+which you are creating the procedure. +
+ +
+For example, if you enter *monthlyorders* as the procedure name, the database engine stores the
+procedure as `_catalog-name_._schema-name_.MONTHLYORDERS`.
+| *Code* | Library | Click [ Browse ] to navigate to a library or JAR file.
+| | Class Name | Select a class.
+| | Method Name | When you select a class, the method names and parameter types for that
+class appear in the right pane. +
+ +
NOTE: Only methods that can be used in a procedure are visible. For
-details, see link:#_bookmark123["Use a Method in a Procedure" (page
-40)].
-Parameters
-Name
-____
-
-Is the name for this SQL parameter.
-Direction
-IN passes data to a procedure
-INOUT passes data to and accepts data from a procedure. The parameter
-|===
-
-must be an array.
-
-
-* OUT accepts data from a procedure. The parameter must be an array.
-
-SQL Data Type
-
-Displays the SQL data type that is the best match for the Java signature
-in the
-
-Java Data Type column.
-
-Java Data Type Displays the signature for the Java method that you
-selected.
-
-[ Edit ] Click to edit the selected parameter.
-
-Group Box
-
-Control or Field
-
-Action
-
-Attributes
-
-Number of dynamic result sets
-
-Accesses Database
-
-Controls the maximum number of result sets the procedure can return.
-This control is enabled only if the method signature contains a
-java.sql.ResultSet[] object. If the method contains a result set object,
-the valid range is 1 to 255. This value is automatically set to zero if
-the selected Java method does not have a java.sql.ResultSet[] object.
-
-If selected, the procedure performs SQL operations. If cleared, the
-procedure does not perform SQL operations.
-
+details, see <<use-a-method-in-a-procedure, Use a Method in a Procedure>>.
+| *Parameters* | Name | Is the name for this SQL parameter.
+| | Direction |
+- IN passes data to a procedure +
+- INOUT passes data to and accepts data from a procedure. The parameter must be an array. +
+- OUT accepts data from a procedure. The parameter must be an array.
+| | SQL Data Type | Displays the SQL data type that is the best match for the Java signature in the Java Data Type column.
+| | Java Data Type | Displays the signature for the Java method that you selected.
+| | [ Edit ] | Click to edit the selected parameter.
+| *Attributes* | Number of dynamic result sets | Controls the maximum number of resulat sets the procedure can return. +
+ +
+This control is enabled only if the method signature contains a `java.sql.ResultSet[]` object. +
+ +
+If the method contains a result set object, then the valid range is 1 to 255. +
+ +
+ This value is automatically set to zero if the selected Java method does not have a `java.sql.ResultSet[]` object.
+| | Accesses Database | If selected, then the procedure performs SQL operations.
+If cleared, then the procedure does not perform SQL operations. +
+ +
NOTE: SQL returns an error when trying to execute the procedure if this
attribute is cleared and the procedure performs SQL operations.
-
-External Security
-
-Transaction Required
-
-Select either Invoker or Definer for the external security of the stored
-procedure.
-
-* The Invoker setting determines that users can execute, or invoke, the
+| | External Security | Select either Invoker or Definer for the external security of the stored procedure. +
+ +
+- The Invoker setting determines that users can execute, or invoke, the
stored procedure using the privileges of the user who invokes the stored
-procedure. This behavior is referred to as __invoker rights__.
+procedure. This behavior is referred to as _invoker rights_. +
+ +
* The Definer setting determines that users can execute, or invoke, the
stored procedure using the privileges of the user who created the stored
-procedure. This behavior is referred to as __definer rights__. The
+procedure. This behavior is referred to as _definer rights_. The
advantage of definer rights is that users are allowed to manipulate data
by invoking the stored procedure without having to be granted privileges
-to the underlying database objects.
-
-For more information, see link:#_bookmark124["Understand External
-Security" (page 41)].
-
+to the underlying database objects. +
+ +
+For more information, see <<understand-external-security, Understand External Security>>.
+| | Transaction Required |
Select either Yes to require the procedure to run in a transaction
inherited from the calling application (the default behavior) or No to
allow the procedure to run without an inherited transaction. For more
-information, see link:#_bookmark157["Transaction]
-link:#_bookmark157[Behavior" (page 49)].
+information, see <<transaction-behavior, Transaction Behavior>>.
+|===
-Related Topics
+*Related Topics*
-link:#_bookmark116["Create a Procedure" (page 37)]
+* <<create-a-procedure, Create a Procedure>>
+[[use-a-method-in-a-procedure]]
== Use a Method in a Procedure
To be used in a procedure, a Java method must:
* Be qualified as public static void.
-* Have a java.sql.ResultSet[] parameter at the end of the method
-signature if the method uses result sets.
-
-NOTE: There can be more than one java.sql.ResultSet[] parameter, but
-they must all be at the end of the method signature.
+* Have a `java.sql.ResultSet[]` parameter at the end of the method signature if the method uses result sets.
++
+NOTE: There can be more than one java.sql.ResultSet[] parameter, but they must all be at the end of the method signature.
* Have these parameter types:
++
+[cols="40%,60%", options="header"]
+|===
+| Parameter Type or Class | Type
+|
+| *character* |
+`java.lang.String` +
+`java.lang.String[]`
+| *numeric* |
+`java.lang.Integer` +
+`java.lang.Integer[]` +
+`java.lang.Long` +
+`java.lang.Long[]` +
+`java.lang.Float` +
+`java.lang.Float[]` +
+`java.lang.Double` +
+`java.lang.Double[]` +
+`java.math.BigDecimal` +
+`java.math.BigDecimal[]`
+| *date/timestamp* |
+`java.sql.Date` +
+`java.sql.Date[]` +
+`java.sql.Time` +
+`java.sql.Time[]` +
+`java.sql.Timestamp` +
+`java.sql.Timestamp[]`
+| *primitive short* |
+`short[]` +
+`int` +
+`int[]` +
+`long` +
+`long[]` +
+`float` +
+`float[]`+
+`double` +
+`double[]`
+| *result sets* | `java.sql.ResultSet[]`
+|===
-Parameter Type or Class
-
-Type
-
-character java.lang.String
-
-java.lang.String[]
-
-numeric java.lang.Integer
-
-java.lang.Integer[] java.lang.Long java.lang.Long[] java.lang.Float
-java.lang.Float[]
-
-Parameter Type or Class
-
-Type
-
-java.lang.Double java.lang.Double[] java.math.BigDecimal
-java.math.BigDecimal[]
-
-date/timestamp java.sql.Date
-
-java.sql.Date[] java.sql.Time java.sql.Time[] java.sql.Timestamp
-java.sql.Timestamp[]
-
-primitive short
-
-short[] int int[] long long[] float float[] double double[]
-
-result sets java.sql.ResultSet[]
-
+[[understand-external-security]]
== Understand External Security
The external security of an SPJ determines the privileges, or rights,
@@ -356,133 +314,121 @@ that users have when executing (or calling) the SPJ. An SPJ can be
created with one of these types of external security: invoker or
definer.
-If an SPJ is created with the invoker type of external security, the SPJ
-is executed with __invoker rights__. Invoker rights allow a user who has
-the execute privilege on the SPJ to call the SPJ using his or her
-existing privileges. In this case, the user must be granted privileges
-to access the underlying database objects on which the SPJ operates. If
-a user tries to call an SPJ that has invoker external security and that
-operates on database objects to which the user does not have privileges,
-the CALL statement fails with an error message indicating that the user
-does not have the appropriate permissions. Note: Granting a user
-privileges to the underlying database objects gives the user direct
-access to those database objects, which could pose a risk to more
+If an SPJ is created with the invoker type of external security, then the SPJ
+is executed with _invoker rights_.
+
+Invoker rights allow a user who has the execute privilege on the SPJ to call
+the SPJ using his or her existing privileges.
+
+In this case, the user must be granted privileges to access the underlying
+database objects on which the SPJ operates. If a user tries to call an SPJ
+that has invoker external security and that operates on database objects to
+which the user does not have privileges, then the CALL statement fails with
+an error message indicating that the user does not have the appropriate permissions.
+
+NOTE: Granting a user privileges to the underlying database objects gives the
+user direct access to those database objects, which could pose a risk to more
sensitive or critical data to which users should not have access. For
example, an SPJ might operate on a subset of the data in an underlying
database object, but that database object might contain other more
sensitive or critical data to which users should not have access.
-If an SPJ is created with the definer type of external security, the SPJ
-is executed with __definer rights__. Definer rights allow a user who has
-the execute privilege on an SPJ to call the SPJ using the privileges of
-the user who created the SPJ. In this case, the user does not require
-privileges to access the underlying database objects on which the SPJ
-operates. Instead, the user is allowed to access or manipulate data in
-the underlying database objects by invoking the SPJ. That way, users are
-restricted from directly accessing or manipulating more sensitive or
-critical data in the database. However, be careful about the users to
-whom you grant execute privilege on an SPJ with definer external
-security because those users will be able to execute the SPJ without
-requiring privileges to the underlying database objects.
-
-To set the external security of an SPJ, see link:#_bookmark116["Create a
-Procedure" (page 37)].
+If an SPJ is created with the definer type of external security, then the
+SPJ is executed with _definer rights_.
+
+Definer rights allow a user who has the execute privilege on an SPJ to
+call the SPJ using the privileges of the user who created the SPJ.
+
+In this case, the user does not require privileges to access the underlying
+database objects on which the SPJ operates. Instead, the user is allowed to
+access or manipulate data in the underlying database objects by invoking the
+SPJ. That way, users are restricted from directly accessing or manipulating
+more sensitive or critical data in the database.
+However, be careful about the users to whom you grant execute privilege on
+an SPJ with definer external security because those users will be able to
+execute the SPJ without requiring privileges to the underlying database objects.
+
+To set the external security of an SPJ, see <<create-a-procedure, Create a Procedure>>.
+
+[[drop-a-procedure]]
== Drop a Procedure
To drop a procedure, you must own the procedure or have the
DROP_PROCEDURE privilege for the schema. The schema owner can grant such
-a schema-level privilege to other users or roles. For example, if the
-schema owner granted you privileges to drop all objects in the schema,
-you could drop procedures. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the __Trafodion
-SQL Reference Manual__.
+a schema-level privilege to other users or roles.
+
+For example, if the schema owner granted you privileges to drop all objects in the schema,
+you could drop procedures. For more information, see the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual]
To drop a procedure:
1. Under the navigation tree pane, click the Database area.
+
2. Under My Systems, expand the tree for the Trafodion platform
containing the procedure until you can see the schema folder and the
Procedures folder underneath it.
+
3. Expand the Procedures folder.
+
4. Right-click the name of the procedure that you want to drop, and
select Drop Procedure. HPDM asks you to confirm the operation.
+
5. Click [ Yes ] to continue or [ No ] to quit the operation.
+[[display-procedures-and-their-properties}}
== Display Procedures and Their Properties
-To display the SPJs in a schema, use either HPDM or trafci:
-
-* link:#_bookmark131["Using HPDM to Display a Procedure in a Schema"
-(page 42)]
-* link:#_bookmark133["Using trafci to Display Procedures in a Schema"
-(page 43)]
-
-=== Using HPDM to Display a Procedure in a Schema
-
-To display one of the procedures in a schema:
-
-1. Start the HP Database Manager and log on using any user name.
-2. Click the Database area.
-3. In the navigation tree pane, select a Schema, and expand the schema
-so that you can see the object folders underneath it.
-4. Expand the Procedures tab in the right pane and select a procedure
-name, or open the Procedures folder and select a procedure name in the
-tree. HPDM displays the properties of the selected procedure in the
-right pane.
-
-image:media/image7.jpeg[image]
-
-For more information about the procedure properties displayed in HPDM,
-see the _HP Database_ __Manager (HPDM) User Guide__ or the online help
-in HPDM.
-
-==== Using trafci to Display Procedures in a Schema
-
In the trafci command-line interface, use the SHOW PROCEDURES command to
display the procedures in a schema. For example, this SHOW PROCEDURES
command displays a list of the procedures in the SALES schema:
-```
-SQL>**set schema demo.sales;**
+[source, sql]
+----
+SQL> SET SCHEMA demo.sales ;
---- SQL operation complete. SQL>**show procedures** PROCEDURE NAMES
+--- SQL operation complete.
+SQL> SHOW PROCEDURES
+
+PROCEDURE NAMES
--------------------------------------------------------------------------------
DAILYORDERS LOWERPRICE MONTHLYORDERS ORDERSUMMARY PARTDATA TOTAL PRICE
SQL>
-```
+----
You can also use a wild-card pattern to search for a particular
procedure. For example, this SHOW PROCEDURES command displays all the
procedures in the SALES schema that have price in their names:
-```
-SQL>**show procedures %price**
+[source, sql]
+----
+SQL> SHOW PROCEDURES %price
PROCEDURE NAMES
-
--------------------------------------------------------------------------------
LOWERPRICE TOTALPRICE
SQL>
-```
+----
-For more information about trafci, see the __HP Database Command
-Interface (trafci) Guide__.
+For more information about trafci, see the
+http://trafodion.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide].
-==== Altering an SPJ and Its Java Bytecode
+[[altering-an-spj-and-its-java-bytecode]]
+=== Altering an SPJ and Its Java Bytecode
Occasionally, you might need to update an SPJ or its Java bytecode. The
Java bytecode includes the SPJ's class file and any associated class
-files that are packaged in the SPJ JAR file. Suppose that you want to
-update the Java bytecode of an SPJ without changing the class name,
-method name, or Java signature of the SPJ method. In this case, you
-would alter the library by selecting the updated JAR file to upload to
-the Trafodion platform, replacing the previous JAR file for the library.
-For more information, see link:#_bookmark100["Alter a Library" (page
-32)].
+files that are packaged in the SPJ JAR file.
+
+Suppose that you want to update the Java bytecode of an SPJ without
+changing the class name, method name, or Java signature of the SPJ method.
+In this case, you would alter the library by selecting the updated JAR file
+to upload to the Trafodion database, replacing the previous JAR file for the
+library. For more information, see <<alter-a-library, Alter a Library>>.
NOTE: You are prevented from uploading a JAR file that is already in use
by another library in the catalog. This restriction prevents you from
@@ -492,11 +438,11 @@ If you plan to use a JAR file that contains an SPJ method that has a
different class name, method name, or signature than the original SPJ
method, you must drop the SPJ from the database before altering the
library. After altering the library, re-create the SPJ in the database.
+
You must also drop and re-create an SPJ to rename the procedure or
change the SQL parameter definitions even if the Java bytecode remains
-the same. For more information, see link:#_bookmark116["Create a
-Procedure" (page 37)] and link:#_bookmark128["Drop a Procedure" (page
-42)].
+the same. For more information, see <<create-a-procedure, Create a Procedure>> and
+<<drop-a-procedure, Drop a Procedure>>.
When you update an SPJ or its Java bytecode, try to avoid making those
changes when client applications are actively calling the SPJ. If you
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
index 67fed93..d3ca8e0 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
@@ -20,7 +20,7 @@
*/
////
-[[Deploy-spj-jar-files]]
+[[deploy-spj-jar-files]]
= Deploy SPJ JAR Files
After developing and packaging the SPJ code into JAR files, you must
@@ -40,7 +40,7 @@ to deploy JAR files.
See these instructions:
* <<create-a-library, Create a Library>>
-* <alter-a-library, Alter a Library>>
+* <<alter-a-library, Alter a Library>>
* <<drop-a-library, Drop a Library>>
* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
@@ -56,7 +56,7 @@ library, and you must have the required privileges for creating
libraries in order to deploy a JAR file. To create a library in a
schema, you must have both the CREATE_LIBRARY component privilege and
the CREATE_LIBRARY schema-level privilege for the schema. For more
-information, see the requirements in <create-a-library, Create a Library>>.
+information, see the requirements in <<create-a-library, Create a Library>>.
To alter a library in a schema, you must have both the UPDATE privilege
for the library and the ALTER_LIBRARY privilege for the schema. For more
@@ -94,8 +94,8 @@ library or have the CREATE_LIBRARY privilege for the schema to create
the library. The schema owner can grant such a schema-level privilege to
other users or roles. For more information, see the
-Grant/Revoke Privileges Tool in HPDM or the GRANT SCHEMA statement in
-the __Trafodion SQL Reference Manual__.
+Grant/Revoke Privileges Tool in HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
* The JAR file that you select for the library must contain valid Java
bytecode and must not be used by another library in the catalog.
@@ -103,10 +103,8 @@ bytecode and must not be used by another library in the catalog.
threshold if one has been set for HPDM's internal WMS service, the data
source, or the system defaults.
-For example, if the CONTROL QUERY DEFAULT (CQD),
-POS_ABSOLUTE_MAX_TABLE_SIZE,
-
-has been set for the HPS_MANAGEABILITY service, it will limit the size
+For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
+has been set for the `HPS_MANAGEABILITY` service, it limits the size
of JAR files that can be uploaded by HPDM. If the JAR file's size
exceeds the threshold, a warning message is displayed, and the file is
not uploaded. By default, this CQD is not set for HPDM's internal WMS
@@ -120,47 +118,45 @@ To upload a JAR file and create a library for the JAR file in a schema:
of the schema where you want to create the library.
3. Right-click the Libraries folder, and select Create Library. The
Create Library dialog box appears. For more information, see
-link:#_bookmark98["Use the Create Library Dialog Box" (page 31)].
+<<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>.
4. In the Create Library dialog box, enter a name for the library.
-
++
The name must be unique among the libraries in the schema and must not
-exceed 128 characters. The library name is not case-sensitive. For
-example, if you enter Payroll as the library name, the database engine
-stores the library as
-
-__catalog-name__.__schema-name__.PAYROLL. The database engine
+exceed 128 characters. The library name is not case-sensitive.
++
+For example, if you enter `Payroll` as the library name, the database engine
+stores the library as `_catalog-name_._schema-name_.PAYROLL`. The database engine
automatically qualifies the library name with the name of the catalog
and schema in which you are creating the library.
-1. Click the [ Browse ] button to locate and select a JAR file on the
-client workstation. The "Select a code file" dialog box appears.
-2. In the "Select a code file" dialog box, locate and select the JAR
+5. Click the [ Browse ] button to locate and select a JAR file on the
+client workstation. The *Select a code file* dialog box appears.
+
+6. In the *Select a code file* dialog box, locate and select the JAR
file on the client workstation, and click [ Open ] to return to the
Create Library dialog box. The Create Library dialog box displays the
full path of the JAR file in the Code File field.
-3. Click [ Create ] to create the library, or click [ Close ] to quit
-the dialog box without creating the library.
+7. Click [ Create ] to create the library, or click [ Close ] to quit
+the dialog box without creating the library.
++
If you click [ Create ], HPDM validates the JAR file, uploads the JAR
file, and creates a library for the JAR file in the schema.
-1. When notified that the library was created successfully, click [ OK
-].
-2. To upload another JAR file and create a library, repeat steps 4
+8. When notified that the library was created successfully, click [ OK ].
+9. To upload another JAR file and create a library, repeat steps 4
through 8.
-3. When you are done uploading JAR files and creating libraries, click
-the [ Close ] button image:media/image4.png[image]) to quit the Create
+10. When you are done uploading JAR files and creating libraries, click
+the [ Close ] button to quit the Create
Library dialog box and return to the HPDM main window.
-Related Topics
-
-link:#_bookmark98["Use the Create Library Dialog Box" (page 31)]
-link:#_bookmark100["Alter a Library" (page 32)]
-
-link:#_bookmark105["Drop a Library" (page 33)]
+*Related Topics*
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
-link:#_bookmark110["Display Libraries and Their Properties" (page 36)]
+* <<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>
+* <<alter-a-library, Alter a Library>>
+* <<drop-a-library, Drop a Library>>
+* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
+* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
[[use-the-create-library-dialog-box]]
== Use the Create Library Dialog Box
@@ -174,98 +170,83 @@ Requirements:
* You must have the CREATE_LIBRARY privilege for the SQL_OPERATIONS
component. For more information, see the component privileges in the _HP
Database Manager (HPDM) User Guide_ or the online help in HPDM.
+
* You must either be the owner of the schema where you will create the
library or have the CREATE_LIBRARY privilege for the schema to create
the library. The schema owner can grant such a schema-level privilege to
other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the __Trafodion
-SQL Reference Manual__.
+Privileges Tool in HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+
* The JAR file that you select for the library must contain valid Java
bytecode and must not be used by another library in the catalog.
+
* The JAR file that you select for the library must not exceed a size
threshold if one has been set for HPDM's internal WMS service, the data
source, or the system defaults.
-For example, if the CONTROL QUERY DEFAULT (CQD),
-POS_ABSOLUTE_MAX_TABLE_SIZE,
-
+For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
has been set for the HPS_MANAGEABILITY service, it will limit the size
-of JAR files that can be uploaded by HPDM. If the JAR file's size
-exceeds the threshold, a warning message is displayed, and the file is
-not uploaded. By default, this CQD is not set for HPDM's internal WMS
+of JAR files that can be uploaded by HPDM.
+
+If the JAR file's size exceeds the threshold, then a warning message is displayed,
+and the file is not uploaded. By default, this CQD is not set for HPDM's internal WMS
service, the data source, or the system defaults, and HPDM allows you to
upload JAR files of any size.
-[cols=",,",options="header",]
+[cols="20%,30%,50%",options="header",]
|===
-[[group-box]]
-Group Box
-Control or Field
-Description or Action
-Library
-Catalog
-Name of the catalog where the library will be created. This is a
-read-only field.
-Schema
-Name of the schema where the library will be created. This is a
-read-only field.
-Library Name
-Enter a name for the library. The name must be unique among the
-libraries in the schema and must not exceed 128 characters. The library
-name is not case-sensitive. For example, if you enter Payroll as the
-library name, the database engine stores the library as
-
-__catalog-name__.__schema-name__.PAYROLL. The database engine
-automatically qualifies the library name with the name of the catalog
-and schema in which you are creating the library.
-Code File
-Code File
-Click [ Browse ] to launch the "Select a code file" dialog box and
+| Group Box | Control or Field | Description or Action
+| *Library* | Catalog | Name of the catalog where the library is created. This is a read-only field.
+| | Schema | Name of the schema where the library is created. This is a read-only field.
+| | Library Name | Enter a name for the library. The name must be unique among the libraries
+in the schema and must not exceed 128 characters. The library name is not case-sensitive. +
+ +
+For example, if you enter Payroll as the library name, the database engine stores the library as
+`_catalog-name_._schema-name_.PAYROLL`. The database engine automatically qualifies the library name with the
+name of the catalog and schema in which you are creating the library.
+| *Code File* | Code File | Click [ Browse ] to launch the *Select a code file* dialog box and
navigate to a JAR file on the client workstation.
-[ Create ]
-Creates the library.
-[ Close ]
-Closes the dialog box without creating a library.
-[ Help ]
-Displays context-sensitive help for this dialog box.
+| | [ Create ] | Creates the library.
+| | [ Close ] | Closes the dialog box without creating a library.
+| | [ Help ] | Displays context-sensitive help for this dialog box.
|===
-[[related-topics]]
-Related Topics
-
-link:#_bookmark95["Create a Library" (page 29)]
-link:#_bookmark100["Alter a Library" (page 32)] link:#_bookmark105["Drop
-a Library" (page 33)]
+*Related Topics*
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
+* <<create-a-library, Create a Library>>
+* <<alter-a-library, Alter a Library>>
+* <<drop-a-library, Drop a Library>>
+* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
[[alter-a-library]]
== Alter a Library
-When you alter a library, you can change the underlying JAR file of the
-library.
+When you alter a library, you can change the underlying JAR file of the library.
Requirements:
* You must have been granted the UPDATE privilege for the library. For
more information, see the Grant/Revoke Privileges Tool in HPDM or the
-GRANT LIBRARY statement in the __Trafodion SQL Reference Manual__.
-* You must either be the owner of the schema where you will alter the
+GRANT LIBRARY statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+
+* You must either be the owner of the schema where you're altering the
library or have the ALTER_LIBRARY privilege for the schema to alter the
library. The schema owner can grant such a schema-level privilege to
other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the __Trafodion
-SQL Reference Manual__.
+Privileges Tool in HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+
* The JAR file that you select for the library must contain valid Java
bytecode and must not be used by another library in the catalog.
+
* The JAR file that you select for the library must not exceed a size
threshold if one has been set for HPDM's internal WMS service, the data
source, or the system defaults.
-For example, if the CONTROL QUERY DEFAULT (CQD),
-POS_ABSOLUTE_MAX_TABLE_SIZE,
-
-has been set for the HPS_MANAGEABILITY service, it will limit the size
+For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
+has been set for the HPS_MANAGEABILITY service, then it limits the size
of JAR files that can be uploaded by HPDM. If the JAR file's size
exceeds the threshold, a warning message is displayed, and the file is
not uploaded. By default, this CQD is not set for HPDM's internal WMS
@@ -282,18 +263,20 @@ to display the libraries within it.
you selected a system library, a dialog box appears warning you that you
cannot alter a system library. If you selected a user library, the Alter
Library dialog box appears. For more information, see
-link:#_bookmark103["Use the Alter] link:#_bookmark103[Library Dialog
-Box" (page 33)].
+<<use-the-alter-library-dialog-box, Use the Alter Library Dialog Box>>.
+
4. In the Alter Library dialog box, click the [ Browse ] button to
-locate and select a new JAR file on the client workstation. The "Select
-a code file" dialog box appears.
-5. In the "Select a code file" dialog box, locate and select the JAR
+locate and select a new JAR file on the client workstation. The *Select
+a code file* dialog box appears.
+
+5. In the *Select a code file* dialog box, locate and select the JAR
file on the client workstation, and click [ Open ] to return to the
Alter Library dialog box. The Alter Library dialog box displays the full
path of the new JAR file in the Code File field.
+
6. Click [ Alter ] to alter the library, or click [ Close ] to quit the
dialog box without altering the library.
-
++
If you click [ Alter ], a dialog box appears warning you that altering a
library might affect stored procedures that use the library and asking
if you wish to continue the alter operation. Click [ Yes ] to proceed,
@@ -301,19 +284,17 @@ or click [ No ] to cancel the operation. If you click [ Yes ], HPDM
validates the JAR file, uploads the JAR file, and alters the library in
the schema.
-1. When notified that the library was altered successfully, click [ OK
-] to close the Alter Library dialog box and return to the HPDM main
+7. When notified that the library was altered successfully, click
+[ OK ] to close the Alter Library dialog box and return to the HPDM main
window.
-Related Topics
-
-link:#_bookmark103["Use the Alter Library Dialog Box" (page 33)]
-link:#_bookmark95["Create a Library" (page 29)]
+*Related Topics*
-link:#_bookmark105["Drop a Library" (page 33)]
-
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
-link:#_bookmark110["Display Libraries and Their Properties" (page 36)]
+* <<use-the-alter-library-dialog-box, Use the Alter Library Dialog Box>>
+* <<create-a-library, Create a Library>>
+* <<drop-a-library, Drop a Library>>
+* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
+* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
[[use-the-alter-library-dialog-box]]
== Use the Alter Library Dialog Box
@@ -325,65 +306,53 @@ Requirements:
* You must have been granted the UPDATE privilege for the library. For
more information, see the Grant/Revoke Privileges Tool in HPDM or the
-GRANT LIBRARY statement in the __Trafodion SQL Reference Manual__.
+GRANT LIBRARY statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+
* You must either be the owner of the schema where you will alter the
library or have the ALTER_LIBRARY privilege for the schema to alter the
library. The schema owner can grant such a schema-level privilege to
other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the __Trafodion
-SQL Reference Manual__.
+Privileges Tool in HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+
* The JAR file that you select for the library must contain valid Java
bytecode and must not be used by another library in the catalog.
+
* The JAR file that you select for the library must not exceed a size
threshold if one has been set for HPDM's internal WMS service, the data
source, or the system defaults.
-
-For example, if the CONTROL QUERY DEFAULT (CQD),
-POS_ABSOLUTE_MAX_TABLE_SIZE,
-
-has been set for the HPS_MANAGEABILITY service, it will limit the size
++
+For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
+has been set for the HPS_MANAGEABILITY service, then it limits the size
of JAR files that can be uploaded by HPDM. If the JAR file's size
exceeds the threshold, a warning message is displayed, and the file is
-not uploaded. By default, this CQD is not set for HPDM's internal WMS
+not uploaded.
++
+By default, this CQD is not set for HPDM's internal WMS
service, the data source, or the system defaults, and HPDM allows you to
upload JAR files of any size.
-[cols=",,",options="header",]
+[cols="20%,30%,50%",options="header",]
|===
-[[group-box]]
-Group Box
-Control or Field
-Description or Action
-Library
-Catalog
-Name of the catalog where the library will be created. This is a
-read-only field.
-Schema
-Name of the schema where the library will be created. This is a
-read-only field.
-Library Name
-Name of the library. This is a read-only field.
-Code File
-Code File
-Click [ Browse ] to launch the "Select a code file" dialog box and
+| Group Box | Control or Field | Description or Action
+| *Library* | Catalog | Name of the catalog where the library is created. This is a read-only field.
+| | Schema | Name of the schema where the library is created. This is a read-only field.
+| | Library Name | Name of the library. This is a read-only field.
+| *Code File* | Code File | Click [ Browse ] to launch the "Select a code file" dialog box and
navigate to a new JAR file on the client workstation.
-[ Alter ]
-Alters the library.
-[ Close ]
-Closes the dialog box without altering the library.
-[ Help ]
-Displays context-sensitive help for this dialog box.
+| | [ Alter ] | Alters the library.
+| | [ Close ] | Closes the dialog box without altering the library.
+| | [ Help ] | Displays context-sensitive help for this dialog box.
|===
-[[related-topics]]
Related Topics
-link:#_bookmark100["Alter a Library" (page 32)]
-link:#_bookmark95["Create a Library" (page 29)] link:#_bookmark105["Drop
-a Library" (page 33)]
-
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
+* <<alter-a-library, Alter a Library>>
+* <<create-a-library, Create a Library>>
+* <<drop-a-library, Drop a Library>>
+* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
[[drop-a-library]]
== Drop a Library
@@ -398,8 +367,8 @@ Requirements:
library or have the DROP_LIBRARY privilege for the schema to drop the
library. The schema owner can grant such a schema-level privilege to
other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the __Trafodion
-SQL Reference Manual__.
+Privileges Tool in HPDM or the GRANT SCHEMA statement in the
+http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
To drop a library from the database:
@@ -417,13 +386,12 @@ fail with an error message.
5. Click [ Yes ] to drop the library, or click [ No ] to quit the
dialog box without dropping the library.
-Related Topics
-
-link:#_bookmark95["Create a Library" (page 29)]
-link:#_bookmark100["Alter a Library" (page 32)]
+*Related Topics*
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
-link:#_bookmark110["Display Libraries and Their Properties" (page 36)]
+* <<create-a-library, Create a Library>>
+* <<alter-a-library, Alter a Library>>
+* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
+* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
[[download-a-jar-file-from-a-library]]
== Download a JAR File From a Library
@@ -437,32 +405,36 @@ Database Manager (HPDM) User Guide_ or the online help in HPDM.
To download a JAR file from a library:
1. In HPDM, select the Database area.
+
2. In the navigation tree pane, expand the tree to display the folders
of the schema that contains the library, and expand the Libraries folder
to display the libraries within it.
+
3. Right-click the name of the library, and select Browse Library. The
Browse Library dialog box appears with the name of the library selected
in the tree pane and displayed in the right pane. For more information,
-see link:#_bookmark109["Use the Library Browser" (page 35)].
-4. Click the [ Download ] button. The Browse For Folder dialog box
+see <<use-the-library-browser, Use the Library Browser>>.
+
+4. Click the [ Download ] button. The *Browse For Folder* dialog box
appears.
-5. In the Browse For Folder dialog box, select a target folder on the
+
+5. In the *Browse For Folder* dialog box, select a target folder on the
client workstation for downloading the JAR file.
+
6. Click [ OK ] to start downloading the library's underlying JAR file
to the client workstation, or click [ Cancel ] to quit the Browse For
Folder dialog box and return to the Browse Library dialog box.
+
7. When notified that the download completed successfully, click [ OK ]
to return to the Browse Library dialog box.
-Related Topics
-
-link:#_bookmark109["Use the Library Browser" (page 35)]
-link:#_bookmark95["Create a Library" (page 29)]
-
-link:#_bookmark100["Alter a Library" (page 32)] link:#_bookmark105["Drop
-a Library" (page 33)]
+*Related Topics*
-link:#_bookmark110["Display Libraries and Their Properties" (page 36)]
+* <<use-the-library-browser, Use the Library Browser>>
+* <<create-a-library, Create a Library>>
+* <<alter-a-library, Alter a Library>>
+* <<drop-a-library, Drop a Library>>
+* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
[[use-the-library-browser]]
== Use the Library Browser
@@ -471,70 +443,7 @@ Depending on the context in which the Library Browser is launched, you
can use it to view, create, or drop libraries in the database; to
download a JAR file from a library in the database to the client
workstation; or to select a Java method in a library when creating a
-stored procedure. The Library Browser consists of these main parts:
-
-image:media/image5.jpeg[image]
-
-Use these buttons to perform various library management tasks:
-
-Button Function
-
-[ Create ]
-
-Launches the Create Library dialog box so that you can create a library
-in the database. In the navigation tree pane, select a schema name or
-the Libraries folder to activate this button. For more information, see
-link:#_bookmark98["Use the Create Library Dialog Box" (page 31)].
-
-[ Drop ]
-
-Launches the Drop Library dialog box so that you can delete a library
-from the database. In the navigation tree pane, select the name of a
-library to activate this button. For more information, see
-link:#_bookmark105["Drop a Library" (page 33)].
-
-[ Download ]
-
-[ Refresh ]
-
-Launches the Browse For Folder dialog box so that you can select a
-folder on the client workstation for downloading a library's underlying
-JAR file. In the navigation tree pane, select the name of a library to
-activate this button. For more information, see
-link:#_bookmark107["Download] link:#_bookmark107[a JAR File From a
-Library" (page 34)].
-
-Refreshes the data grid with the latest metadata.
-
-[ OK ]
-
-[ Close ]
-
-Accepts your selected Java method for the stored procedure that you are
-creating, closes the Library Browser, and returns to the Create
-Procedure dialog box. This button appears only if you launched the
-Library Browser from the Create Procedure tool. It is activated after
-you select a Java class name in the navigation tree pane and then select
-a Java method name in the data grid. For more information, see
-link:#_bookmark116["Create a Procedure" (page 37)] or
-link:#_bookmark120["Use] link:#_bookmark120[the Create Procedure Dialog
-Box" (page 39)].
-
-Closes the Library Browser.
-
-[ Help ] Displays context-sensitive help for the Library Browser.
-
-Related Topics
-
-link:#_bookmark95["Create a Library" (page 29)]
-
-link:#_bookmark98["Use the Create Library Dialog Box" (page 31)]
-link:#_bookmark105["Drop a Library" (page 33)]
-
-link:#_bookmark107["Download a JAR File From a Library" (page 34)]
-link:#_bookmark116["Create a Procedure" (page 37)]
-
-link:#_bookmark120["Use the Create Procedure Dialog Box" (page 39)]
+stored procedure.
[[display-libraries-and-their-properties]]
== Display Libraries and Their Properties
@@ -550,8 +459,3 @@ name, or open the Libraries
folder and select a library name in the tree. HPDM displays the
libraries for this schema.
-image:media/image6.jpeg[image]
-
-For more information about the library properties displayed in HPDM, see
-the _HP Database Manager (HPDM) User Guide_ or the online help in HPDM.
-
[13/14] incubator-trafodion git commit: Added new carousel to front
page with contributor logos.
Posted by db...@apache.org.
Added new carousel to front page with contributor logos.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/18119a60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/18119a60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/18119a60
Branch: refs/heads/master
Commit: 18119a608dd0a52ae9ab5b0fc9c02034a28c285e
Parents: 96d0392
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Thu Apr 7 00:23:01 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Thu Apr 7 00:23:01 2016 -0600
----------------------------------------------------------------------
docs/src/site/markdown/index.md | 23 +++++++++++++++----
.../resources/images/logo-carousel/slide-1.png | Bin 0 -> 58887 bytes
.../resources/images/logo-carousel/slide-2.png | Bin 0 -> 57783 bytes
docs/src/site/site.xml | 1 +
4 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18119a60/docs/src/site/markdown/index.md
----------------------------------------------------------------------
diff --git a/docs/src/site/markdown/index.md b/docs/src/site/markdown/index.md
index 0bc9f8e..8a960d6 100644
--- a/docs/src/site/markdown/index.md
+++ b/docs/src/site/markdown/index.md
@@ -56,6 +56,25 @@ Trafodion provides SQL access to structured, semi-structured, and unstructured d
<p><h5>The Trafodion team thanks all our contributors and mentors who made the release possible!</h5></p>
</td></tr></table>
+
+<center><h1>Contributing Companies</h1></center>
+
+---
+
+<!-- Carousel with logos -->
+
+#### Join Our Community
+
+
+
+Code, test, present, document, web sites, and many other ways to contribute.
+
+#### Add Your Logo Here
+
+
+
+Already a contributor? We need permission to add your company's logo here.
+
---
## About
@@ -85,7 +104,6 @@ Trafodion builds on the scalability, elasticity, and flexibility of Hadoop. Traf
* Hadoop and Linux distribution neutral
* Easy to add to your existing Hadoop infrastructure
-
---
<table>
@@ -101,7 +119,6 @@ Trafodion builds on the scalability, elasticity, and flexibility of Hadoop. Traf
<li><a href="architecture-overview.html">Architecture</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="faq.html">FAQ</a></li>
- <li><a href="roadmap.html">Roadmap</a></li>
</ul>
</td>
<td width="33%" valign="top">
@@ -114,7 +131,6 @@ Trafodion builds on the scalability, elasticity, and flexibility of Hadoop. Traf
<ul>
<li><a href="download.html">Download</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
- <li><a href="features.html">Features</a></li>
<li><a href="release-notes.html">Release Notes</a></li>
</ul>
</td>
@@ -129,7 +145,6 @@ Trafodion builds on the scalability, elasticity, and flexibility of Hadoop. Traf
<li><a href="contributing-redirect.html">Contribute</a></li>
<li><a href="mail-lists.html">Discuss</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TRAFODION/Apache+Trafodion+Home">Wiki</a></li>
- <li><a href="presentations.html">Presentations</a></li>
</ul>
</td>
</tr>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18119a60/docs/src/site/resources/images/logo-carousel/slide-1.png
----------------------------------------------------------------------
diff --git a/docs/src/site/resources/images/logo-carousel/slide-1.png b/docs/src/site/resources/images/logo-carousel/slide-1.png
new file mode 100644
index 0000000..ab6231d
Binary files /dev/null and b/docs/src/site/resources/images/logo-carousel/slide-1.png differ
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18119a60/docs/src/site/resources/images/logo-carousel/slide-2.png
----------------------------------------------------------------------
diff --git a/docs/src/site/resources/images/logo-carousel/slide-2.png b/docs/src/site/resources/images/logo-carousel/slide-2.png
new file mode 100644
index 0000000..db385b5
Binary files /dev/null and b/docs/src/site/resources/images/logo-carousel/slide-2.png differ
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18119a60/docs/src/site/site.xml
----------------------------------------------------------------------
diff --git a/docs/src/site/site.xml b/docs/src/site/site.xml
index 70b5098..eac4036 100644
--- a/docs/src/site/site.xml
+++ b/docs/src/site/site.xml
@@ -89,6 +89,7 @@
<sections>
<carousel />
<body />
+ <carousel />
<body />
<columns>2</columns>
<body />
[10/14] incubator-trafodion git commit: Backup checkin.
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
index 1383718..fa9dcda 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
@@ -37,6 +37,7 @@ sample name. For example, click on
link:/resources/source/Sales.java[Sales.java]
to download the sample sales class source file.
+<<<
[[procedures-in-the-sales-schema]]
== Procedures in the SALES Schema
@@ -72,6 +73,7 @@ The LOWERPRICE procedure determines which items are selling poorly (that
is, have less than 50 orders) and lowers the price of these items in the
database by 10 percent.
+<<<
[[java-method-lowerprice]]
==== Java Method: lowerPrice()
@@ -82,12 +84,13 @@ database by 10 percent.
include::{sourcedir}/lowerPrice.java[lowerPrice procedure source code]
----
+<<<
[[creating-the-procedure-lowerprice]]
==== Creating the Procedure: LOWERPRICE
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -101,7 +104,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| Attribute | Definition
| *procedure-ref* | `trafodion.sales.lowerprice`
| *sql-parameter* | Not applicable.
-| *external name* | `EXTERNAL NAME sales.lowerPrice`
+| *external name* | `EXTERNAL NAME 'Sales.lowerPrice'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -121,7 +124,7 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.sales.lowerprice( )
- EXTERNAL NAME 'sales.lowerPrice'
+ EXTERNAL NAME 'Sales.lowerPrice'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -129,6 +132,7 @@ CREATE PROCEDURE trafodion.sales.lowerprice( )
;
----
+<<<
[[calling-the-procedure-lowerprice]]
==== Calling the Procedure: LOWERPRICE
@@ -160,47 +164,50 @@ FROM
LEFT OUTER JOIN trafodion.sales.odetail o ON p.partnum = o.partnum
GROUP BY p.partnum, p.price
) AS allparts
-WHERE qtyOrdered < 51 ;
+WHERE qtyOrdered < 51
+ORDER BY partnum ASC
+;
----
The LOWERPRICE procedure lowers the price of items with 50 or fewer
orders by 10 percent in the database. For example, part number 3103, the
-LASER PRINTER, X1, has 40 orders and a price of 4200.00:
+LASER PRINTER, X1, has 40 orders and a price of 3402.00:
[source, sql]
----
PARTNUM QTYORDERED PRICE
------- -------------------- ----------
- 212 20 2500.00
- 3201 6 525.00
- 255 38 4000.00
- 5101 6 200.00
- 2002 46 1500.00
- 7102 18 275.00
- 3103 40 4200.00
+ 212 20 2025.00
+ 244 47 2430.00
+ 255 38 3240.00
+ 2002 46 1215.00
+ 2405 18 643.95
+ 3103 40 3402.00
... ... ...
--- 17 row(s) selected.
----
-The invocation of LOWERPRICE lowers the price of this item from 4200.00
-to 3780.00:
+<<<
+The invocation of LOWERPRICE lowers the price of this item from 3402.00
+to 3061.80:
[source, sql]
----
PARTNUM QTYORDERED PRICE
------- -------------------- ----------
- 6500 40 85.50
- 5504 23 148.50
- 2002 46 1350.00
- 3201 6 472.50
- 7102 18 247.50
- 3103 40 3780.00
+ 212 20 1822.50
+ 244 47 2187.00
+ 255 38 2916.00
+ 2002 46 1093.50
+ 2405 18 579.55
+ 3103 40 3061.80
... ... ...
--- 17 row(s) selected.
----
+<<<
[[dailyorders-procedure]]
=== DAILYORDERS Procedure
@@ -217,12 +224,13 @@ orders on that date to an output parameter.
include::{sourcedir}/numDailyOrders.java[numDailyOrders procedure source code]
----
+<<<
[[creating-the-procedure-dailyorders]]
==== Creating the Procedure: DAILYORDERS
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -236,8 +244,8 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| Attribute | Definition
| *procedure-ref* | `trafodion.sales.dailyorders`
| *sql-parameter-1* | `IN date1 DATE`
-| *sql-parameter-2* | `OUT number SIGNED INTEGER`
-| *external name* | `EXTERNAL NAME sales.numDailyOrders`
+| *sql-parameter-2* | `OUT number INTEGER`
+| *external name* | `EXTERNAL NAME 'Sales.numDailyOrders'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -257,9 +265,9 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.sales.dailyorders( IN date1 DATE
- , OUT number SIGNED INTEGER
+ , OUT number INTEGER
)
- EXTERNAL NAME 'sales.numDailyOrders'
+ EXTERNAL NAME 'Sales.numDailyOrders'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -267,6 +275,7 @@ CREATE PROCEDURE trafodion.sales.dailyorders( IN date1 DATE
;
----
+<<<
[[calling-the-procedure-dailyorders]]
==== Calling the Procedure: DAILYORDERS
@@ -288,13 +297,14 @@ specified date and returns this output in trafci:
----
NUMBER
-----------
-2
+ 2
--- SQL operation complete.
----
On March 19, 2011, there were two orders.
+<<<
[[monthlyorders-procedure]]
=== MONTHLYORDERS Procedure
@@ -316,8 +326,8 @@ include::{sourcedir}/numMonthlyOrders.java[numMonthlyOrders procedure source cod
==== Creating the Procedure: MONTHLYORDERS
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -330,9 +340,9 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
|===
| Attribute | Definition
| *procedure-ref* | `trafodion.sales.monthlyorders`
-| *sql-parameter-1* | `IN monthnum SIGNED INTEGER`
-| *sql-parameter-2* | `OUT ordernum SIGNED INTEGER`
-| *external name* | `EXTERNAL NAME sales.numMonthlyOrders`
+| *sql-parameter-1* | `IN monthnum INTEGER`
+| *sql-parameter-2* | `OUT ordernum INTEGER`
+| *external name* | `EXTERNAL NAME 'Sales.numMonthlyOrders'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -351,10 +361,10 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
-CREATE PROCEDURE trafodion.sales.monthlyorders( IN monthnum SIGNED INTEGER
- , OUT ordernum SIGNED INTEGER
+CREATE PROCEDURE trafodion.sales.monthlyorders( IN monthnum INTEGER
+ , OUT ordernum INTEGER
)
- EXTERNAL NAME 'sales.numMonthlyOrders'
+ EXTERNAL NAME 'Sales.numMonthlyOrders'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -362,6 +372,7 @@ CREATE PROCEDURE trafodion.sales.monthlyorders( IN monthnum SIGNED INTEGER
;
----
+<<<
[[calling-the-procedure-monthlyorders]]
==== Calling the Procedure: MONTHLYORDERS
@@ -373,7 +384,7 @@ To invoke the MONTHLYORDERS procedure in trafci:
[source, sql]
----
-SQL> CALL trafodion.sales.monthlyorders( 3,? ) ;
+SQL> CALL trafodion.sales.monthlyorders( 3, ? ) ;
----
The MONTHLYORDERS procedure determines the total number of orders during
@@ -383,13 +394,14 @@ a specified month and returns this output in trafci:
----
ORDERNUM
-----------
-4
+ 4
--- SQL operation complete.
----
In March, there were four orders.
+<<<
[[totalprice-procedure]]
=== TOTALPRICE Procedure
@@ -397,6 +409,7 @@ The TOTALPRICE procedure accepts the quantity, shipping speed, and price
of an item, calculates the total price, including tax and shipping
charges, and returns the total price to an input/output parameter.
+<<<
[[java-method-totalprice]]
==== Java Method: totalPrice()
@@ -411,8 +424,8 @@ include::{sourcedir}/totalPrice.java[totalPrice procedure source code]
==== Creating the Procedure: TOTALPRICE
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -428,7 +441,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| *sql-parameter-1* | `IN gty NUMERIC(18)`
| *sql-parameter-2* | `IN speed VARCHAR(10)`
| *sql-parameter-3* | `INOUT price NUMERIC(18,2)`
-| *external name* | `EXTERNAL NAME sales.totalPrice`
+| *external name* | `EXTERNAL NAME 'Sales.totalPrice ( java.math.BigDecimal, java.lang.String, java.math.BigDecimal[] )'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -448,10 +461,10 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.sales.totalprice( IN gty NUMERIC(18)
- , IN speed VARCHAR(10)
- , INOUT price NUMERIC(18,2)
- )
- EXTERNAL NAME 'sales.totalPrice'
+ , IN speed VARCHAR(10)
+ , INOUT price NUMERIC(18,2)
+ )
+ EXTERNAL NAME 'Sales.totalPrice ( java.math.BigDecimal, java.lang.String, java.math.BigDecimal[] )'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -481,7 +494,7 @@ returns this output in trafci:
----
p
--------------------
-253.97
+ 253.97
--- SQL operation complete.
----
@@ -489,6 +502,7 @@ p
The total price of 23 items, which cost $10 each and which are shipped
at the standard rate, is $253.97, including sales tax.
+<<<
[[partdata-procedure]]
=== PARTDATA Procedure
@@ -511,12 +525,13 @@ information about the part:
include::{sourcedir}/partData.java[partData procedure source code]
----
+<<<
[[creating-the-procedure-partdata]]
==== Creating the Procedure: PARTDATA
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -529,11 +544,11 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
|===
| Attribute | Definition
| *procedure-ref* | `trafodion.sales.partdata`
-| *sql-parameter-1* | `IN partnum SIGNED INTEGER`
+| *sql-parameter-1* | `IN partnum INTEGER`
| *sql-parameter-2* | `OUT partdesc CHARACTER(18)`
-| *sql-parameter-3* | `INOUT price NUMERIC(18,2)`
-| *sql-parameter-4* | `OUT qty_available SIGNED INTEGER`
-| *external name* | `EXTERNAL NAME sales.partData`
+| *sql-parameter-3* | `OUT price NUMERIC(18,2)`
+| *sql-parameter-4* | `OUT qty_available INTEGER`
+| *external name* | `EXTERNAL NAME 'Sales.partData'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -552,12 +567,12 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
-CREATE PROCEDURE trafodion.sales.partdata( IN partnum SIGNED INTEGER
+CREATE PROCEDURE trafodion.sales.partdata( IN partnum INTEGER
, OUT partdesc CHARACTER(18)
- , INOUT price NUMERIC(18,2)
- , OUT qty_available SIGNED INTEGER
+ , OUT price NUMERIC(18,2)
+ , OUT qty_available INTEGER
)
- EXTERNAL NAME 'sales.partData'
+ EXTERNAL NAME 'Sales.partData( int, java.lang.String[], java.math.BigDecimal[], int[] )'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -566,6 +581,7 @@ CREATE PROCEDURE trafodion.sales.partdata( IN partnum SIGNED INTEGER
;
----
+<<<
[[calling-the-procedure-partdata]]
==== Calling the Procedure: PARTDATA
@@ -577,16 +593,16 @@ To invoke the PARTDATA procedure in trafci:
[source, sql]
----
-SQL> CALL trafodion.sales.partdata(212,?,?,?) ;
+SQL> CALL trafodion.sales.partdata( 212, ?, ?, ?) ;
----
The PARTDATA procedure returns this information about part 212:
[source, sql]
----
-PARTDESC PRICE QTY_AVAILABLE
------------------- ---------- -------------
-PC SILVER, 20 MB 2500.00 3525
+PARTDESC PRICE QTY_AVAILABLE
+------------------ -------------------- -------------
+PC SILVER, 20 MB 1822.50 3525
ORDERNUM ORDER_DATE DELIV_DATE SALESREP CUSTNUM QTY_ORDERED
-------- ---------- ---------- -------- ------- --------------------
@@ -596,29 +612,30 @@ ORDERNUM ORDER_DATE DELIV_DATE SALESREP CUSTNUM QTY_ORDERED
--- 2 row(s) selected.
LOC_CODE PARTNUM QTY_ON_HAND
--------- ------- -----------
-G87 212 20
+-------- ------- -----------
A87 212 18
+G87 212 20
--- 2 row(s) selected.
PARTNUM SUPPNUM PARTCOST QTY_RECEIVED
-------- ------- ---------- ------------
- 212 3 1900.00 35
+------- ------- ---------- ------------
212 1 2000.00 20
+ 212 3 1900.00 35
--- 2 row(s) selected.
EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY
------ --------------- -------------------- ------- ------- ----------
-220 JOHN HUGHES 3200 300 33000.10
-227 XAVIER SEDLEMEYER 3300 300 30000.00
+ 220 JOHN HUGHES 3200 300 33000.10
+ 227 XAVIER SEDLEMEYER 3300 300 30000.00
--- 2 row(s) selected.
--- SQL operation complete.
----
+<<<
[[ordersummary-procedure]]
=== ORDERSUMMARY Procedure
@@ -645,12 +662,13 @@ ordered, and part description.
include::{sourcedir}/orderSummary.java[orderSummary procedure source code]
----
+<<<
[[creating-the-procedure-ordersummary]]
==== Creating the Procedure: ORDERSUMMARY
Before creating the procedure, create a library named `SALES`
-in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -665,7 +683,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| *procedure-ref* | `trafodion.sales.ordersummary`
| *sql-parameter-1* | `IN on_or_after_date VARCHAR(20)`
| *sql-parameter-2* | `OUT num_orders LARGEINT`
-| *external name* | `EXTERNAL NAME sales.orderSummary`
+| *external name* | `EXTERNAL NAME 'Sales.orderSummary'`
| *library* | `LIBRARY trafodion.sales.sales`
| *external security* | `invoker`^1^ +
+
@@ -687,7 +705,7 @@ For more information, see <<understand-external-security, Understand External S
CREATE PROCEDURE trafodion.sales.ordersummary( IN on_or_after_date VARCHAR(20)
, OUT num_orders LARGEINT
)
- EXTERNAL NAME 'sales.orderSummary'
+ EXTERNAL NAME 'Sales.orderSummary ( java.lang.String, long[] )'
LIBRARY trafodion.sales.sales
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -696,6 +714,7 @@ CREATE PROCEDURE trafodion.sales.ordersummary( IN on_or_after_date VARCHAR(20)
;
----
+<<<
[[calling-the-procedure-ordersummary]]
==== Calling the Procedure: ORDERSUMMARY
@@ -707,7 +726,7 @@ To invoke the ORDERSUMMARY procedure in trafci:
[source, sql]
----
-SQL> CALL trafodion.sales.ordersummary('01-01-2011', ?);
+SQL> CALL trafodion.sales.ordersummary( '2011-01-01', ? ) ;
----
The ORDERSUMMARY procedure returns this information about the orders on
@@ -717,27 +736,34 @@ or after the specified date, 01-01-2011:
----
NUM_ORDERS
--------------------
-13
+ 13
ORDERNUM NUM_PARTS AMOUNT ORDER_DATE LAST_NAME
-------- -------------------- -------------------- ---------- --------------------
-HUGHES HUGHES SCHNABL
-...
-
+ 100210 4 19020.00 2011-04-10 HUGHES
+ 100250 4 22625.00 2011-01-23 HUGHES
+ 101220 4 45525.00 2011-07-21 SCHNABL
+ ... ... ... ... ...
--- 13 row(s) selected.
ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
--------- ------- ---------- ----------- ------------------
+-------- ------- ---------- ----------- ------------------
100210 244 3500.00 3 PC GOLD, 30 MB
+ 100210 5100 150.00 10 MONITOR BW, TYPE 1
+ 100210 2403 620.00 6 DAISY PRINTER,T2
100210 2001 1100.00 3 GRAPHIC PRINTER,M1
- 100210 2403 620.00 6 DAISY PRINTER,T2
-... ... ... ... ...
+ 100250 6500 95.00 10 DISK CONTROLLER
+ 100250 6301 245.00 15 GRAPHIC CARD, HR
+ 100250 244 3500.00 4 PC GOLD, 30 MB
+ 100250 5103 400.00 10 MONITOR COLOR, M1
+ ... ... ... ... ...
--- 70 row(s) selected.
--- SQL operation complete.
----
+<<<
[[procedures-in-the-persnl-schema]]
== Procedures in the PERSNL Schema
@@ -764,6 +790,7 @@ include::{sourcedir}/Payroll.java[Sales Class source]
See the following sections for more information about each SPJ method.
+<<<
[[adjustsalary-procedure]]
=== ADJUSTSALARY Procedure
@@ -772,6 +799,7 @@ value and updates the employee's salary in the database based on that
percentage. This method also returns the updated salary to an output
parameter.
+<<<
[[java-method-adjustsalary]]
==== Java Method: adjustSalary()
@@ -782,12 +810,13 @@ parameter.
include::{sourcedir}/adjustSalary.java[adjustSalary procedure source code]
----
+<<<
[[creating-the-procedure-adjustsalary]]
==== Creating the Procedure: ADJUSTSALARY
Before creating the procedure, create a library named `PAYROLL`
-in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -803,7 +832,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| *sql-parameter-1* | `IN empnum NUMERIC(4)`
| *sql-parameter-2* | `IN percent FLOAT`
| *sql-parameter-3* | `OUT newsalary NUMERIC(8,2)`
-| *external name* | `EXTERNAL NAME persnl.adjustSalary`
+| *external name* | `EXTERNAL NAME 'Payroll.adjustSalary'`
| *library* | `LIBRARY trafodion.persnl.payroll`
| *external security* | `invoker`^1^ +
+
@@ -824,9 +853,9 @@ For more information, see <<understand-external-security, Understand External S
----
CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
, IN percent FLOAT
- , OUT newsalary NUMERIC(8,2)
+ , OUT newsalary NUMERIC(8,2)
)
- EXTERNAL NAME 'persnl.adjustSalary'
+ EXTERNAL NAME 'Payroll.adjustSalary'
LIBRARY trafodion.persnl.payroll
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -834,6 +863,7 @@ CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
;
----
+<<<
[[calling-the-procedure-adjustsalary]]
==== Calling the Procedure: ADJUSTSALARY
@@ -863,6 +893,7 @@ NEWSALARY
The salary of employee number 29 was originally $136,000.00 and became
$139,400.00 after the invocation of ADJUSTSALARY.
+<<<
[[employeejob-procedure]]
=== EMPLOYEEJOB Procedure
@@ -879,12 +910,13 @@ code or null value to an output parameter.
include::{sourcedir}/employeeJob.java[employeeJob procedure source code]
----
+<<<
[[creating-the-procedure-employeejob]]
==== Creating the Procedure: EMPLOYEEJOB
Before creating the procedure, create a library named `PAYROLL`
-in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use these values listed in the table below to define and execute the
@@ -897,13 +929,13 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
|===
| Attribute | Definition
| *procedure-ref* | `trafodion.persnl.employeejob`
-| *sql-parameter-1* | `IN empnum NUMERIC(4)`
+| *sql-parameter-1* | `IN empnum`
| *sql-parameter-2* | `OUT jobcode INT`
-| *external name* | `EXTERNAL NAME persnl.employeeJob (int, java.lang.Integer[])`
+| *external name* | `EXTERNAL NAME 'Payroll.employeeJob ( int, java.lang.Integer[] )'`
| *library* | `LIBRARY trafodion.persnl.payroll`
| *external security* | `invoker`^1^ +
+
-Choice depends on your security requirements, you can select `definer` instead.
+ Choice depends on your security requirements, you can select `definer` instead.
For more information, see <<understand-external-security, Understand External Security>>.
| *language java* | `LANGUAGE JAVA`
| *parameter style java* | `PARAMETER STYLE JAVA`
@@ -918,10 +950,10 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
-CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
- , OUT jobcode INT
+CREATE PROCEDURE trafodion.persnl.employeejob( IN empnum INT
+ , OUT jobcode INT
)
- EXTERNAL NAME 'persnl.employeeJob (int, java.lang.Integer[])'
+ EXTERNAL NAME 'Payroll.employeeJob ( int, java.lang.Integer[] )'
LIBRARY trafodion.persnl.payroll
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -929,6 +961,7 @@ CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
;
----
+<<<
[[calling-the-procedure-employeejob]]
==== Calling the Procedure: EMPLOYEEJOB
@@ -950,13 +983,14 @@ this output in trafci:
----
JOBCODE
-----------
-900
+ 900
--- SQL operation complete.
----
The job code for employee number 337 is 900.
+<<<
[[projectteam-procedure]]
=== PROJECTTEAM Procedure
@@ -974,12 +1008,13 @@ assigned to that project.
include::{sourcedir}/projectTeam.java[projectTeam procedure source code]
----
+<<<
[[creating-the-procedure-projectteam]]
==== Creating the Procedure: PROJECTTEAM
Before creating the procedure, create a library named `PAYROLL`
-in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -993,7 +1028,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| Attribute | Definition
| *procedure-ref* | `trafodion.persnl.projectteam`
| *sql-parameter-1* | `IN projectcode INTEGER`
-| *external name* | `EXTERNAL NAME persnl.projectTeam`
+| *external name* | `EXTERNAL NAME 'Payroll.projectTeam'`
| *library* | `LIBRARY trafodion.persnl.payroll`
| *external security* | `invoker`^1^ +
+
@@ -1013,9 +1048,8 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.persnl.projectteam( IN projectcode INTEGER
- , OUT jobcode INT
- )
- EXTERNAL NAME 'persnl.projectTeam'
+ )
+ EXTERNAL NAME 'Payroll.projectTeam'
LIBRARY trafodion.persnl.payroll
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -1024,6 +1058,7 @@ CREATE PROCEDURE trafodion.persnl.projectteam( IN projectcode INTEGER
;
----
+<<<
[[calling-the-procedure-projectteam]]
==== Calling the Procedure: PROJECTTEAM
@@ -1054,6 +1089,7 @@ EMPNUM FIRST_NAME LAST_NAME LOCATION
--- SQL operation complete.
----
+<<<
[[topsalesreps-procedure]]
=== TOPSALESREPS Procedure
@@ -1063,6 +1099,7 @@ months) and returns the employee number, first name, last name, and sale
figures of the top five sales representatives who had the highest sales
(unit_price * qty_ordered) that quarter.
+<<<
[[java-method-topsalesreps]]
==== Java Method: topSalesReps()
@@ -1073,12 +1110,13 @@ figures of the top five sales representatives who had the highest sales
include::{sourcedir}/topSalesReps.java[topSalesReps procedure source code]
----
+<<<
[[creating-the-procedure-topsalesreps]]
==== Creating the Procedure: TOPSALESREPS
Before creating the procedure, create a library named `PAYROLL`
-in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -1092,7 +1130,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| Attribute | Definition
| *procedure-ref* | `trafodion.persnl.topsalesreps`
| *sql-parameter-1* | `IN whichquarter INTEGER`
-| *external name* | `EXTERNAL NAME persnl.topSalesReps`
+| *external name* | `EXTERNAL NAME 'Payroll.topSalesReps'`
| *library* | `LIBRARY trafodion.persnl.payroll`
| *external security* | `invoker`^1^ +
+
@@ -1113,7 +1151,7 @@ For more information, see <<understand-external-security, Understand External S
----
CREATE PROCEDURE trafodion.persnl.topsalesreps( IN whichquarter INTEGER
)
- EXTERNAL NAME 'persnl.topSalesReps'
+ EXTERNAL NAME 'Payroll.topSalesReps'
LIBRARY trafodion.persnl.payroll
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -1122,6 +1160,7 @@ CREATE PROCEDURE trafodion.persnl.topsalesreps( IN whichquarter INTEGER
;
----
+<<<
[[calling-the-procedure-topsalesreps]]
==== Calling the Procedure: TOPSALESREPS
@@ -1141,19 +1180,20 @@ sales representatives during the first fiscal quarter:
[source, sql]
----
-FIRST_NAME LAST_NAME TOTAL
---------------- -------------------- --------------------
-XAVIER SEDLEMEYER 172460.00
-HERB ALBERT 67025.00
-MARTIN SCHAEFFER 52000.00
-HEIDI WEIGL 28985.00
-JOHN HUGHES 22625.00
+EMPNUM FIRST_NAME LAST_NAME TOTAL
+------ --------------- -------------------- --------------------
+ 227 XAVIER SEDLEMEYER 172460.00
+ 231 HERB ALBERT 67025.00
+ 222 MARTIN SCHAEFFER 52000.00
+ 226 HEIDI WEIGL 28985.00
+ 220 JOHN HUGHES 22625.00
--- 5 row(s) selected.
--- SQL operation complete.
----
+<<<
[[procedures-in-the-invent-schema]]
== Procedures in the INVENT Schema
@@ -1178,6 +1218,7 @@ include::{sourcedir}/Inventory.java[Inventory Class source]
See the following sections for more information about each SPJ method.
+<<<
[[supplierinfo-procedure]]
=== SUPPLIERINFO Procedure
@@ -1195,12 +1236,13 @@ parameters.
include::{sourcedir}/supplierInfo.java[supplierInfo procedure source code]
----
+<<<
[[creating-the-procedure-supplierinfo]]
==== Creating the Procedure: SUPPLIERINFO
Before creating the procedure, create a library named `INVENTORY`
-in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -1213,13 +1255,14 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
|===
| Attribute | Definition
| *procedure-ref* | `trafodion.invent.supplierinfo`
-| *sql-parameter-1* | `IN empnum NUMERIC(4)`
-| *sql-parameter-2* | `IN suppnum CHARACTER(18)`
+| *sql-parameter-1* | `IN suppnum NUMERIC(4)`
+| *sql-parameter-2* | `OUT suppname CHARACTER(18)`
| *sql-parameter-3* | `OUT address CHARACTER(22)`
| *sql-parameter-4* | `OUT city CHARACTER(14)`
| *sql-parameter-5* | `OUT state CHARACTER(12)`
| *sql-parameter-6* | `OUT zipcode CHARACTER(10)`
-| *external name* | `EXTERNAL NAME persnl.supplierInfo`
+| *external name* |
+`EXTERNAL NAME 'Inventory.supplierInfo ( java.math.BigDecimal, java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[] )''
| *library* | `LIBRARY trafodion.invent.inventory`
| *external security* | `invoker`^1^ +
+
@@ -1235,17 +1278,23 @@ For more information, see <<understand-external-security, Understand External S
|===
^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
-
+
[source, sql]
----
-CREATE PROCEDURE trafodion.invent.supplierinfo( IN empnum NUMERIC(4)
- , IN suppnum CHARACTER(18)
- , OUT address CHARACTER(22)
- , OUT city CHARACTER(14)
- , OUT state CHARACTER(12)
- , OUT zipcode CHARACTER(10)
+CREATE PROCEDURE trafodion.invent.supplierinfo( IN suppnum NUMERIC(4)
+ , OUT suppname CHARACTER(18)
+ , OUT address CHARACTER(22)
+ , OUT city CHARACTER(14)
+ , OUT state CHARACTER(12)
+ , OUT zipcode CHARACTER(10)
)
- EXTERNAL NAME 'persnl.supplierInfo'
+ EXTERNAL NAME 'Inventory.supplierInfo ( java.math.BigDecimal
+ , java.lang.String[]
+ , java.lang.String[]
+ , java.lang.String[]
+ , java.lang.String[]
+ , java.lang.String[]
+ )'
LIBRARY trafodion.invent.inventory
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -1253,6 +1302,7 @@ CREATE PROCEDURE trafodion.invent.supplierinfo( IN empnum NUMERIC(4)
;
----
+<<<
[[calling-the-procedure-supplierinfo]]
==== Calling the Procedure: SUPPLIERINFO
@@ -1273,13 +1323,14 @@ this output in trafci:
```
SUPPNAME ADDRESS CITY STATE ZIPCODE
------------------ ---------------------- -------------- ------------ ---------
-Schroeder's Ltd 212 Strasse Blvd West Hamburg Rhode Island 22222
+Schroeder's Ltd 212 Strasse Blvd West Hamburg Rhode Island 22222
--- SQL operation complete.
```
Supplier number 25 is Schroeder's Ltd. and is located in Hamburg, Rhode Island.
+<<<
[[supplyquantities-procedure]]
=== SUPPLYQUANTITIES Procedure
@@ -1297,12 +1348,13 @@ parameters.
include::{sourcedir}/supplyQuantities.java[supplyQuantities procedure source code]
----
+<<<
[[creating-the-procedure-supplyquantities]]
==== Creating the Procedure: SUPPLYQUANTITIES
Before creating the procedure, create a library named `INVENTORY`
-in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -1318,7 +1370,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| *sql-parameter-1* | `OUT avrg INT`
| *sql-parameter-2* | `OUT minm INT`
| *sql-parameter-3* | `OUT maxm INT`
-| *external name* | `EXTERNAL NAME persnl.supplyQuantities`
+| *external name* | `EXTERNAL NAME 'Inventory.supplyQuantities'`
| *library* | `LIBRARY trafodion.invent.inventory`
| *external security* | `invoker`^1^ +
+
@@ -1338,10 +1390,10 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.invent.supplyquantities( OUT avrg INT
- , OUT minm INT
- , OUT maxm INT
+ , OUT minm INT
+ , OUT maxm INT
)
- EXTERNAL NAME 'persnl.supplyQuantities'
+ EXTERNAL NAME 'Inventory.supplyQuantities'
LIBRARY trafodion.invent.inventory
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -1349,6 +1401,7 @@ CREATE PROCEDURE trafodion.invent.supplyquantities( OUT avrg INT
;
----
+<<<
[[calling-the-procedure-supplyquantities]]
==== Calling the Procedure: SUPPLYQUANTITIES
@@ -1360,7 +1413,7 @@ To invoke the SUPPLYQUANTITIES procedure in trafci:
[source, sql]
----
-SQL> CALL trafodion.invent.supplynumbers( ?,?,? ) ;
+SQL> CALL trafodion.invent.supplyquantities( ?,?,? ) ;
----
The SUPPLYQUANTITIES procedure returns this output in trafci:
@@ -1377,6 +1430,7 @@ AVRG MINM MAXM
The average number of items in inventory is 167, the minimum number is
0, and the maximum number is 1132.
+<<<
[[partlocations-procedure]]
=== PARTLOCATIONS Procedure
@@ -1384,6 +1438,7 @@ The PARTLOCATIONS procedure accepts a part number and quantity and returns a
set of location codes that have the exact quantity and a set of location
codes that have more than that quantity.
+<<<
[[java-method-partlocations]]
==== Java Method: partLocations()
@@ -1395,12 +1450,13 @@ include::{sourcedir}/partLocations.java[partLocations procedure source code]
----
+<<<
[[creating-the-procedure-partlocs]]
==== Creating the Procedure: PARTLOCS
Before creating the procedure, create a library named `INVENTORY`
-in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
-Trafodion platform for that library. For more information, see
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to
+{project-name} for that library. For more information, see
<<create-a-library, Create a Library>>.
After creating the library, use the values listed in the table below to define and execute the
@@ -1415,7 +1471,7 @@ CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create
| *procedure-ref* | `trafodion.invent.partlocs`
| *sql-parameter-1* | `IN partnum INT`
| *sql-parameter-2* | `IN qty INT`
-| *external name* | `EXTERNAL NAME persnl.partLocations`
+| *external name* | `EXTERNAL NAME 'Inventory.partLocations'`
| *library* | `LIBRARY trafodion.invent.inventory`
| *external security* | `invoker`^1^ +
+
@@ -1435,10 +1491,9 @@ For more information, see <<understand-external-security, Understand External S
[source, sql]
----
CREATE PROCEDURE trafodion.invent.partlocs( IN partnum INT
- , IN qty INT
- , OUT maxm INT
+ , IN qty INT
)
- EXTERNAL NAME 'persnl.partLocations'
+ EXTERNAL NAME 'Inventory.partLocations'
LIBRARY trafodion.invent.inventory
LANGUAGE JAVA
PARAMETER STYLE JAVA
@@ -1447,6 +1502,7 @@ CREATE PROCEDURE trafodion.invent.partlocs( IN partnum INT
;
----
+<<<
[[calling-the-procedure-partlocs]]
==== Calling the Procedure: PARTLOCS
@@ -1469,7 +1525,7 @@ more than 18 of those parts:
----
LOC_CODE PARTNUM QTY_ON_HAND
-------- ------- -----------
-A87 212 18
+G87 212 20
--- 1 row(s) selected.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/index.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/index.adoc b/docs/spj_guide/src/asciidoc/index.adoc
index f66513d..19304c5 100644
--- a/docs/spj_guide/src/asciidoc/index.adoc
+++ b/docs/spj_guide/src/asciidoc/index.adoc
@@ -44,57 +44,11 @@
// processing of files found in directories starting with an _. This
// prevents each chapter being built as its own book.
-**License Statement**
-
-Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
-specific language governing permissions and limitations under the License.
-
-*Acknowledgements*
-
-Microsoft®, Windows®, Windows NT®, Windows® XP, and Windows Vista® are
-U.S. registered trademarks of Microsoft Corporation. Intel® and Intel®
-Itanium® are trademarks of Intel Corporation in the U.S. and other
-countries. Java® is a registered trademark of Oracle and/or its
-affiliates. Motif, OSF/1, UNIX®, X/Open®, and the X device is a
-trademark of X/Open Company Ltd. in the UK and other countries.
-
-OSF, OSF/1, OSF/Motif, Motif, and Open Software Foundation are trademarks of
-the Open Software Foundation in the U.S. and other countries.
-© 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
-
+include::../../shared/license.txt[]
<<<
-The OSF documentation and the OSF software to which it relates are derived in
-part from materials supplied by the following: © 1987, 1988, 1989
-Carnegie-Mellon University. © 1989, 1990, 1991 Digital Equipment
-Corporation. © 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free
-Software Foundation, Inc. © 1987, 1988, 1989, 1990, 1991 Hewlett-Packard
-Company. © 1985, 1987, 1988, 1989, 1990, 1991, 1992 International
-Business Machines Corporation. © 1988, 1989 Massachusetts Institute of
-Technology. © 1988, 1989, 1990 Mentat Inc. © 1988 Microsoft Corporation.
-© 1987, 1988, 1989, 1990, 1991,
-1992 SecureWare, Inc. © 1990, 1991 Siemens Nixdorf Informations systeme
-AG. © 1986, 1989, 1996, 1997 Sun Microsystems, Inc. © 1989, 1990, 1991
-Transarc Corporation.
-
-OSF software and documentation are based in part
-on the Fourth Berkeley Software Distribution under license from The
-Regents of the University of California. OSF acknowledges the following
-individuals and institutions for their role in its development: Kenneth
-C.R.C. Arnold, Gregory S. Couch, Conrad C. Huang, Ed James, Symmetric
-Computer Systems, Robert Elz. © 1980, 1981, 1982, 1983, 1985, 1986,
-1987, 1988, 1989 Regents of the University of California. OSF MAKES NO
-WARRANTY OF ANY KIND WITH REGARD TO THE OSF MATERIAL PROVIDED HEREIN,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. OSF shall not be liable for errors
-contained herein or for incidental consequential damages in connection
-with the furnishing, performance, or use of this material.
+include::resources/acknowledgements.txt[]
+<<<
*Revision History*
[cols="2",options="header"]
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/images/call-statement-elements.jpg
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/images/call-statement-elements.jpg b/docs/spj_guide/src/images/call-statement-elements.jpg
index 6301ca6..42cc4a5 100644
Binary files a/docs/spj_guide/src/images/call-statement-elements.jpg and b/docs/spj_guide/src/images/call-statement-elements.jpg differ
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/resources/acknowledgements.txt
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/acknowledgements.txt b/docs/spj_guide/src/resources/acknowledgements.txt
new file mode 100644
index 0000000..c395596
--- /dev/null
+++ b/docs/spj_guide/src/resources/acknowledgements.txt
@@ -0,0 +1,38 @@
+*Acknowledgements*
+
+Microsoft®, Windows®, Windows NT®, Windows® XP, and Windows Vista® are
+U.S. registered trademarks of Microsoft Corporation. Intel® and Intel®
+Itanium® are trademarks of Intel Corporation in the U.S. and other
+countries. Java® is a registered trademark of Oracle and/or its
+affiliates. Motif, OSF/1, UNIX®, X/Open®, and the X device is a
+trademark of X/Open Company Ltd. in the UK and other countries.
+
+OSF, OSF/1, OSF/Motif, Motif, and Open Software Foundation are trademarks of
+the Open Software Foundation in the U.S. and other countries.
+© 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
+
+The OSF documentation and the OSF software to which it relates are derived in
+part from materials supplied by the following: © 1987, 1988, 1989
+Carnegie-Mellon University. © 1989, 1990, 1991 Digital Equipment
+Corporation. © 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free
+Software Foundation, Inc. © 1987, 1988, 1989, 1990, 1991 Hewlett-Packard
+Company. © 1985, 1987, 1988, 1989, 1990, 1991, 1992 International
+Business Machines Corporation. © 1988, 1989 Massachusetts Institute of
+Technology. © 1988, 1989, 1990 Mentat Inc. © 1988 Microsoft Corporation.
+© 1987, 1988, 1989, 1990, 1991,
+1992 SecureWare, Inc. © 1990, 1991 Siemens Nixdorf Informations systeme
+AG. © 1986, 1989, 1996, 1997 Sun Microsystems, Inc. © 1989, 1990, 1991
+Transarc Corporation.
+
+OSF software and documentation are based in part
+on the Fourth Berkeley Software Distribution under license from The
+Regents of the University of California. OSF acknowledges the following
+individuals and institutions for their role in its development: Kenneth
+C.R.C. Arnold, Gregory S. Couch, Conrad C. Huang, Ed James, Symmetric
+Computer Systems, Robert Elz. © 1980, 1981, 1982, 1983, 1985, 1986,
+1987, 1988, 1989 Regents of the University of California. OSF MAKES NO
+WARRANTY OF ANY KIND WITH REGARD TO THE OSF MATERIAL PROVIDED HEREIN,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. OSF shall not be liable for errors
+contained herein or for incidental consequential damages in connection
+with the furnishing, performance, or use of this material.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/resources/source/Sales.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Sales.java b/docs/spj_guide/src/resources/source/Sales.java
index eba4fe2..fd47df8 100644
--- a/docs/spj_guide/src/resources/source/Sales.java
+++ b/docs/spj_guide/src/resources/source/Sales.java
@@ -257,9 +257,9 @@ public class Sales
+ "FROM trafodion.persnl.employee "
+ "WHERE empnum in ( SELECT O.salesrep "
+ " FROM trafodion.sales.orders O, "
- + " trafodion.sales.odetail D "
- + " D.partnum = ? "
- + " O.ordernum = D.ordernum ) "
+ + " trafodion.sales.odetail D "
+ + " WHERE D.partnum = ? "
+ + " AND O.ordernum = D.ordernum ) "
+ "ORDER BY empnum "
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/resources/source/partData.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/partData.java b/docs/spj_guide/src/resources/source/partData.java
index f8bf8e1..6d7b54b 100644
--- a/docs/spj_guide/src/resources/source/partData.java
+++ b/docs/spj_guide/src/resources/source/partData.java
@@ -66,7 +66,7 @@ public static void partData( int partNum
PreparedStatement getLocations =
conn.prepareStatement( "SELECT * "
+ "FROM trafodion.invent.partloc "
- + " WHERE partnum = ? "
+ + "WHERE partnum = ? "
) ;
getLocations.setInt( 1, partNum ) ;
@@ -90,9 +90,9 @@ public static void partData( int partNum
+ "FROM trafodion.persnl.employee "
+ "WHERE empnum in ( SELECT O.salesrep "
+ " FROM trafodion.sales.orders O, "
- + " trafodion.sales.odetail D "
- + " D.partnum = ? "
- + " O.ordernum = D.ordernum ) "
+ + " trafodion.sales.odetail D "
+ + " WHERE D.partnum = ? "
+ + " AND O.ordernum = D.ordernum ) "
+ "ORDER BY empnum "
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/src/site/markdown/documentation.md
----------------------------------------------------------------------
diff --git a/docs/src/site/markdown/documentation.md b/docs/src/site/markdown/documentation.md
index 89155b5..75d7646 100644
--- a/docs/src/site/markdown/documentation.md
+++ b/docs/src/site/markdown/documentation.md
@@ -19,47 +19,50 @@ This page provides links to the per-release Trafodion documentation.
Document | Formats
------------------------------------------------------|-----------------------------------
Scalar UDFs in C | [wiki](https://cwiki.apache.org/confluence/display/TRAFODION/Scalar+UDFs+-+In+C)
-Trafodion Client Installation Guide | [Web Book](docs/client_install/index.html),[PDF](docs/client_install/Trafodion_Client_Installation_Guide.pdf)
+Trafodion Client Installation Guide | [Web Book](docs/client_install/index.html), [PDF](docs/client_install/Trafodion_Client_Installation_Guide.pdf)
Trafodion Code Examples | [wiki](https://cwiki.apache.org/confluence/display/TRAFODION/Trafodion+Code+Examples)
-Trafodion Command Interface Guide | [Web Book](docs/command_interface/index.html),[PDF](docs/command_interface/Trafodion_Command_Interface_Guide.pdf)
-Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/cqd_reference/index.html),[PDF](docs/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
-Trafodion Database Connectivity Services Guide | [Web Book](docs/dcs_reference/index.html),[API](docs/dcs_reference/apidocs/index.html)
-Trafodion Load and Transform Guide | [Web Book](docs/load_transform/index.html),[PDF](docs/load_transform/Trafodion_Load_Transform_Guide.pdf)
-Trafodion Messages Guide | [Web Book](docs/messages_guide/index.html),[PDF](docs/messages_guide/Trafodion_Messages_Guide.pdf)
+Trafodion Command Interface Guide | [Web Book](docs/command_interface/index.html), [PDF](docs/command_interface/Trafodion_Command_Interface_Guide.pdf)
+Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/cqd_reference/index.html), [PDF](docs/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
+Trafodion Database Connectivity Services Guide | [Web Book](docs/dcs_reference/index.html), [API](docs/dcs_reference/apidocs/index.html)
+Trafodion Load and Transform Guide | [Web Book](docs/load_transform/index.html), [PDF](docs/load_transform/Trafodion_Load_Transform_Guide.pdf)
+Trafodion Messages Guide | [Web Book](docs/messages_guide/index.html), [PDF](docs/messages_guide/Trafodion_Messages_Guide.pdf)
Trafodion Manageability | [wiki](https://cwiki.apache.org/confluence/display/TRAFODION/Trafodion+Manageability)
-Trafodion odb User Guide | [Web Book](docs/odb/index.html),[PDF](docs/odb/Trafodion_odb_User_Guide.pdf)
-Trafodion Provisioning Guide | [Web Book](docs/provisioning_guide/index.html),[PDF](docs/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
-Trafodion REST Server Reference Guide | [Web Book](docs/rest_reference/index.html),[API](docs/rest_reference/apidocs/index.html)
-Trafodion SQL Reference Manual | [Web Book](docs/sql_reference/index.html),[PDF](docs/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion odb User Guide | [Web Book](docs/odb/index.html), [PDF](docs/odb/Trafodion_odb_User_Guide.pdf)
+Trafodion Provisioning Guide | [Web Book](docs/provisioning_guide/index.html), [PDF](docs/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
+Trafodion REST Server Reference Guide | [Web Book](docs/rest_reference/index.html), [API](docs/rest_reference/apidocs/index.html)
+Trafodion SQL Reference Manual | [Web Book](docs/sql_reference/index.html), [PDF](docs/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion Stored Procedures in Java (SPJ) Guide | [Web Book](docs/spj_guide/index.html), [PDF](docs/spj_guide/Trafodion_SPJ_Guide.pdf)
UDF Tutorial | [wiki](https://cwiki.apache.org/confluence/display/TRAFODION/Tutorial%3A+The+object-oriented+UDF+interface)
# 2.0.0 (In Development)
Document | Formats
------------------------------------------------------|-----------------------------------
-Trafodion Client Installation Guide | [Web Book](docs/2.0.0/client_install/index.html),[PDF](docs/2.0.0/client_install/Trafodion_Client_Installation_Guide.pdf)
-Trafodion Command Interface Guide | [Web Book](docs/2.0.0/command_interface/index.html),[PDF](docs/2.0.0/command_interface/Trafodion_Command_Interface_Guide.pdf)
-Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/2.0.0/cqd_reference/index.html),[PDF](docs/2.0.0/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
-Trafodion Database Connectivity Services Guide | [Web Book](docs/2.0.0/dcs_reference/index.html),[API](docs/2.0.0/dcs_reference/apidocs/index.html)
-Trafodion Load and Transform Guide | [Web Book](docs/2.0.0/load_transform/index.html),[PDF](docs/2.0.0/load_transform/Trafodion_Load_Transform_Guide.pdf)
-Trafodion Messages Guide | [Web Book](docs/2.0.0/messages_guide/index.html),[PDF](docs/2.0.0/messages_guide/Trafodion_Messages_Guide.pdf)
-Trafodion odb User Guide | [Web Book](docs/2.0.0/odb/index.html),[PDF](docs/2.0.0/odb/Trafodion_odb_User_Guide.pdf)
-Trafodion Provisioning Guide | [Web Book](docs/2.0.0/provisioning_guide/index.html),[PDF](docs/2.0.0/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
-Trafodion REST Server Reference Guide | [Web Book](docs/2.0.0/rest_reference/index.html),[API](docs/2.0.0/rest_reference/apidocs/index.html)
-Trafodion SQL Reference Manual | [Web Book](docs/2.0.0/sql_reference/index.html),[PDF](docs/2.0.0/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion Client Installation Guide | [Web Book](docs/2.0.0/client_install/index.html), [PDF](docs/2.0.0/client_install/Trafodion_Client_Installation_Guide.pdf)
+Trafodion Command Interface Guide | [Web Book](docs/2.0.0/command_interface/index.html), [PDF](docs/2.0.0/command_interface/Trafodion_Command_Interface_Guide.pdf)
+Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/2.0.0/cqd_reference/index.html), [PDF](docs/2.0.0/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
+Trafodion Database Connectivity Services Guide | [Web Book](docs/2.0.0/dcs_reference/index.html), [API](docs/2.0.0/dcs_reference/apidocs/index.html)
+Trafodion Load and Transform Guide | [Web Book](docs/2.0.0/load_transform/index.html), [PDF](docs/2.0.0/load_transform/Trafodion_Load_Transform_Guide.pdf)
+Trafodion Messages Guide | [Web Book](docs/2.0.0/messages_guide/index.html), [PDF](docs/2.0.0/messages_guide/Trafodion_Messages_Guide.pdf)
+Trafodion odb User Guide | [Web Book](docs/2.0.0/odb/index.html), [PDF](docs/2.0.0/odb/Trafodion_odb_User_Guide.pdf)
+Trafodion Provisioning Guide | [Web Book](docs/2.0.0/provisioning_guide/index.html), [PDF](docs/2.0.0/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
+Trafodion REST Server Reference Guide | [Web Book](docs/2.0.0/rest_reference/index.html), [API](docs/2.0.0/rest_reference/apidocs/index.html)
+Trafodion SQL Reference Manual | [Web Book](docs/2.0.0/sql_reference/index.html), [PDF](docs/2.0.0/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion Stored Procedures in Java (SPJ) Guide | [Web Book](docs/2.0.0/spj_guide/index.html), [PDF](docs/2.0.0/spj_guide/Trafodion_SPJ_Guide.pdf)
# 1.3.0
Document | Formats
------------------------------------------------------|-----------------------------------
-Trafodion Client Installation Guide | [Web Book](docs/1.3.0/client_install/index.html),[PDF](docs/1.3.0/client_install/Trafodion_Client_Installation_Guide.pdf)
-Trafodion Command Interface Guide | [Web Book](docs/1.3.0/command_interface/index.html),[PDF](docs/1.3.0/command_interface/Trafodion_Command_Interface_Guide.pdf)
-Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/1.3.0/cqd_reference/index.html),[PDF](docs/1.3.0/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
-Trafodion Database Connectivity Services Guide | [Web Book](docs/1.3.0/dcs_reference/index.html),[API](docs/1.3.0/dcs_reference/apidocs/index.html)
-Trafodion Load and Transform Guide | [Web Book](docs/1.3.0/load_transform/index.html),[PDF](docs/1.3.0/load_transform/Trafodion_Load_Transform_Guide.pdf)
-Trafodion Messages Guide | [Web Book](docs/1.3.0/messages_guide/index.html),[PDF](docs/1.3.0/messages_guide/Trafodion_Messages_Guide.pdf)
-Trafodion odb User Guide | [Web Book](docs/1.3.0/odb/index.html),[PDF](docs/1.3.0/odb/Trafodion_odb_User_Guide.pdf)
-Trafodion Provisioning Guide | [Web Book](docs/1.3.0/provisioning_guide/index.html),[PDF](docs/1.3.0/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
-Trafodion REST Server Reference Guide | [Web Book](docs/1.3.0/rest_reference/index.html),[API](docs/1.3.0/rest_reference/apidocs/index.html)
-Trafodion SQL Reference Manual | [Web Book](docs/1.3.0/sql_reference/index.html),[PDF](docs/1.3.0/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion Client Installation Guide | [Web Book](docs/1.3.0/client_install/index.html), [PDF](docs/1.3.0/client_install/Trafodion_Client_Installation_Guide.pdf)
+Trafodion Command Interface Guide | [Web Book](docs/1.3.0/command_interface/index.html), [PDF](docs/1.3.0/command_interface/Trafodion_Command_Interface_Guide.pdf)
+Trafodion Control Query Default (CQD) Reference Guide | [Web Book](docs/1.3.0/cqd_reference/index.html), [PDF](docs/1.3.0/cqd_interface/Trafodion_CQD_Reference_Guide.pdf)
+Trafodion Database Connectivity Services Guide | [Web Book](docs/1.3.0/dcs_reference/index.html), [API](docs/1.3.0/dcs_reference/apidocs/index.html)
+Trafodion Load and Transform Guide | [Web Book](docs/1.3.0/load_transform/index.html), [PDF](docs/1.3.0/load_transform/Trafodion_Load_Transform_Guide.pdf)
+Trafodion Messages Guide | [Web Book](docs/1.3.0/messages_guide/index.html), [PDF](docs/1.3.0/messages_guide/Trafodion_Messages_Guide.pdf)
+Trafodion odb User Guide | [Web Book](docs/1.3.0/odb/index.html), [PDF](docs/1.3.0/odb/Trafodion_odb_User_Guide.pdf)
+Trafodion Provisioning Guide | [Web Book](docs/1.3.0/provisioning_guide/index.html), [PDF](docs/1.3.0/provisioning_guide/Trafodion_Provisioning_Guide.pdf)
+Trafodion REST Server Reference Guide | [Web Book](docs/1.3.0/rest_reference/index.html), [API](docs/1.3.0/rest_reference/apidocs/index.html)
+Trafodion SQL Reference Manual | [Web Book](docs/1.3.0/sql_reference/index.html), [PDF](docs/1.3.0/sql_reference/Trafodion_SQL_Reference_Manual.pdf)
+Trafodion Stored Procedures in Java (SPJ) Guide | [Web Book](docs/1.3.0/spj_guide/index.html), [PDF](docs/1.3.0/spj_guide/Trafodion_SPJ_Guide.pdf)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/src/site/markdown/index.md
----------------------------------------------------------------------
diff --git a/docs/src/site/markdown/index.md b/docs/src/site/markdown/index.md
index 8450368..0bc9f8e 100644
--- a/docs/src/site/markdown/index.md
+++ b/docs/src/site/markdown/index.md
@@ -113,7 +113,7 @@ Trafodion builds on the scalability, elasticity, and flexibility of Hadoop. Traf
</center>
<ul>
<li><a href="download.html">Download</a></li>
- <li><a href="quick-start.html">Quick Start</a></li>
+ <li><a href="quickstart.html">Quick Start</a></li>
<li><a href="features.html">Features</a></li>
<li><a href="release-notes.html">Release Notes</a></li>
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/src/site/site.xml
----------------------------------------------------------------------
diff --git a/docs/src/site/site.xml b/docs/src/site/site.xml
index 27b0f16..70b5098 100644
--- a/docs/src/site/site.xml
+++ b/docs/src/site/site.xml
@@ -227,26 +227,23 @@
<item href="https://blueprints.launchpad.net/trafodion/+spec/security-ansi-schemas" name="ANSI Schema Support"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/ustat-automation" name="Automated Update Statistics"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/bulkunload" name="Bulk Unload"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Trafodion_Manageability#Logging_Events" name="Event Handling"/>
+ <item href="https://cwiki.apache.org/confluence/display/TRAFODION/Trafodion+Manageability#TrafodionManageability-LoggingEvents" name="Event Handling"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/hybrid-query-cache" name="Hybrid Query Cache"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/identity-column" name="Identity Column"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Creating_Statistics_During_Bulk_Load" name="Immediate Update Statistics"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/lob-support" name="Large Object (LOB)"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/ddl-query-invalidation" name="Metadata Query Invalidation"/>
<item href="https://cwiki.apache.org/confluence/display/TRAFODION/Cmp-divisioning" name="Multi-Temperature Data"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/access-external-hbase-tables" name="Native HBase Tables"/>
- <item href="docs/odb_user/index.html" name="ODB"/>
+ <item href="https://cwiki.apache.org/confluence/display/TRAFODION/Tutorial:+The+object-oriented+UDF+interface" name="Object-Oriented UDF Tutorial"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/sql-query-cancel" name="Query Cancel"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/security-privilege-updates" name="Privilege Checking"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Trafodion_Manageability" name="Repository"/>
+ <item href="https://cwiki.apache.org/confluence/display/TRAFODION/Trafodion+Manageability" name="Repository"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/enable-get-statistics-thru-rms" name="Runtime Management System"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/sequence-numbers" name="Sequence Numbers"/>
<item href="https://blueprints.launchpad.net/trafodion/+spec/skew-buster" name="Skew Buster"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Tutorial:_The_object-oriented_UDF_interface" name="Table-Oriented UDF"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Data_Loading#Trickle_Loading_Data_Into_Trafodion_Tables" name="Trickle Load"/>
<item href="http:divider" name=""/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Backup_and_Restore" name="Backup/Restore Utility"/>
- <item href="https://wiki.trafodion.org/wiki/index.php/Metadata_Cleanup" name="Metadata Cleanup Utility"/>
+ <item href="https://cwiki.apache.org/confluence/display/TRAFODION/Backup+and+Restore" name="Backup/Restore Utility"/>
+ <item href="https://cwiki.apache.org/confluence/display/TRAFODION/Metadata+Cleanup" name="Metadata Cleanup Utility"/>
</menu>
<menu name="Apache">
<item href="http://incubator.apache.org/projects/trafodion.html" name="Project Status" target="_blank"/>
[09/14] incubator-trafodion git commit: Backup checkin
Posted by db...@apache.org.
Backup checkin
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/5e15be3e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/5e15be3e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/5e15be3e
Branch: refs/heads/master
Commit: 5e15be3ec817f4a3dacee63d81a16566d8eb3eb4
Parents: 23bfb3a
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Tue Mar 29 00:21:01 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Tue Mar 29 00:21:01 2016 -0600
----------------------------------------------------------------------
docs/.gitignore | 2 -
.../src/asciidoc/_chapters/create_spjs.adoc | 448 ++++----
.../src/asciidoc/_chapters/deploy_spjs.adoc | 540 +++-------
.../src/asciidoc/_chapters/develop_spjs.adoc | 116 +-
.../src/asciidoc/_chapters/execute_spjs.adoc | 38 +-
.../src/asciidoc/_chapters/get_started.adoc | 37 +-
.../asciidoc/_chapters/grant_privileges.adoc | 34 +-
.../src/asciidoc/_chapters/introduction.adoc | 25 +-
.../_chapters/performance_troubleshooting.adoc | 45 +-
.../src/asciidoc/_chapters/sample_spjs.adoc | 1004 ++++++++++--------
.../src/resources/source/Inventory.java | 8 +-
.../spj_guide/src/resources/source/Payroll.java | 12 +-
docs/spj_guide/src/resources/source/Sales.java | 36 +-
.../src/resources/source/adjustSalary.java | 4 +-
.../src/resources/source/employeeJob.java | 2 +-
.../resources/source/invent_partloc_table.sql | 98 +-
.../resources/source/invent_partsupp_table.sql | 36 +-
.../src/resources/source/invent_schema.sql | 4 +-
.../resources/source/invent_supplier_table.sql | 8 +-
.../src/resources/source/lowerPrice.java | 6 +-
.../src/resources/source/numDailyOrders.java | 2 +-
.../src/resources/source/numMonthlyOrders.java | 2 +-
.../src/resources/source/orderSummary.java | 10 +-
.../src/resources/source/partData.java | 16 +-
.../src/resources/source/partlocations.java | 4 +-
.../src/resources/source/persnl_dept_table.sql | 14 +-
.../resources/source/persnl_employee_table.sql | 138 +--
.../src/resources/source/persnl_job_table.sql | 8 +-
.../resources/source/persnl_project_table.sql | 8 +-
.../src/resources/source/persnl_schema.sql | 4 +-
.../src/resources/source/projectTeam.java | 2 +-
.../resources/source/sales_customer_table.sql | 8 +-
.../resources/source/sales_odetail_table.sql | 152 +--
.../src/resources/source/sales_orders_table.sql | 24 +-
.../src/resources/source/sales_parts_table.sql | 10 +-
.../src/resources/source/sales_schema.sql | 4 +-
.../src/resources/source/supplierinfo.java | 2 +-
.../src/resources/source/supplyquantities.java | 2 +-
.../src/resources/source/topSalesReps.java | 4 +-
.../src/asciidoc/_chapters/sql_statements.adoc | 163 +--
40 files changed, 1395 insertions(+), 1685 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/.gitignore
----------------------------------------------------------------------
diff --git a/docs/.gitignore b/docs/.gitignore
deleted file mode 100644
index 56256e4..0000000
--- a/docs/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target/
-/*/target/
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
index 3a89bad..cccc674 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
@@ -23,37 +23,12 @@
[[create-spjs]]
= Create SPJs
-After creating libraries for the SPJ JAR files on the Trafodion platform,
-you can create the procedures in the Trafodion database. To create or
-drop a procedure from the Trafodion database, use the HP Database Manager
-(HPDM).
+You can create the procedures in the Trafodion database after you've deployed the libraries for the SPJ JAR files.
+See <<deploy-spj-jar-files, Deploy SPJ JAR Files>>.
-Follow these procedures:
-
-* <<create-a-procedure, Create a Procedure>>
-* <<drop-a-procedure, Drop a Procedure>>
-* <<display-procedures-and-their-properties, Display Procedures and Their Properties>>
-
-This chapter also covers:
-
-* <<required-privileges-for-creating-or-dropping-an-spj, Required Privileges for Creating or Dropping an SPJ>>
-* <<altering-an-spj-and-its-java-bytecode, Altering an SPJ and Its Java Bytecode>>
-
-== Required Privileges for Creating or Dropping an SPJ
-
-To create an SPJ in a schema, you must be the schema owner, or you must
-have the CREATE_PROCEDURE privilege for that schema, and you must have
-the CREATE_PROCEDURE privilege for the SQL_OPERATIONS component. You
-must also have the USAGE privilege for the library that will be used in
-the creation of the stored procedure. For more information, see the
-requirements in <<create-a-procedure, Create a Procedure>>.
-
-To drop an SPJ from a schema, you must be the schema owner, or you must
-have the DROP_PROCEDURE privilege for that schema. For more information,
-see the requirements in <<drop-a-procedure, Drop a Procedure>>.
-
-To display the current ownership and privileges, see
-<<display-procedures-and-their-properties, Display Procedures and Their Properties>>.
+The examples in this chapter are based on the sample database documented
+in <<b-sample-database, Appendix B: Sample Database>>. Also, the `Sales.java` class are assumed to have been
+added as a library object using the `CREATE LIBRARY` statement. See <<deploy-spj-jar-files, Deploy SPJ JAR Files>>.
[[create-a-procedure]]
== Create a Procedure
@@ -61,250 +36,163 @@ To display the current ownership and privileges, see
The Create Procedure tool registers an existing Java method as a stored
procedure in Java (SPJ) within SQL.
-NOTE: HPDM creates procedures with default privileges only. For more
-information about privileges for SPJs, see the Grant/Revoke Privileges
-Tool in HPDM or the GRANT PROCEDURE statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-Requirements:
-
-* You must have the CREATE_PROCEDURE privilege for the SQL_OPERATIONS
-component. For more information, see the component privileges in the _HP
-Database Manager (HPDM) User Guide_ or the online help in HPDM.
-
-* You must have been granted the USAGE privilege for the library that
-will be used in the creation of the stored procedure. This privilege
-provides you with read access to the library's underlying JAR file,
-which contains the SPJ Java method. For more information, see the
-Grant/Revoke Privileges Tool in HPDM or the GRANT LIBRARY statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+Refer to the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+for full documentation of the
+http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_statement[CREATE PROCEDURE]
+statement including considerations and required privileges.
-* You must either be the owner of the schema or have the
-CREATE_PROCEDURE privilege for the schema to create the procedure. The
-schema owner can grant such a schema-level privilege to other users or
-roles. For more information, see the Grant/Revoke Privileges Tool in
-HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+[[create-procedure-settings]]
+=== Create Procedure Settings
-To create a procedure:
+Reference:
+http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_syntax[Syntax Description of CREATE PROCEDURE].
-1. In HPDM, select the Database area.
+You need to determine the following settings for the CREATE PROCEDURE statement:
-2. Expand the navigation tree pane so that you can see the name of the
-schema in which you want to create the procedure and the Procedures
-folder under the schema.
-
-3. Right-click the Procedures folder, and select Create Procedure. The
-Create Procedure dialog box appears.
-
-4. In the Procedure Name field, enter a name for the stored procedure.
-For detailed information about the Procedure Name field, see
-<<use-the-create-procedure-dialog-box, Use the Create Procedure Dialog Box>>.
-
-5. In the Code group box, click [ Browse ] to find a Java method.
-+
-The [ Browse ] button opens Library Browser. Use the browser to select a
-method from a JAR file within a library. See
-<<use-the-library-browser, Use the Library Browser>>. If a library containing the JAR file does
-not exist on the Trafodion platform, you can create one by clicking the
-[ Create ] button in the Library Browser. See
-<<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>.
-
-6. In the Parameters group box, verify that the SQL parameters are
-mapped correctly to the Java parameters of the SPJ method.
-+
-NOTE: The result set parameters (`java.sql.ResultSet[]`) in the Java
-signature do not have corresponding SQL parameters.
-+
-a. To change an SQL parameter, such as the name of the parameter, the
-SQL data type, or the parameter mode or direction (IN, INOUT, or OUT), select the
-parameter and click [ Edit ]. The Edit Parameter dialog box appears.
-+
-b. In the Edit Parameter dialog box, enter a new name for the
-parameter, select a different SQL data type, if permitted, or select a
-different parameter mode (direction), if permitted.
-+
-When changing the parameter name, note that the parameter name:
-+
-* Is not case-sensitive
-* Must not be a reserved word
-* Must not contain spaces
-* Must begin with a letter, digit, or underscore
-+
-When changing the SQL data type, select a data type that is appropriate
-for the parameter of the underlying Java method. For information about
-SQL data types, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-+
-////
-For character string parameters, select either ISO88591 or UCS2
-depending on the column definition in the database. For guidelines, see
-the __Trafodion Character Sets Guide__.
-////
-+
-c. Click [ OK ] to accept the changes, or click [ Cancel ] to quit the Edit Parameter dialog box.
-+
-d. Repeat steps a to c for each parameter that you want to change.
-
-7. In the Attributes group box, if your SPJ method returns result sets,
-enter the maximum number of result sets to be returned for Number of
-dynamic result sets. The valid range is 1 to 255 inclusive. The actual
-number of result sets returned by the SPJ method can be less than or
-equal to this number.
-+
-NOTE: The Number of dynamic result sets control is enabled only if the
-method signature contains a java.sql.ResultSet[] object.
-
-8. If your SPJ method performs any SQL operations, select the Accesses
-Database option.
-+
-NOTE: If you do not select the Accesses Database option and your SPJ
-method performs SQL operations, SQL returns an error when trying to
-execute the procedure.
-
-9. Select either Invoker or Definer for the external security of the
-stored procedure.
-+
-* The Invoker setting determines that users can execute, or invoke, the
-stored procedure using the privileges of the user who invokes the stored
-procedure. This behavior is referred to as _invoker rights_.
-+
-* The Definer setting determines that users can execute, or invoke, the
-stored procedure using the privileges of the user who created the stored
-procedure. This behavior is referred to as _definer rights_. The
-advantage of definer rights is that users are allowed to manipulate data
-by invoking the stored procedure without having to be granted privileges
-to the underlying database objects.
+[cols="15%,40%,45%",options="header",]
+|===
+| Attribute | Syntax | Guidance
+| *procedure-ref* | `[[catalog-name.]schema-name.]procedure-name` |
+- *catalog*: must be `trafodion`. +
+- *schema-name*: the schema the procedure is associated with. +
+- *procedure-name*: a name that is unique and does not exist for any procedure or function in the same schema. It's a good habit to use the lowercase version of the procedure name.
+| *sql-parameter* | `[parameter-mode] [sql-identifier] sql-datatype` |
+- *parameter-mode*: IN (pass data to SPJ), OUT (accept data from SPJ), or INOUT (passed data to and accepts data from SPJ). +
+- *sql-identifier*: The name of the parameter passed to the SPJ. +
+- *sql-datatype*: SQL data type mapped to Java data type. See <<java-parameters, Java Parameters>> for mapping,
+http://trafodion.incubator.apache.org/docs/sql_reference/index.html#data_types[Data Types] for SQL data types. +
+ +
+Repeat for each parameter in the SPJ.
+| *external name* | `external name java-method-name [java-signature]` |
+- *java-method-name*: case-sensitive name of the SPJ method of the form `[package-name.]class-name.method-name`. The Java method must exist in a
+Java class file, `_class-name_.class`, within a library registered in the database. If the class file that contains the SPJ method is part of a
+package, then you must also specify the package name. +
+- *java-signature*: specifies the signature of the SPJ method and consists of `([java-datatype[, java-datatype]…])`
+Necessary only if you want to specify a Java wrapper class (for example, `java.lang.integer`) instead of a java
+primitive data type (for example, `int`). See
+http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_syntax[Syntax Description of CREATE PROCEDURE].
+for more information.
+| *library* | `library [[catalog-name.]schema-name.]library-name` |
+- *catalog*: must be `trafodion`. +
+- *schema-name*: the schema the library is associated with. +
+- *library-name*: name of library containing the SPJ method.
+
-For more information, see <<understand-external-security, Understand External Security>>.
-
-10. For the Transaction Required attribute, select either Yes to require
-the procedure to run in a transaction inherited from the calling
-application (the default behavior) or No to allow the procedure to run
-without an inherited transaction. For more information, see
-<<transaction-behavior, Transaction Behavior>>.
+See <<create-a-library, Create a Library>> for more information about creating libraries.
+| *external security* | `external security [ invoker` (default) \| `definer ]` |
+- *invoker*: determines that users can execute, or invoke, the stored procedure using the privileges of the user who invokes
+the stored procedure. +
+- *definer*: determines that users can execute, or invoke, the stored procedure using the privileges of the user who created
+the stored procedure. +
+ +
+See <<understand-external-security, Understand External Security>> for more information.
+| *language java* | `language java` | Must be set specified the procedure is an SPJ rather than a UDF.
+Compare: http://trafodion.incubator.apache.org/docs/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
+| *parameter style java* | `parameter style java` | Must be set specified the procedure is an SPJ rather than a UDF.
+Compare: http://trafodion.incubator.apache.org/docs/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
+| *_sql access_* |
+`no sql` \| +
+`contains sql` (default) \| +
+`modifies sql data` \| +
+`reads sql data` |
+- *no sql*: the SPJ cannot perform SQL operations. +
+- *contains sql*: the SPJ can read and modify SQL data. +
+- *modifies sql data*: the SPJ can read and modify SQL data. +
+- *reads sql data*: the SPJ can read and modify SQL data. +
+ +
+It's a good practice to specify `modifies sql data` and `reads sql data` over `contains sql` as it helps
+users of the procedure to better understand its impact.
+| *dynamic result sets* | `dynamic result sets 0` (default) to `_n_` |
+The maximum number of result sets that the SPJ can return. This option is applicable only if the method signature contains a `java.sql.resultset[]` object.
+| *_transaction_* |
+`transaction required` (default) \| +
+`no transaction required` |
+Determines whether the SPJ must run in a transaction inherited from the calling application (`transaction required` or
+whether the SPJ runs without inheriting the calling application's transaction (`no transaction required`). Typically,
+you want the stored procedure to inherit the transaction from the calling application.
+| *_determinism_* |
+`deterministic` \| +
+`not deterministic` (default) |
+Whether the SPJ always returns the same values for out and inout parameters for a given set of argument values
+(`deterministic`) or does not return the same values (`not deterministic`). `deterministic` means that Trafodion
+can cache the result to improve performance.
+| *_isolation_* |
+`isolate` (default) \| +
+`no isolate` |
+The SPJ executes either in the environment of the database server (`no isolate`) or in an isolated environment
+(`isolate`, the default option). Trafodion allows both options but always executes the SPJ in the UDR server process (`isolate`).
+|===
-11. Click [ Create ] to create the procedure.
+Consider the following method in the `Sales.java` class:
-== Use the Create Procedure Dialog Box
+[source, java]
+----
+include::{sourcedir}/totalPrice.java[totalPrice procedure source code]
+----
-This table shows reference information for the Create Procedure dialog
-box:
+The CREATE PROCEDURE attributes for `totalPrice` are defined as follows:
-[cols="20%,30%,50%",options="header",]
+[cols="15%,40%,45%",options="header",]
|===
-| Group Box | Control or Field | Action
-| *Name* | Catalog | Name of the catalog where the procedure is created. This is a read-only field.
-| | Schema | Name of the schema where the procedure is created. This is a read-only field.
-| | Procedure Name | Enter a name for the procedure. The name must be unique and must not
-exist for any procedure, table, or view in the same schema. The
-procedure name is not case-sensitive. The database engine automatically
-qualifies the procedure name with the name of the catalog and schema in
-which you are creating the procedure. +
- +
-For example, if you enter *monthlyorders* as the procedure name, the database engine stores the
-procedure as `_catalog-name_._schema-name_.MONTHLYORDERS`.
-| *Code* | Library | Click [ Browse ] to navigate to a library or JAR file.
-| | Class Name | Select a class.
-| | Method Name | When you select a class, the method names and parameter types for that
-class appear in the right pane. +
- +
-NOTE: Only methods that can be used in a procedure are visible. For
-details, see <<use-a-method-in-a-procedure, Use a Method in a Procedure>>.
-| *Parameters* | Name | Is the name for this SQL parameter.
-| | Direction |
-- IN passes data to a procedure +
-- INOUT passes data to and accepts data from a procedure. The parameter must be an array. +
-- OUT accepts data from a procedure. The parameter must be an array.
-| | SQL Data Type | Displays the SQL data type that is the best match for the Java signature in the Java Data Type column.
-| | Java Data Type | Displays the signature for the Java method that you selected.
-| | [ Edit ] | Click to edit the selected parameter.
-| *Attributes* | Number of dynamic result sets | Controls the maximum number of resulat sets the procedure can return. +
- +
-This control is enabled only if the method signature contains a `java.sql.ResultSet[]` object. +
- +
-If the method contains a result set object, then the valid range is 1 to 255. +
- +
- This value is automatically set to zero if the selected Java method does not have a `java.sql.ResultSet[]` object.
-| | Accesses Database | If selected, then the procedure performs SQL operations.
-If cleared, then the procedure does not perform SQL operations. +
- +
-NOTE: SQL returns an error when trying to execute the procedure if this
-attribute is cleared and the procedure performs SQL operations.
-| | External Security | Select either Invoker or Definer for the external security of the stored procedure. +
- +
-- The Invoker setting determines that users can execute, or invoke, the
-stored procedure using the privileges of the user who invokes the stored
-procedure. This behavior is referred to as _invoker rights_. +
- +
-* The Definer setting determines that users can execute, or invoke, the
-stored procedure using the privileges of the user who created the stored
-procedure. This behavior is referred to as _definer rights_. The
-advantage of definer rights is that users are allowed to manipulate data
-by invoking the stored procedure without having to be granted privileges
-to the underlying database objects. +
- +
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required |
-Select either Yes to require the procedure to run in a transaction
-inherited from the calling application (the default behavior) or No to
-allow the procedure to run without an inherited transaction. For more
-information, see <<transaction-behavior, Transaction Behavior>>.
+| Attribute | Definition | Discussion
+| *procedure-ref* | `trafodion.sales.totalprice` | Used lowercase version of totalPrice for _procedure-name_.
+| *sql-parameter-1* | `IN _qty_ NUMERIC(18)` | The first argument to the SPJ is defined as: `BigDecimal qtyOrdered`, which maps to `NUMERIC`.
+The size is chosen to allow for large numbers.
+| *sql-parameter-2* | `IN _speed_ VARCHAR(10)` | The second argument to the SPJ is defined as: `String shippingSpeed`.
+Possible values are: `economy`, `standard`, or `nextday`. `VARCHAR(10)` is a good choice.
+| *sql-parameter-3* | `INOUT _price_ NUMERIC(18,2)` | The third argument to the SPJ is defines as: `BigDecimal[] price`.
+The SPJ uses an input price to calculate to total price including taxes and shipping cost.
+Therefore, `INOUT` is the appropriate choice. Given that the `_qty_` argument is NUMERIC(18), then this argument should be too. The precision choice fits the the
+type of calculation being peformed.
+| *external name* | `EXTERNAL NAME Sales.totalPrice` | The class name is `Sales`. The procedure name is `totalPrice`.
+| *library* | `library trafodion.sales.sales` | The library name was defined using the CREATE LIBRARY statement.
+See the example in <<create-a-library, Create a Library>>.
+| *external security* | `invoker`^1^ | Use the privileges of the SPJ invoker.
+| *language java* | `LANGUAGE JAVA` | Required for SPJs.
+| *parameter style java* | `PARAMETER STYLE JAVA` | Required for SPJs.
+| *_sql access_* | `NO SQL` | This SPJ performs no SQL operations, just calculations.
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0` | The method does not contain a `java.sql.resultset[]` object.
+| *_transaction_* | `TRANSACTION REQUIRED`^1^ | The method should inherit the calling application's transaction, if any.
+| *_determinism_* | `NOT DETERMINISTIC`^1^ | The results must be recalculated each time; that is, cannot be cached.
+| *_isolation_* | `ISOLATE`^1^ | Execute the SPJ in an isolated environment; that is, the UDR server process.
|===
-*Related Topics*
+^1^ Definition represents default value.
-* <<create-a-procedure, Create a Procedure>>
+Using the information above, you create the new procedure as follows:
-[[use-a-method-in-a-procedure]]
-== Use a Method in a Procedure
-
-To be used in a procedure, a Java method must:
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.totalprice( IN qty NUMERIC (18),
+ IN speed VARCHAR (10),
+ INOUT price NUMERIC (18,2)
+ )
+ EXTERNAL NAME 'Sales.totalPrice'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ NO SQL
+ DYNAMIC RESULT SETS 0
+ TRANSACTION REQUIRED
+ ISOLATE
+ ;
+----
-* Be qualified as public static void.
-* Have a `java.sql.ResultSet[]` parameter at the end of the method signature if the method uses result sets.
-+
-NOTE: There can be more than one java.sql.ResultSet[] parameter, but they must all be at the end of the method signature.
+Removing the default values to simplify the statement, you get:
-* Have these parameter types:
-+
-[cols="40%,60%", options="header"]
-|===
-| Parameter Type or Class | Type
-|
-| *character* |
-`java.lang.String` +
-`java.lang.String[]`
-| *numeric* |
-`java.lang.Integer` +
-`java.lang.Integer[]` +
-`java.lang.Long` +
-`java.lang.Long[]` +
-`java.lang.Float` +
-`java.lang.Float[]` +
-`java.lang.Double` +
-`java.lang.Double[]` +
-`java.math.BigDecimal` +
-`java.math.BigDecimal[]`
-| *date/timestamp* |
-`java.sql.Date` +
-`java.sql.Date[]` +
-`java.sql.Time` +
-`java.sql.Time[]` +
-`java.sql.Timestamp` +
-`java.sql.Timestamp[]`
-| *primitive short* |
-`short[]` +
-`int` +
-`int[]` +
-`long` +
-`long[]` +
-`float` +
-`float[]`+
-`double` +
-`double[]`
-| *result sets* | `java.sql.ResultSet[]`
-|===
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.totalprice( IN qty NUMERIC (18),
+ IN speed VARCHAR (10),
+ INOUT price NUMERIC (18,2)
+ )
+ EXTERNAL NAME 'Sales.totalPrice'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ NO SQL
+ ;
+----
[[understand-external-security]]
== Understand External Security
@@ -351,6 +239,7 @@ execute the SPJ without requiring privileges to the underlying database objects.
To set the external security of an SPJ, see <<create-a-procedure, Create a Procedure>>.
+
[[drop-a-procedure]]
== Drop a Procedure
@@ -362,20 +251,40 @@ For example, if the schema owner granted you privileges to drop all objects in t
you could drop procedures. For more information, see the GRANT SCHEMA statement in the
http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual]
-To drop a procedure:
+Refer to the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+for full documentation of the
+http://trafodion.apache.org/docs/sql_reference/index.html#drop_procedure_statement[DROP PROCEDURE]
+statement including considerations and required privileges.
+
+*Example*
+
+Your task is to remove Sales class jar file from the `SALES` schema.
+
+Do the following using trafci:
-1. Under the navigation tree pane, click the Database area.
+```
+$ trafci
+Welcome to Apache Trafodion Command Interface
+Copyright (c) 2015 Apache Software Foundation
-2. Under My Systems, expand the tree for the Trafodion platform
-containing the procedure until you can see the schema folder and the
-Procedures folder underneath it.
+Host Name/IP Address: localhost:23400
+User Name: zz
-3. Expand the Procedures folder.
+Connected to Trafodion
-4. Right-click the name of the procedure that you want to drop, and
-select Drop Procedure. HPDM asks you to confirm the operation.
+SQL> get procedures for library trafodion.sales.saleslib ;
-5. Click [ Yes ] to continue or [ No ] to quit the operation.
+TOTALPRICE
+
+--- SQL operation complete.
+
+SQL> DROP PROCEDURE trafodion.sales.totalprice ;
+
+--- SQL operation complete.
+
+SQL>
+```
[[display-procedures-and-their-properties}}
== Display Procedures and Their Properties
@@ -386,7 +295,7 @@ command displays a list of the procedures in the SALES schema:
[source, sql]
----
-SQL> SET SCHEMA demo.sales ;
+SQL> SET SCHEMA trafodion.sales ;
--- SQL operation complete.
@@ -417,6 +326,8 @@ SQL>
For more information about trafci, see the
http://trafodion.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide].
+////
+20160323: Trafodion does not yet support the ALTER LIBRARY command.
[[altering-an-spj-and-its-java-bytecode]]
=== Altering an SPJ and Its Java Bytecode
@@ -452,3 +363,4 @@ the calling application. Therefore, schedule a time to update the SPJ or
its Java bytecode when client applications are not actively calling the
SPJ.
+////
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
index d3ca8e0..7a1a263 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
@@ -27,8 +27,7 @@ After developing and packaging the SPJ code into JAR files, you must
move the JAR files from the client workstation to the Trafodion database.
You can upload a SPJ JAR file and create a library by using
-the ADD LIBRARY command in the Trafodion Command Interface (trafci).
-You use the CREATE LIBRARY, ALTER LIBRARY, and DROP LIBRARY commands.
+the CREATE LIBRARY command in the Trafodion Command Interface (trafci).
Libraries provide greater security for JAR files because libraries are
database objects whose access is controlled using standard SQL security.
@@ -37,39 +36,8 @@ Deploying a JAR file to a Trafodion instance requires creating a library,
and users must have the required privileges for creating libraries in order
to deploy JAR files.
-See these instructions:
-
-* <<create-a-library, Create a Library>>
-* <<alter-a-library, Alter a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
-* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
-
-Before you start, see
-<<required-privileges-for-creating-altering-or-dropping-a-library, "Required Privileges for Creating, Altering, or Dropping a Library">>.
-
-
-== Required Privileges for Creating, Altering, or Dropping a Library
-
-Deploying a JAR file to the Trafodion database requires creating a
-library, and you must have the required privileges for creating
-libraries in order to deploy a JAR file. To create a library in a
-schema, you must have both the CREATE_LIBRARY component privilege and
-the CREATE_LIBRARY schema-level privilege for the schema. For more
-information, see the requirements in <<create-a-library, Create a Library>>.
-
-To alter a library in a schema, you must have both the UPDATE privilege
-for the library and the ALTER_LIBRARY privilege for the schema. For more
-information, see the requirements in
-<<alter-a-library, Alter a Library>>.
-
-To drop a library from a schema, you must have the DROP_LIBRARY
-privilege for the schema. For more information, see the requirements in
-<<drop-a-library, Drop a Library>>.
-
-To download a JAR file from a library, you must have the CREATE_LIBRARY
-component privilege. For more information, see the requirements in
-<<download-a-jar-file-from-a-library, Download a JAR File From a Library>>.
+The examples in this chapter are based on the sample database
+documented in <<b-sample-database, Appendix B: Sample Database>>.
[[create-a-library]]
== Create a Library
@@ -78,281 +46,143 @@ Refer to the
http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
for full documentation of the
http://trafodion.apache.org/docs/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
-statement.
+statement including considerations and required privileges.
+
+NOTE: You must copy the jar file to the same directory on all the nodes in the cluster before running the CREATE LIBRARY statement.
+Otherwise, you will see an error message indicating that the jar file is not found.
+
+*Example*
-When you create a library, HPDM simultaneously uploads an SPJ JAR file
-from the client workstation to the Trafodion database and creates a
-library for the JAR file in a schema of the database.
-
-Requirements:
-
-* You must have the CREATE_LIBRARY privilege for the SQL_OPERATIONS
-component. For more information, see the component privileges in the _HP
-Database Manager (HPDM) User Guide_ or the online help in HPDM.
-* You must either be the owner of the schema where you will create the
-library or have the CREATE_LIBRARY privilege for the schema to create
-the library. The schema owner can grant such a schema-level privilege to
-other users or roles. For more information, see the
-
-Grant/Revoke Privileges Tool in HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-* The JAR file that you select for the library must contain valid Java
-bytecode and must not be used by another library in the catalog.
-* The JAR file that you select for the library must not exceed a size
-threshold if one has been set for HPDM's internal WMS service, the data
-source, or the system defaults.
-
-For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
-has been set for the `HPS_MANAGEABILITY` service, it limits the size
-of JAR files that can be uploaded by HPDM. If the JAR file's size
-exceeds the threshold, a warning message is displayed, and the file is
-not uploaded. By default, this CQD is not set for HPDM's internal WMS
-service, the data source, or the system defaults, and HPDM allows you to
-upload JAR files of any size.
-
-To upload a JAR file and create a library for the JAR file in a schema:
-
-1. In HPDM, select the Database area.
-2. In the navigation tree pane, expand the tree to display the folders
-of the schema where you want to create the library.
-3. Right-click the Libraries folder, and select Create Library. The
-Create Library dialog box appears. For more information, see
-<<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>.
-4. In the Create Library dialog box, enter a name for the library.
+This example uses the sample <<procedures-in-the-sales-schema, Sales Class>> documented in
+<<a-sample-spjs, Appendix A: Sample SPJs>>.
+
+Your task is to add the Sales class jar file as a library object in the `SALES` schema.
+Do the following:
+
+1. Compile the `Sales.java` source file.
+
-The name must be unique among the libraries in the schema and must not
-exceed 128 characters. The library name is not case-sensitive.
+*Example*
+
-For example, if you enter `Payroll` as the library name, the database engine
-stores the library as `_catalog-name_._schema-name_.PAYROLL`. The database engine
-automatically qualifies the library name with the name of the catalog
-and schema in which you are creating the library.
-
-5. Click the [ Browse ] button to locate and select a JAR file on the
-client workstation. The *Select a code file* dialog box appears.
+```
+$ # Set up the environmental variables.
+$ cd $HOME/trafodion-incubator
+$ source env.sh
+$ # Prepare the class jar file
+$ cd $HOME/trafodion-spjs
+$ ls
+Inventory.java Payroll.java Sales.java
+$ # Compile source
+$ javac Sales.java
+$ ls Sales.*
+Sales.class Sales.java
+$ # Package jar file
+$ jar cvf Sales.jar Sales.class
+$ ls Sales.*
+Sales.class Sales.jar Sales.java
+$
+```
+
+2. Multi-node cluster only: Create the target directory, if necessary.
++
+*Example*
++
+```
+$ pdsh $MY_NODES -x $HOSTNAME mkdir $HOME/trafodion-spjs
+```
-6. In the *Select a code file* dialog box, locate and select the JAR
-file on the client workstation, and click [ Open ] to return to the
-Create Library dialog box. The Create Library dialog box displays the
-full path of the JAR file in the Code File field.
+3. Multi-node cluster only: Copy the jar file to all nodes in the cluster.
++
+*Example*
++
+```
+$ pdcp $MY_NODES Sales.jar $PWD/.
+```
-7. Click [ Create ] to create the library, or click [ Close ] to quit
-the dialog box without creating the library.
+4. Create the library object using trafci.
+
-If you click [ Create ], HPDM validates the JAR file, uploads the JAR
-file, and creates a library for the JAR file in the schema.
-
-8. When notified that the library was created successfully, click [ OK ].
-9. To upload another JAR file and create a library, repeat steps 4
-through 8.
-10. When you are done uploading JAR files and creating libraries, click
-the [ Close ] button to quit the Create
-Library dialog box and return to the HPDM main window.
-
-*Related Topics*
-
-* <<use-the-create-library-dialog-box, Use the Create Library Dialog Box>>
-* <<alter-a-library, Alter a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
-* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
-
-[[use-the-create-library-dialog-box]]
-== Use the Create Library Dialog Box
-
-The Create Library dialog box allows you to upload an SPJ JAR file from
-the client workstation to the Trafodion database and create a library for
-the JAR file in a schema of the database.
-
-Requirements:
-
-* You must have the CREATE_LIBRARY privilege for the SQL_OPERATIONS
-component. For more information, see the component privileges in the _HP
-Database Manager (HPDM) User Guide_ or the online help in HPDM.
-
-* You must either be the owner of the schema where you will create the
-library or have the CREATE_LIBRARY privilege for the schema to create
-the library. The schema owner can grant such a schema-level privilege to
-other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
-
-* The JAR file that you select for the library must contain valid Java
-bytecode and must not be used by another library in the catalog.
-
-* The JAR file that you select for the library must not exceed a size
-threshold if one has been set for HPDM's internal WMS service, the data
-source, or the system defaults.
-
-For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
-has been set for the HPS_MANAGEABILITY service, it will limit the size
-of JAR files that can be uploaded by HPDM.
-
-If the JAR file's size exceeds the threshold, then a warning message is displayed,
-and the file is not uploaded. By default, this CQD is not set for HPDM's internal WMS
-service, the data source, or the system defaults, and HPDM allows you to
-upload JAR files of any size.
-
-[cols="20%,30%,50%",options="header",]
-|===
-| Group Box | Control or Field | Description or Action
-| *Library* | Catalog | Name of the catalog where the library is created. This is a read-only field.
-| | Schema | Name of the schema where the library is created. This is a read-only field.
-| | Library Name | Enter a name for the library. The name must be unique among the libraries
-in the schema and must not exceed 128 characters. The library name is not case-sensitive. +
- +
-For example, if you enter Payroll as the library name, the database engine stores the library as
-`_catalog-name_._schema-name_.PAYROLL`. The database engine automatically qualifies the library name with the
-name of the catalog and schema in which you are creating the library.
-| *Code File* | Code File | Click [ Browse ] to launch the *Select a code file* dialog box and
-navigate to a JAR file on the client workstation.
-| | [ Create ] | Creates the library.
-| | [ Close ] | Closes the dialog box without creating a library.
-| | [ Help ] | Displays context-sensitive help for this dialog box.
-|===
-
-*Related Topics*
-
-* <<create-a-library, Create a Library>>
-* <<alter-a-library, Alter a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
+```
+$ pwd
+/home/trafodion/trafodion-jars
+$ trafci
+
+Welcome to Apache Trafodion Command Interface
+Copyright (c) 2015 Apache Software Foundation
+
+Host Name/IP Address: localhost:23400
+User Name: zz
+
+Connected to Trafodion
+
+SQL> CREATE LIBRARY trafodion.sales.sales FILE '/home/trafodion/trafodion-spjs/Sales.jar' ;
+
+--- SQL operation complete.
+
+SQL> get libraries in schema trafodion.sales ;
+
+SALES
+
+--- SQL operation complete.
+
+SQL>
+```
+
+////
+20160323 GTA: This feature isn't implemented yet. Uncomment this section once implemented.
[[alter-a-library]]
== Alter a Library
When you alter a library, you can change the underlying JAR file of the library.
-Requirements:
-
-* You must have been granted the UPDATE privilege for the library. For
-more information, see the Grant/Revoke Privileges Tool in HPDM or the
-GRANT LIBRARY statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-* You must either be the owner of the schema where you're altering the
-library or have the ALTER_LIBRARY privilege for the schema to alter the
-library. The schema owner can grant such a schema-level privilege to
-other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-* The JAR file that you select for the library must contain valid Java
-bytecode and must not be used by another library in the catalog.
-
-* The JAR file that you select for the library must not exceed a size
-threshold if one has been set for HPDM's internal WMS service, the data
-source, or the system defaults.
-
-For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
-has been set for the HPS_MANAGEABILITY service, then it limits the size
-of JAR files that can be uploaded by HPDM. If the JAR file's size
-exceeds the threshold, a warning message is displayed, and the file is
-not uploaded. By default, this CQD is not set for HPDM's internal WMS
-service, the data source, or the system defaults, and HPDM allows you to
-upload JAR files of any size.
-
-To alter a library and change its underlying JAR file:
-
-1. In HPDM, select the Database area.
-2. In the navigation tree pane, expand the tree to display the folders
-of the schema that contains the library, and expand the Libraries folder
-to display the libraries within it.
-3. Right-click the name of the library, and select Alter Library. If
-you selected a system library, a dialog box appears warning you that you
-cannot alter a system library. If you selected a user library, the Alter
-Library dialog box appears. For more information, see
-<<use-the-alter-library-dialog-box, Use the Alter Library Dialog Box>>.
-
-4. In the Alter Library dialog box, click the [ Browse ] button to
-locate and select a new JAR file on the client workstation. The *Select
-a code file* dialog box appears.
-
-5. In the *Select a code file* dialog box, locate and select the JAR
-file on the client workstation, and click [ Open ] to return to the
-Alter Library dialog box. The Alter Library dialog box displays the full
-path of the new JAR file in the Code File field.
-
-6. Click [ Alter ] to alter the library, or click [ Close ] to quit the
-dialog box without altering the library.
+Refer to the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+for full documentation of the
+http://trafodion.apache.org/docs/sql_reference/index.html#alter_library_statement[ALTER LIBRARY]
+statement including considerations and required privileges.
+
+*Example*
+
+Your task is to modify the Sales class jar file as a library object in the `SALES` schema
+with a new jar file (`Sales2.jar`).
+
+Do the following:
+
+1. Multi-node cluster only: Copy the jar file to all nodes in the cluster.
+
-If you click [ Alter ], a dialog box appears warning you that altering a
-library might affect stored procedures that use the library and asking
-if you wish to continue the alter operation. Click [ Yes ] to proceed,
-or click [ No ] to cancel the operation. If you click [ Yes ], HPDM
-validates the JAR file, uploads the JAR file, and alters the library in
-the schema.
-
-7. When notified that the library was altered successfully, click
-[ OK ] to close the Alter Library dialog box and return to the HPDM main
-window.
-
-*Related Topics*
-
-* <<use-the-alter-library-dialog-box, Use the Alter Library Dialog Box>>
-* <<create-a-library, Create a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
-* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
-
-[[use-the-alter-library-dialog-box]]
-== Use the Alter Library Dialog Box
-
-The Alter Library dialog box allows you to alter a library and change
-its underlying JAR file.
-
-Requirements:
-
-* You must have been granted the UPDATE privilege for the library. For
-more information, see the Grant/Revoke Privileges Tool in HPDM or the
-GRANT LIBRARY statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-* You must either be the owner of the schema where you will alter the
-library or have the ALTER_LIBRARY privilege for the schema to alter the
-library. The schema owner can grant such a schema-level privilege to
-other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-* The JAR file that you select for the library must contain valid Java
-bytecode and must not be used by another library in the catalog.
-
-* The JAR file that you select for the library must not exceed a size
-threshold if one has been set for HPDM's internal WMS service, the data
-source, or the system defaults.
+*Example*
+
-For example, if the CONTROL QUERY DEFAULT (CQD) `POS_ABSOLUTE_MAX_TABLE_SIZE`
-has been set for the HPS_MANAGEABILITY service, then it limits the size
-of JAR files that can be uploaded by HPDM. If the JAR file's size
-exceeds the threshold, a warning message is displayed, and the file is
-not uploaded.
+```
+$ pdcp $MY_NODES Sales2.jar $PWD/.
+```
+
+2. Create the library object using trafci.
+
-By default, this CQD is not set for HPDM's internal WMS
-service, the data source, or the system defaults, and HPDM allows you to
-upload JAR files of any size.
-
-
-[cols="20%,30%,50%",options="header",]
-|===
-| Group Box | Control or Field | Description or Action
-| *Library* | Catalog | Name of the catalog where the library is created. This is a read-only field.
-| | Schema | Name of the schema where the library is created. This is a read-only field.
-| | Library Name | Name of the library. This is a read-only field.
-| *Code File* | Code File | Click [ Browse ] to launch the "Select a code file" dialog box and
-navigate to a new JAR file on the client workstation.
-| | [ Alter ] | Alters the library.
-| | [ Close ] | Closes the dialog box without altering the library.
-| | [ Help ] | Displays context-sensitive help for this dialog box.
-|===
-
-Related Topics
-
-* <<alter-a-library, Alter a Library>>
-* <<create-a-library, Create a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
+```
+$ pwd
+/home/trafodion/trafodion-jars
+$ trafci
+
+Welcome to Apache Trafodion Command Interface
+Copyright (c) 2015 Apache Software Foundation
+
+Host Name/IP Address: localhost:23400
+User Name: zz
+
+Connected to Trafodion
+
+SQL> ALTER LIBRARY trafodion.sales.saleslib FILE '/home/trafodion/trafodion-spjs/Sales2.jar' ;
+
+--- SQL operation complete.
+
+SQL> get libraries in schema trafodion.sales ;
+
+SALES
+
+--- SQL operation complete.
+
+SQL>
+```
+////
[[drop-a-library]]
== Drop a Library
@@ -361,101 +191,69 @@ Dropping a library removes the library from the schema in the database
and removes the library's underlying JAR file from the Trafodion
database.
-Requirements:
-
-* You must either be the owner of the schema where you will drop the
-library or have the DROP_LIBRARY privilege for the schema to drop the
-library. The schema owner can grant such a schema-level privilege to
-other users or roles. For more information, see the Grant/Revoke
-Privileges Tool in HPDM or the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
-
-To drop a library from the database:
+Refer to the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+for full documentation of the
+http://trafodion.apache.org/docs/sql_reference/index.html#drop_library_statement[DROP LIBRARY]
+statement including considerations and required privileges.
-1. In HPDM, select the Database area.
-2. In the navigation tree pane, expand the tree to display the folders
-of the schema that contains the library, and expand the Libraries folder
-to display the libraries within it.
-3. Right-click the name of the library, and select Drop Library. The
-Drop Library dialog box appears.
-4. In the Drop Library dialog box appears, select the Dropping all
-procedures and routines using this library check box to drop all stored
-procedures that are using the library. If you do not select this option
-when stored procedures are using the library, the drop operation will
-fail with an error message.
-5. Click [ Yes ] to drop the library, or click [ No ] to quit the
-dialog box without dropping the library.
+*Example*
-*Related Topics*
+Your task is to remove Sales class jar file from the `SALES` schema.
-* <<create-a-library, Create a Library>>
-* <<alter-a-library, Alter a Library>>
-* <<download-a-jar-file-from-a-library, Download a JAR File From a Library>>
-* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
+Do the following using trafci:
-[[download-a-jar-file-from-a-library]]
-== Download a JAR File From a Library
+```
+$ trafci
+Welcome to Apache Trafodion Command Interface
+Copyright (c) 2015 Apache Software Foundation
-Requirements:
+Host Name/IP Address: localhost:23400
+User Name: zz
-* You must have the CREATE_LIBRARY privilege for the SQL_OPERATIONS
-component. For more information, see the component privileges in the _HP
-Database Manager (HPDM) User Guide_ or the online help in HPDM.
+Connected to Trafodion
-To download a JAR file from a library:
+SQL> get libraries in schema trafodion.sales ;
-1. In HPDM, select the Database area.
+SALES
-2. In the navigation tree pane, expand the tree to display the folders
-of the schema that contains the library, and expand the Libraries folder
-to display the libraries within it.
+--- SQL operation complete.
-3. Right-click the name of the library, and select Browse Library. The
-Browse Library dialog box appears with the name of the library selected
-in the tree pane and displayed in the right pane. For more information,
-see <<use-the-library-browser, Use the Library Browser>>.
+SQL> DROP LIBRARY trafodion.sales.saleslib ;
-4. Click the [ Download ] button. The *Browse For Folder* dialog box
-appears.
+--- SQL operation complete.
-5. In the *Browse For Folder* dialog box, select a target folder on the
-client workstation for downloading the JAR file.
+SQL>
+```
-6. Click [ OK ] to start downloading the library's underlying JAR file
-to the client workstation, or click [ Cancel ] to quit the Browse For
-Folder dialog box and return to the Browse Library dialog box.
+[[display-libraries]]
+== Display Libraries
-7. When notified that the download completed successfully, click [ OK ]
-to return to the Browse Library dialog box.
+Refer to the
+http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+for full documentation of the
+http://trafodion.apache.org/docs/sql_reference/index.html#get_statement[GET]
+statement.
-*Related Topics*
+Use the `GET libraries [ in schema [ catalog-name.] schema-name ] statement in trafci to
+display the libraries in a schema.
-* <<use-the-library-browser, Use the Library Browser>>
-* <<create-a-library, Create a Library>>
-* <<alter-a-library, Alter a Library>>
-* <<drop-a-library, Drop a Library>>
-* <<display-libraries-and-their-properties, Display Libraries and Their Properties>>
+*Example*
-[[use-the-library-browser]]
-== Use the Library Browser
+```
+$ trafci
+Welcome to Apache Trafodion Command Interface
+Copyright (c) 2015 Apache Software Foundation
-Depending on the context in which the Library Browser is launched, you
-can use it to view, create, or drop libraries in the database; to
-download a JAR file from a library in the database to the client
-workstation; or to select a Java method in a library when creating a
-stored procedure.
+Host Name/IP Address: localhost:23400
+User Name: zz
-[[display-libraries-and-their-properties]]
-== Display Libraries and Their Properties
+Connected to Trafodion
-To display the libraries in a schema:
+SQL> get libraries in schema trafodion.sales ;
-1. Start the HP Database Manager and log on using any user name.
-2. Click the Database area.
-3. In the navigation tree pane, select a Schema, and expand the schema
-so that you can see the object folders underneath it.
-4. Expand the Libraries tab in the right pane and select a library
-name, or open the Libraries
-folder and select a library name in the tree. HPDM displays the
-libraries for this schema.
+SALES
+--- SQL operation complete.
+SQL>
+```
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
index 6e9cba9..0b13648 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
@@ -27,13 +27,7 @@ Before creating, or registering, an SPJ in the database, you must write
and compile the Java method to be used as the body of the SPJ. The
manual refers to those Java methods as _SPJ methods_.
-This chapter requires a familiarity with writing and compiling Java
-programs and covers these topics:
-
-* <<guidelines-for-writing-spj-methods, Guidelines for Writing SPJ Methods>>
-* <<accessing-a-trafodion-database, Accessing a Trafodion Database>>
-* <<handling-java-exceptions,Handling Java Exceptions>>
-* <<compiling-and-packaging-java-classes,Compiling and Packaging Java Classes>>
+This chapter requires a familiarity with writing and compiling Java programs.
[[guidelines-for-writing-spj-methods]]
== Guidelines for Writing SPJ Methods
@@ -41,14 +35,6 @@ programs and covers these topics:
Follow the guidelines for these topics when you write SPJ methods to be
used as SPJs in the database:
-* <<signature of the java method, Signature of the Java Method>>
-* <<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>
-* <<returning-stored-procedure-result-sets, Returning Stored Procedure Result Sets>>
-* <<using-the-main-method, Using the main() Method>>
-* <<null-input-and-output, Null Input and Output>>
-* <<static-java-variables, Static Java Variables>>
-* <<nested-java-method-invocations, Nested Java Method Invocations>>
-
[[signature-of-the-java-method]]
=== Signature of the Java Method
@@ -62,10 +48,10 @@ public static void myMethodName ( java-parameter-list )
[[public-access-and-static-modifiers]]
==== Public Access and Static Modifiers
-The Java method must be defined as public and static. If a method is
-private or protected, the database engine is unable to find the Java
+The Java method must be defined as `public` and `static`. If a method is
+`private` or `protected`, then Trafodion is unable to find the Java
method when you try to register the SPJ and returns an error. The Java
-method must be defined as static so that the method can be invoked
+method must be defined as `static` so that the method can be invoked
without having to instantiate its class.
[[void-return-type]]
@@ -86,44 +72,36 @@ type mappings, see the table below.
[[table-1]]
.Mapping of Java Data Types to SQL Data Types
-[cols="40%,60%",options="header",]
+[cols="60%,40%",options="header"]
|===
-| Java Data Type | Maps to SQL Data Type. . .
-| `java.lang.String` |
-CHAR[ACTER] +
+| SQL Data Type | Maps to Java Data Type…
+| CHAR[ACTER] +
CHAR[ACTER] VARYING +
VARCHAR +
PIC[TURE] X^1^ +
NCHAR +
NCHAR VARYING +
NATIONAL CHAR[ACTER] +
-NATIONAL CHAR[ACTER] VARYING
-| `java.sql.Date` | DATE
-| `java.sql.Time` | TIME
-| `java.sql.Timestamp` | TIMESTAMP
-| `java.math.BigDecimal` |
-NUMERIC (including NUMERIC with a precision greater than eighteen)^2^ +
-DEC[IMAL]^2^ +
-PIC[TURE] S9^3^
-| `short` | SMALLINT^2^
-| `int or java.lang.Integer`^4^ | INT[EGER]^2^
-| `long or java.lang.Long`^4^ | LARGEINT2
-| `double or java.lang.Double`^4^ | FLOAT
-| `float or java.lang.Float`^4^ | REAL
-| `double or java.lang.Double`^4^ | DOUBLE PRECISION
-| `java.sql.ResultSet[]` | None
+NATIONAL CHAR[ACTER] VARYING | java.lang.string
+| DATE | java.sql.date
+| TIME | java.sql.time
+| TIMESTAMP | java.sql.timestamp
+| DEC[IMAL]^2^ +
+PIC[TURE] S9^3^ +
+NUMERIC (including numeric with a precision greater than eighteen)^2^ | java.math.bigdecimal
+| SMALLINT^2^ | short
+| INT[EGER]^2^ | int or java.lang.integer^4^
+| LARGEINT^2^ | long or java.lang.long^4^
+| FLOAT | double or java.lang.double^4^
+| REAL | float or java.lang.float^4^
+| DOUBLE PRECISION | double or java.lang.double^4^
|===
-1. The Trafodion database stores `PIC X` as a `CHAR` data type.
-
-2. Numeric data types of SQL parameters must be `SIGNED`, which is the
-default in the Trafodion database.
-
-3. The Trafodion database stores `PIC S9` as a `DECIMAL` or `NUMERIC` data type.
-
-4. Choose a Java wrapper class if you plan to pass null values as
-arguments to or from the method. See
-<<null-input-and-output, Null Input and Output>>
+1. Trafodion stores PIC X as a CHAR data type.
+2. Numeric data types of SQL parameters must be signed, which is the default in Trafodion.
+3. Trafodion stores PIC S9 as a DECIMAL or NUMERIC data type.
+4. By default, the SQL data type maps to a Java primitive type. The SQL data type maps to a Java wrapper class
+only if you specify the wrapper class in the Java signature of the external name clause.
Output parameters in the Java signature must be arrays (for example,
`int[]` or `String[]`) that accept only one value in the first element of
@@ -259,11 +237,11 @@ java.lang.String s =
"SELECT amounts.*, orders.order_date, emps.last_name "
+ "FROM ( SELECT o.ordernum, COUNT( d.partnum ) AS num_parts, "
+ " SUM( d.unit_price * d.qty_ordered ) AS amount "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
+ + " FROM trafodion.sales.orders o, trafodion.sales.odetail d "
+ " WHERE o.ordernum = d.ordernum "
+ " AND o.order_date >= CAST(? AS DATE) "
+ " GROUP BY o.ordernum ) amounts, "
- + " demo.sales.orders orders, demo.persnl.employee emps "
+ + " trafodion.sales.orders orders, trafodion.persnl.employee emps "
+ "WHERE amounts.ordernum = orders.ordernum "
+ " AND orders.salesrep = emps.empnum "
+ "ORDER BY orders.ordernum "
@@ -408,12 +386,6 @@ SPJ methods that access a Trafodion database must be from a Java class
that uses JDBC method calls. Follow these guidelines when writing an SPJ
method that accesses a Trafodion database:
-* <<use-of-java.sql.connection-objects, Use of java.sql.Connection Objects>>
-* <<using-jdbc-method-calls, Using JDBC Method Calls>>
-* <<referring-to-database-objects-in-an-spj-method, Referring to Database Objects in an SPJ Method>>
-* <<using-the-session_user-or-current_user-function-in-an-spj-method, Using the SESSION_USER or CURRENT_USER Function in an SPJ Method>>
-* <<exception-handling, Exception Handling>>
-
[[use-of-java.sql.connection-objects]]
=== Use of java.sql.Connection Objects
@@ -541,14 +513,14 @@ public class Payroll
DriverManager.getConnection( "jdbc:default:connection" ) ;
PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
+ conn.prepareStatement( "UPDATE trafodion.persnl.employee "
+ "SET salary = salary * (1 + (? / 100)) "
+ "WHERE empnum = ?"
) ;
PreparedStatement getSalary =
conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
@@ -584,7 +556,7 @@ connections created in the SPJ method are associated with that catalog
and schema, meaning that unqualified database objects with one-part or
two-part names in the SPJ method are qualified with the same catalog
and/or schema name as the SPJ. For example, this SPJ method, which is
-registered as an SPJ in the DEMO.SALES schema, refers to the unqualified
+registered as an SPJ in the TRAFODION.SALES schema, refers to the unqualified
database object, ORDERS:
[source, java]
@@ -616,7 +588,7 @@ public static void numDailyOrders( Date date
----
In the SPJ environment, the ORDERS table is qualified by default with
-the same catalog and schema as the SPJ, DEMO.SALES.
+the same catalog and schema as the SPJ, TRAFODION.SALES.
The default behavior takes effect only when `getConnection()` does not
contain catalog and schema properties. Catalog and schema property
@@ -670,7 +642,7 @@ function, and CURRENT_USER (or USER) is an SQL function that returns the
name of the database user who is authorized to invoke the function. If
you plan to use the SESSION_USER or CURRENT_USER (or USER) function in
an SPJ method, you should be aware of differences in their behavior
-depending on how extenal security is defined for the stored procedure.
+depending on how external security is defined for the stored procedure.
Suppose that you write this Java method, which uses the CURRENT_USER
function to return the name of the database user who is authorized to
@@ -698,7 +670,7 @@ and called the stored procedure.
For example, suppose that DB USERADMINUSER creates a stored procedure
named GETINVOKER using the `getUser()` method and sets the external
-security to invoker. If a database user named PAULLOW1, who has the
+security to invoker. If a database user named GTAPPER, who has the
EXECUTE privilege on the stored procedure, calls GETINVOKER, the procedure
returns his name:
@@ -706,15 +678,15 @@ returns his name:
Welcome to Apache Trafodion Command Interface
Copyright (c) 2015 Apache Software Foundation
-User Name:PAULLOW1 Password:
+User Name:GTAPPER Password:
Connected to Data Source: TDM_Default_DataSource
-SQL> CALL demo.persnl.getinvoker() ;
+SQL> CALL trafodion.persnl.getinvoker() ;
(EXPR)
--------------------------------------------------------------------------------
-PAULLOW1
+GTAPPER
--- 1 row(s) selected.
@@ -732,17 +704,17 @@ user who created the stored procedure.
For example, suppose that DB USERADMINUSER creates a stored procedure
named GETDEFINER using the `getUser(`) method and sets the external
-security to definer. If the database user named PAULLOW1, who has the
+security to definer. If the database user named GTAPPER, who has the
EXECUTE privilege on the stored procedure, calls GETDEFINER, the procedure
returns the name of the stored procedures's creator, DB USERADMINUSER,
-whose privileges PAULLOW1 is using to call the procedure:
+whose privileges GTAPPER is using to call the procedure:
```
SQL> SHOW USER
-USER PAULLOW1 (NONE)
+USER GTAPPER (NONE)
-SQL> CALL demo.persnl.getdefiner() ;
+SQL> CALL trafodion.persnl.getdefiner() ;
(EXPR)
--------------------------------------------------------------------------------
@@ -776,7 +748,7 @@ external security setting of the stored procedure.
For example, suppose that DB USERADMINUSER creates a stored procedure named
GETSESSIONUSER using the `getSessionUser()` method and sets the external
-security to definer. If the database user named PAULLOW1, who has the EXECUTE
+security to definer. If the database user named GTAPPER, who has the EXECUTE
privilege on the stored procedure, calls GETSESSIONUSER, the procedure
returns his name because he is the authenticated user who started the
session and invoked the function:
@@ -784,13 +756,13 @@ session and invoked the function:
```
SQL> SHOW USER
-USER PAULLOW1 (NONE)
+USER GTAPPER (NONE)
-SQL> CALL demo.persnl.getsessionuser() ;
+SQL> CALL trafodion.persnl.getsessionuser() ;
(EXPR)
--------------------------------------------------------------------------------
-PAULLOW1
+GTAPPER
--- 1 row(s) selected.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
index db287f7..0bd5ae5 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
@@ -182,9 +182,9 @@ work where needed.
The Trafodion database engine manages a single thread of execution within
an SPJ environment, even if the application that issues a CALL statement
-is a multithreaded Java application.
+is a multi-threaded Java application.
-The CALL statements in a multithreaded application can execute in a nonblocking manner,
+The CALL statements in a multi-threaded application can execute in a nonblocking manner,
but the SPJ methods underlying those CALL statements execute serially within a
given SPJ environment.
@@ -210,14 +210,14 @@ example:
[source, sql]
----
-CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
+CALL trafodion.persnl.adjustsalary( 202, 5.5, ? ) ;
----
Or, for example:
[source, sql]
----
-SET SCHEMA demo.persnl ;
+SET SCHEMA trafodion.persnl ;
CALL adjustsalary( 202, 5.5, ? ) ;
----
@@ -241,7 +241,7 @@ CALL statement:
[source, sql]
----
-CALL demo.persnl.adjustsalary( 202, 5, ? ) ;
+CALL trafodion.persnl.adjustsalary( 202, 5, ? ) ;
----
If the SPJ does not accept arguments, you must specify empty
@@ -249,7 +249,7 @@ parentheses, as shown below:
[source, sql]
----
-CALL demo.sales.lowerprice() ;
+CALL trafodion.sales.lowerprice() ;
----
If the SPJ has one IN parameter, one OUT parameter, and two result sets,
@@ -257,7 +257,7 @@ you must list the IN and OUT parameters but not the result sets in the
argument list:
```
-CALL demo.sales.ordersummary('01-01-2011', ?);
+CALL trafodion.sales.ordersummary('01-01-2011', ?);
```
[[data-conversion-of-parameter-arguments]]
@@ -388,7 +388,7 @@ command before calling the SPJ:
----
SQL> SET PARAM ?p 10 ;
-SQL> CALL demo.sales.totalprice( 23, 'standard', ?p ) ;
+SQL> CALL trafodion.sales.totalprice( 23, 'standard', ?p ) ;
----
The CALL statement returns the total price of the item:
@@ -421,7 +421,7 @@ price:
[source, sql]
----
-SQL> PREPARE stmt1 FROM CALL demo.sales.totalprice( 50, 'nextday', ? ) ;
+SQL> PREPARE stmt1 FROM CALL trafodion.sales.totalprice( 50, 'nextday', ? ) ;
--- SQL command prepared.
@@ -445,7 +445,7 @@ INOUT parameter returns the total price:
[source, sql]
----
-SQL> PREPARE stmt2 FROM CALL demo.sales.totalprice( ?, ?, ? ) ;
+SQL> PREPARE stmt2 FROM CALL trafodion.sales.totalprice( ?, ?, ? ) ;
--- SQL command prepared.
@@ -475,7 +475,7 @@ for the number of orders and two result sets in the trafci session:
[source, sql]
----
-SQL> CALL demo.sales.ordersummary( '01-01-2011', ? ) ;
+SQL> CALL trafodion.sales.ordersummary( '01-01-2011', ? ) ;
NUM_ORDERS
--------------------
@@ -541,7 +541,7 @@ SQLBindParameter( hstmt, 2, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, 0, 0, 5.5,
SQLBindParameter( hstmt, 3, SQL_PARAM_OUTPUT, SQL_C_NUMERIC, SQL_NUMERIC, 8, 2, &salary, 0, &cbParam ) ;
/* Execute the CALL statement. */
-SQLExecDirect( hstmt, "{ CALL demo.persnl.adjustsalary( ?, ?, ? ) }", SQL_NTS ) ;
+SQLExecDirect( hstmt, "{ CALL trafodion.persnl.adjustsalary( ?, ?, ? ) }", SQL_NTS ) ;
----
////
@@ -574,7 +574,7 @@ SQLHSTMT s ;
RETCODE rc = SQLAllocHandle( SQL_HANDLE_STMT, myConnection, &s ) ;
/* Prepare a CALL */
-char *stmtText = "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) } ";
+char *stmtText = "{ CALL trafodion.sales.ordersummary( '01-01-2011', ? ) } ";
rc = SQLPrepare( s, (SQLCHAR *) stmtText, strlen( stmtText ) ) ;
/* Bind the output parameter */
@@ -635,7 +635,7 @@ In this example, a CALL statement is executed from a JDBC client application:
[source, java]
----
CallableStatement stmt =
- con.prepareCall( "{ CALL demo.persnl.adjustsalary( ?, ?, ? ) }" ) ;
+ con.prepareCall( "{ CALL trafodion.persnl.adjustsalary( ?, ?, ? ) }" ) ;
stmt.setBigDecimal( 1, 202 ) ; // x = 202
stmt.setDouble( 2, 5.5 ) ; // y = 5.5
@@ -668,7 +668,7 @@ and moves processing to the next available result set.
----
// Prepare a CALL statement
java.sql.CallableStatement s =
- myConnection.prepareCall( "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) }" ) ;
+ myConnection.prepareCall( "{ CALL trafodion.sales.ordersummary( '01-01-2011', ? ) }" ) ;
// Register an output parameter
s.registerOutParameter( 1, java.sql.Types.BIGINT ) ;
@@ -702,7 +702,7 @@ available.
----
// Prepare a CALL statement
java.sql.CallableStatement s =
- myConnection.prepareCall ( "{ CALL demo.sales.ordersummary( '01-01-2011', ? ) }" ) ;
+ myConnection.prepareCall ( "{ CALL trafodion.sales.ordersummary( '01-01-2011', ? ) }" ) ;
// Register an output parameter
s.registerOutParameter( 1, java.sql.Types.BIGINT ) ;
@@ -757,11 +757,11 @@ when the QTY_ON_HAND column of the PARTLOC table is updated and exceeds
[source, sql]
----
-CREATE TRIGGER demo.sales.setsalesprice AFTER UPDATE OF qty_on_hand
-ON demo.invent.partloc
+CREATE TRIGGER trafodion.sales.setsalesprice AFTER UPDATE OF qty_on_hand
+ON trafodion.invent.partloc
FOR EACH STATEMENT REFERENCING NEW as newqty
WHEN ( SUM( newqty.qty_on_hand ) > 500 )
- CALL demo.sales.lowerprice() ;
+ CALL trafodion.sales.lowerprice() ;
----
For information about the CREATE TRIGGER syntax, see the
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc b/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
index 647ed54..a8e5c2b 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
@@ -25,7 +25,7 @@
Before you can start using SPJs on the Trafodion platform, verify that
you have the required software installed on the client workstation. The
-Trafodion platform is delivered to you ready to use and preconfigured
+Trafodion platform is delivered to you ready to use and pre-configured
with the software required to support SPJs.
[[required-client-software]]
@@ -42,40 +42,9 @@ http://www.oracle.com/technetwork/java/index.html
The version of the JDK that you download and use on the client
workstation should be the same as or lower than the Java version running
on the Trafodion database. To check the Java version that is running in
-the Trafodion database, use one of these approaches:
+the Trafodion database, use this approach:
-* Run `sqvers` in the `RUN_SCRIPT` stored procedure from `trafci`:
-+
-```
-SQL> CALL demo.hp_sp.run_script( 'sqvers', '', '', ? ) ;
-
-OUTRESULT
-------------------------------------------------------------
-Requesting user: DB ROOT
-Current time: 2013-05-22 04:44:16.00
-Location of script: /opt/hp/sqtest4/M9V29713/export/bin64
-Results are stored in table: "sqvers@2013-05-22@04:44:16.00"
-Command executed: sqvers
-
-RESULTS
-----------------------------------
-
-MY_SQROOT=/opt/hp/sqtest4/M9V29713
-who@host=sqtest4@n013
-JAVA_HOME=/usr/java/jdk1.7.0_09
-
---- 3 row(s) selected.
-
---- SQL operation complete.
-
-SQL>
-```
-+
-In this example, the returned `JAVA_HOME` indicates that the Trafodion
-database supports Java SE 7 or JDK 7 (1.7.0), or earlier versions of the
-JDK.
-
-* Launch `trafci` on the Trafodion platform, and run the `LOCALHOST` or `LH java -version` command.
+* Launch `trafci` on the Trafodion platform, and run the `LOCALHOST` or `lh java -version` command.
(To use the on-platform trafci client, see the
http://trafodion.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide.)
For example:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
index ac76226..9b1ed05 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
@@ -85,7 +85,7 @@ WITH GRANT OPTION privileges on ADJUSTSALARY to the Payroll directors.
[source, sql]
----
GRANT EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary
+ON PROCEDURE trafodion.persnl.adjustsalary
TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
----
@@ -95,7 +95,7 @@ ADJUSTSALARY to the regional department managers:
[source, sql]
----
GRANT EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary TO "rgn1mgr", "rgn2mgr", "rgn3mgr"
+ON PROCEDURE trafodion.persnl.adjustsalary TO "rgn1mgr", "rgn2mgr", "rgn3mgr"
WITH GRANT OPTION ;
----
@@ -113,7 +113,7 @@ TOTALPRICE to PUBLIC, meaning all present and future database users and roles:
[source, sql]
----
GRANT EXECUTE
-ON PROCEDURE demo.sales.totalprice TO PUBLIC ;
+ON PROCEDURE trafodion.sales.totalprice TO PUBLIC ;
----
After granting the EXECUTE privilege to PUBLIC, you cannot revoke the
@@ -148,7 +148,7 @@ grants these access privileges to the Payroll directors:
[source, sql]
----
GRANT SELECT, UPDATE (salary)
-ON TABLE demo.persnl.employee
+ON TABLE trafodion.persnl.employee
TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
----
@@ -158,7 +158,7 @@ regional department managers:
[source, sql]
----
GRANT SELECT, UPDATE (salary)
-ON TABLE demo.persnl.employee
+ON TABLE trafodion.persnl.employee
TO "rgn1mgr", "rgn2mgr", "rgn3mgr" ;
----
@@ -207,7 +207,7 @@ Region 2 department manager:
[source, sql]
----
REVOKE EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "rgn2mgr" ;
+ON PROCEDURE trafodion.persnl.adjustsalary FROM "rgn2mgr" ;
----
The `payrolldir1` user cannot revoke the EXECUTE or WITH GRANT OPTION
@@ -223,7 +223,7 @@ privilege from the `payrolldir1` user:
[source, sql]
----
REVOKE GRANT OPTION FOR EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1" ;
+ON PROCEDURE trafodion.persnl.adjustsalary FROM "payrolldir1" ;
----
A user can also revoke the EXECUTE privilege from any user or role to
@@ -237,7 +237,7 @@ whom the `payrolldir1` user granted privileges:
[source, sql]
----
REVOKE GRANT OPTION FOR EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1"
+ON PROCEDURE trafodion.persnl.adjustsalary FROM "payrolldir1"
CASCADE ;
----
@@ -251,7 +251,7 @@ SPJ named TOTALPRICE from all users and roles (that is, PUBLIC):
[source, sql]
----
REVOKE EXECUTE
-ON PROCEDURE demo.sales.totalprice FROM PUBLIC;
+ON PROCEDURE trafodion.sales.totalprice FROM PUBLIC;
----
== Using Script Files to Grant and Revoke Privileges
@@ -273,20 +273,20 @@ GRANT PROCEDURE and GRANT statements:
?SECTION GrantSalesProcs
GRANT EXECUTE
-ON demo.sales.monthlyorders
+ON trafodion.sales.monthlyorders
TO PUBLIC ;
GRANT SELECT
-ON TABLE demo.sales.orders TO PUBLIC ;
+ON TABLE trafodion.sales.orders TO PUBLIC ;
?SECTION GrantPersnlProcs
GRANT EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary TO "payrolldir1", "payrolldir2"
+ON PROCEDURE trafodion.persnl.adjustsalary TO "payrolldir1", "payrolldir2"
WITH GRANT OPTION ;
GRANT SELECT, UPDATE(salary)
-ON TABLE demo.persnl.employee
+ON TABLE trafodion.persnl.employee
TO "payrolldir1", "payrolldir2" WITH GRANT OPTION ;
----
@@ -310,19 +310,19 @@ a series of REVOKE PROCEDURE and REVOKE statements:
?SECTION RevokeSalesProcs
REVOKE EXECUTE
-ON PROCEDURE demo.sales.monthlyorders FROM PUBLIC ;
+ON PROCEDURE trafodion.sales.monthlyorders FROM PUBLIC ;
REVOKE SELECT
-ON TABLE demo.sales.orders FROM PUBLIC ;
+ON TABLE trafodion.sales.orders FROM PUBLIC ;
?SECTION RevokePersnlProcs
REVOKE EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary FROM "payrolldir1", "payrolldir2"
+ON PROCEDURE trafodion.persnl.adjustsalary FROM "payrolldir1", "payrolldir2"
CASCADE ;
REVOKE SELECT, UPDATE(salary)
-ON TABLE demo.persnl.employee
+ON TABLE trafodion.persnl.employee
FROM "payrolldir1", "payrolldir2" CASCADE ;
----
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc b/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
index eb8d690..83fa291 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
@@ -54,7 +54,7 @@ Trafodion database.
An SPJ method must be registered as a stored procedure in the database before a
client application can execute it with a CALL statement. You upload the SPJ to
-the cluster where the Trafodion datbase is running
+the cluster where the Trafodion database is running
and then you register the SPJ as a library object using the
http://trafodion.apache.org/docs/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
statement. Next, you register the library object using the
@@ -148,8 +148,13 @@ workstation. See <<get-started, Get Started>>.
2. Develop a Java method to be used as an SPJ:
.. Write a static Java method:
+
+Create a file named `Payroll.java` with the following content:
++
[source, java]
----
+import java.sql.* ;
+import java.math.* ;
+
public class Payroll
{
public static void adjustSalary( BigDecimal empNum
@@ -160,14 +165,14 @@ public class Payroll
DriverManager.getConnection( "jdbc:default:connection" ) ;
PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
+ conn.prepareStatement( "UPDATE trafodion.persnl.employee "
+ "SET salary = salary * (1 + (? / 100)) "
+ "WHERE empnum = ?"
) ;
PreparedStatement getSalary =
conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
@@ -190,7 +195,8 @@ public class Payroll
.. Compile the Java source file to produce a class file:
+
```
-javac Payroll.java
+$ javac Payroll.java
+$
```
.. Package the SPJ class file in a JAR file:
@@ -203,7 +209,10 @@ If the SPJ class refers to other classes, package the other classes in
the same JAR file as the SPJ class:
+
```
-jar cvf Payroll.jar Payroll.class other.class
+$ jar cvf Payroll.jar Payroll.class other.class
+added manifest
+adding: Payroll.class(in = 1213) (out= 711)(deflated 41%)
+$
```
+
For details, see <<develop-spj-methods, Develop SPJ Methods>>.
@@ -222,12 +231,12 @@ GRANT statements in an trafci session, as shown below:
[source,sql]
----
GRANT EXECUTE
-ON PROCEDURE demo.persnl.adjustsalary
+ON PROCEDURE trafodion.persnl.adjustsalary
TO "payrolldir1", "payrolldir2"
WITH GRANT OPTION ;
GRANT SELECT, UPDATE (salary)
-ON TABLE demo.persnl.employee
+ON TABLE trafodion.persnl.employee
TO "payrolldir1", "payrolldir2"
WITH GRANT OPTION ;
----
@@ -239,7 +248,7 @@ For example, you can issue a CALL statement in an trafci session, as
shown below, or in a JDBC or ODBC client application:
+
```
-SQL> CALL demo.persnl.adjustsalary( 29, 2.5, ? ) ;
+SQL> CALL trafodion.persnl.adjustsalary( 29, 2.5, ? ) ;
NEWSALARY
------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
index 4d12dd3..d0e1e2f 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
@@ -60,25 +60,6 @@ in the Java method are specified as arrays. See
that contains a different class name, method name, or method signature
than the original JAR file, without dropping and re-creating the SPJ.
-In HPDM, compare the library's class name, method name, and method
-signature with the procedure's external file (class name), external name
-(method name), and signature.
-
-To see the library's class name, method name, and method signature, launch
-the Library Browser dialog box in HPDM by right-clicking the name of the library,
-and selecting Browse Library.
-
-For more information, see <<use-the-library-browser, Use the Library Browser>>.
-To see the procedure's external file (class name),external name (method name),
-and signature in HPDM, see
-<<using-hpdm-to-display-a-procedure-in-a-schema, Using HPDM to Display a Procedure in a Schema>>.
-If you notice a discrepancy, then see
-<<altering-an-spj-and-its-java-bytecode, Altering an SPJ and Its Java Bytecode>>.
-
-* Check the characteristics of the stored procedure in HPDM and compare
-them with the SPJ method that resides on the Trafodion platform. Fix any
-discrepancies.
-
* Check the syntax of the CALL statement in the application. See
<<execute-spjs, Execute SPJs>>. Fix any problems.
@@ -129,14 +110,14 @@ Suppose that you want to display the execution plan for this CALL
statement:
```
-CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
+CALL trafodion.persnl.adjustsalary( 202, 5.5, ? ) ;
```
Enter this EXPLAIN statement in an trafci session:
[source, sql]
----
-SQL> PREPARE spj1 FROM CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
+SQL> PREPARE spj1 FROM CALL trafodion.persnl.adjustsalary( 202, 5.5, ? ) ;
--- SQL command prepared.
@@ -148,7 +129,7 @@ STATEMENT_NAME ........... SPJ1
PLAN_ID .................. 212206487012085509
ROWS_OUT ................. 1
EST_TOTAL_COST ........... 0
-STATEMENT ................ CALL demo.persnl.adjustsalary( 202, 5.5, ? )
+STATEMENT ................ CALL trafodion.persnl.adjustsalary( 202, 5.5, ? )
------------------------------------------------------------------ NODE LISTING
ROOT ====================================== SEQ_NO 2 ONLY CHILD 1
@@ -169,8 +150,8 @@ DESCRIPTION
LDAP_USERNAME .......... sqluser_admin
NVCI_PROCESS ........... ON
SHOWCONTROL_UNEXTERNALI OFF
- SCHEMA ................. DEMO.INVENT
- CATALOG ................ NEO
+ SCHEMA ................. TRAFODION.INVENT
+ CATALOG ................ TRAFODION
PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS)
PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.DATASOURCES)
PRIORITY ............... 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.ENVIRONMENTVALUES)
@@ -180,7 +161,7 @@ DESCRIPTION
input_variables ........ ?
CALL ====================================== SEQ_NO 1 NO CHILDREN
-TABLE_NAME ............... DEMO.PERSNL.ADJUSTSALARY
+TABLE_NAME ............... TRAFODION.PERSNL.ADJUSTSALARY
REQUESTS_IN .............. 1
ROWS_OUT ................. 1
EST_OPER_COST ............ 0
@@ -190,11 +171,11 @@ DESCRIPTION
fragment_id ............ 0
parent_frag ............ (none)
fragment_type .......... master
- routine_name ........... DEMO.PERSNL.ADJUSTSALARY
+ routine_name ........... TRAFODION.PERSNL.ADJUSTSALARY
parameter_modes ........ I I O
sql_access_mode ........ MODIFIES SQL DATA
external_name .......... adjustSalary
- library ................ DEMO.PERSNL.PAYROLL
+ library ................ TRAFODION.PERSNL.PAYROLL
external_file .......... Payroll
signature .............. (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V
language ............... JAVA
@@ -221,7 +202,7 @@ the result table of the EXPLAIN function, as shown below:
[source, sql]
----
-SQL> PREPARE spj1 FROM CALL demo.persnl.adjustsalary( 202, 5.5, ? ) ;
+SQL> PREPARE spj1 FROM CALL trafodion.persnl.adjustsalary( 202, 5.5, ? ) ;
--- SQL command prepared.
@@ -232,14 +213,14 @@ SQL> SELECT SUBSTRING( operator, 1, 8 ) AS "OPERATOR", operator_cost,
OPERATOR OPERATOR_COST DESCRIPTION
-------- -------------- --------------------------------------------------------------------------------------
CALL 0.0 max_card_est: -1 fragment_id: 0 parent_frag: (none) fragment_type: master routine_name:
-DEMO.PERSNL.ADJUSTSALARY parameter_modes: I I O sql_access_mode: MODIFIES SQL DATA external_name: adjustSalary
-library: DEMO.PERSNL.PAYROLL external_file: Payroll signature: (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V
+TRAFODION.PERSNL.ADJUSTSALARY parameter_modes: I I O sql_access_mode: MODIFIES SQL DATA external_name: adjustSalary
+library: TRAFODION.PERSNL.PAYROLL external_file: Payroll signature: (Ljava/math/BigDecimal;D[Ljava/math/BigDecimal;)V
language: JAVA parameter_style: JAVA external_security: INVOKER max_result_sets: 0 parameters: cast(202),
cast(cast((cast(5.5) / cast(10)))), NUMERIC(8,2) SIGNED
ROOT 0.0 max_card_est: 1 fragment_id: 0 parent_frag: (none) fragment_type: master statement_index:
0 affinity_value: 3466211324 max_max_cardinality: 1 total_overflow_size: 0.00 KB statement: call
-demo.persnl.adjustsalary( 202, 5.5 ,? ) xn_autoabort_interval: -1 plan_version: 2500 LDAP_USERNAME: sqluser_admin
-NVCI_PROCESS: ON SHOWCONTROL_UNEXTERNALIZED_ATTRS: OFF SCHEMA: DEMO.INVENT CATALOG: NEO PRIORITY: 9 (for table
+trafodion.persnl.adjustsalary( 202, 5.5 ,? ) xn_autoabort_interval: -1 plan_version: 2500 LDAP_USERNAME: sqluser_admin
+NVCI_PROCESS: ON SHOWCONTROL_UNEXTERNALIZED_ATTRS: OFF SCHEMA: TRAFODION.INVENT CATALOG: TRAFODION PRIORITY: 9 (for table
SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS) PRIORITY: 9 (for table SYSTEM_CATALOG.MXCS_SCHEMA.D
--- 2 row(s) selected. SQL>
[12/14] incubator-trafodion git commit: Merge remote-tracking branch
'origin/master' into TRAFODION-1905
Posted by db...@apache.org.
Merge remote-tracking branch 'origin/master' into TRAFODION-1905
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/96d03925
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/96d03925
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/96d03925
Branch: refs/heads/master
Commit: 96d03925f3e14be5a3eb6276173cc1032ecd230e
Parents: 2a4dcb0 b7ecf18
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Wed Apr 6 18:43:00 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Wed Apr 6 18:43:00 2016 -0600
----------------------------------------------------------------------
.../src/org/trafodion/jdbc/t4/HPT4Desc.java | 8 +-
.../trafodion/jdbc/t4/InterfaceResultSet.java | 10 +
.../trafodion/jdbc/t4/InterfaceStatement.java | 8 +-
.../jdbc/t4/TrafT4PreparedStatement.java | 32 +-
.../org/trafodion/jdbc/t4/TrafT4ResultSet.java | 19 +-
core/conn/odbc/src/odbc/Common/DrvrSrvr.cpp | 2 +
core/conn/odbc/src/odbc/Common/nskieee.cpp | 18 +
.../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp | 86 +-
core/conn/odbc/src/odbc/nsksrvrcore/srvrkds.cpp | 2 +
core/rest/Makefile | 5 +-
core/rest/pom.xml | 159 +-
core/rest/src/assembly/all.xml | 20 +-
.../main/java/org/trafodion/rest/Constants.java | 8 -
.../org/trafodion/rest/GetStatusResponse.java | 3 -
core/sqf/conf/install_features | 7 +-
core/sqf/hbase_utilities/pom.xml | 12 +-
.../backuprestore/TrafExportSnapshot.java | 85 +-
core/sqf/sqenvcom.sh | 140 +-
core/sqf/sql/scripts/install_local_hadoop | 75 +-
core/sqf/sql/scripts/sqgen | 1 +
core/sqf/src/seabed/src/fs.cpp | 3 +-
core/sqf/src/seatrans/.gitignore | 10 +
core/sqf/src/seatrans/hbase-trx/Makefile | 22 +-
core/sqf/src/seatrans/hbase-trx/pom.xml.apache | 45 +-
core/sqf/src/seatrans/hbase-trx/pom.xml.cdh | 8 +-
core/sqf/src/seatrans/hbase-trx/pom.xml.hdp | 15 +-
core/sqf/src/seatrans/hbase-trx/pp.awk | 138 +
core/sqf/src/seatrans/hbase-trx/reinstate_orig | 30 +
.../hbase/client/PatchClientScanner.java.tmpl | 237 +
.../CommitUnsuccessfulException.java | 0
.../HBaseBackedTransactionLogger.java | 0
.../client/transactional/JtaXAResource.java | 0
.../transactional/LocalTransactionLogger.java | 0
.../hbase/client/transactional/RMInterface.java | 8 +-
.../client/transactional/RegionHelper.java | 0
.../transactional/SsccTransactionalScanner.java | 289 -
.../SsccTransactionalScanner.java.tmpl | 297 +
.../transactional/SsccTransactionalTable.java | 8 +-
.../hbase/client/transactional/TmDDL.java | 0
.../client/transactional/TransactionLogger.java | 0
.../transactional/TransactionManager.java | 48 +-
.../TransactionRegionLocation.java | 12 +
.../transactional/TransactionalReturn.java | 0
.../transactional/TransactionalScanner.java | 319 -
.../TransactionalScanner.java.tmpl | 325 +
.../transactional/TransactionalTable.java | 7 +-
.../transactional/TransactionalTableClient.java | 8 +-
.../UnknownTransactionException.java | 0
.../transactional/SplitBalanceHelper.java | 666 +-
.../transactional/SsccRegionEndpoint.java | 4167 ------------
.../transactional/SsccRegionEndpoint.java.tmpl | 4127 ++++++++++++
.../transactional/TrxRegionEndpoint.java | 5885 ----------------
.../transactional/TrxRegionEndpoint.java.tmpl | 6271 ++++++++++++++++++
.../transactional/TrxRegionObserver.java | 920 ---
.../transactional/TrxRegionObserver.java.tmpl | 975 +++
.../transactional/TrxTableClient2.java | 0
.../generated/TrxRegionProtos.java | 5635 ++++++++++++++--
.../CleanOldTransactionsChore.java | 71 -
.../CleanOldTransactionsChore.java.tmpl | 81 +
.../transactional/KeyValueListScanner.java | 173 -
.../transactional/KeyValueListScanner.java.tmpl | 167 +
.../transactional/MemoryUsageChore.java | 64 -
.../transactional/MemoryUsageChore.java.tmpl | 75 +
.../SingleVersionDeleteNotSupported.java | 0
.../transactional/SsccTransactionState.java | 4 +-
.../transactional/TransactionState.java | 35 +-
.../transactional/TransactionalRegion.java | 7 +-
.../TransactionalRegionScannerHolder.java | 0
.../transactional/TrxTransactionState.java | 1039 ---
.../transactional/TrxTransactionState.java.tmpl | 1004 +++
.../hbase-trx/src/main/protobuf/TrxRegion.proto | 45 +-
.../sqf/src/seatrans/hbase-trx/uncomment_string | 36 +
core/sqf/src/seatrans/tm/hbasetmlib2/Makefile | 3 +
core/sqf/src/seatrans/tm/hbasetmlib2/pom.xml | 9 +-
.../src/seatrans/tm/hbasetmlib2/pom.xml.apache | 115 +
.../sqf/src/seatrans/tm/hbasetmlib2/pom.xml.hdp | 88 +
core/sql/arkcmp/CmpStatement.cpp | 2 -
core/sql/cli/CliExtern.cpp | 36 -
core/sql/cli/SQLCLIdev.h | 2 -
core/sql/cli/SessionDefaults.cpp | 2 +
core/sql/comexe/ComTdbHbaseAccess.h | 12 +-
core/sql/executor/ExHbaseAccess.h | 2 -
core/sql/executor/ExHbaseIUD.cpp | 28 +-
core/sql/executor/HBaseClient_JNI.cpp | 85 +-
core/sql/executor/HBaseClient_JNI.h | 10 +-
core/sql/executor/ex_control.cpp | 12 +-
core/sql/exp/ExpHbaseInterface.cpp | 25 +-
core/sql/exp/ExpHbaseInterface.h | 10 +-
core/sql/generator/GenRelUpdate.cpp | 10 +-
core/sql/nskgmake/Makerules.mk | 16 +-
core/sql/optimizer/BindRelExpr.cpp | 99 +-
core/sql/optimizer/NATable.cpp | 6 +-
core/sql/pom.xml | 12 +-
core/sql/pom.xml.apache | 131 +
core/sql/pom.xml.hdp | 111 +
core/sql/regress/core/DIFF116.KNOWN.SB | 21 -
core/sql/regress/core/EXPECTEDRTS | 1436 ++--
core/sql/regress/core/FILTERRTS | 2 +
core/sql/regress/core/TESTRTS | 24 +-
core/sql/regress/executor/EXPECTED020 | 4 +
core/sql/regress/privs2/EXPECTED135 | 219 +-
core/sql/regress/privs2/TEST135 | 50 +-
core/sql/regress/seabase/EXPECTED020 | 374 +-
core/sql/regress/seabase/TEST020 | 99 +-
core/sql/regress/tools/runregr_executor.ksh | 2 +-
core/sql/regress/udr/FILTER103 | 25 +
core/sql/regress/udr/Utils.java | 279 +
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 3 -
core/sql/sqlcomp/CmpSeabaseDDLschema.cpp | 57 +-
core/sql/sqlcomp/CmpSeabaseDDLview.cpp | 21 +-
core/sql/sqlcomp/DefaultConstants.h | 10 +-
core/sql/sqlcomp/nadefaults.cpp | 13 +-
.../java/org/trafodion/sql/HBaseClient.java | 36 +-
.../java/org/trafodion/sql/HTableClient.java | 15 +-
.../src/asciidoc/_chapters/odbc_windows.adoc | 1 -
install/installer/rest_installer | 1 -
install/installer/traf_cloudera_mods98 | 6 +-
install/installer/traf_config_check | 7 +-
install/installer/traf_hortonworks_mods98 | 24 +-
licenses/lic-rest-bin | 1415 +++-
licenses/not-rest-bin | 20 +
121 files changed, 23686 insertions(+), 15280 deletions(-)
----------------------------------------------------------------------
[11/14] incubator-trafodion git commit: Backup checkin.
Posted by db...@apache.org.
Backup checkin.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/2a4dcb02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/2a4dcb02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/2a4dcb02
Branch: refs/heads/master
Commit: 2a4dcb021e3536af762121d0ab39d0c9a9287f6e
Parents: 5e15be3
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Wed Apr 6 18:41:52 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Wed Apr 6 18:41:52 2016 -0600
----------------------------------------------------------------------
.../src/asciidoc/_chapters/introduction.adoc | 2 +-
.../src/asciidoc/_chapters/odb.adoc | 6 +-
.../src/asciidoc/_chapters/trickle_load.adoc | 2 +-
docs/shared/license.txt | 11 +
docs/spj_guide/pom.xml | 12 +-
.../spj_guide/src/asciidoc/_chapters/about.adoc | 31 +-
.../src/asciidoc/_chapters/create_spjs.adoc | 139 ++++++--
.../src/asciidoc/_chapters/deploy_spjs.adoc | 29 +-
.../src/asciidoc/_chapters/develop_spjs.adoc | 63 ++--
.../src/asciidoc/_chapters/execute_spjs.adoc | 44 ++-
.../src/asciidoc/_chapters/get_started.adoc | 26 +-
.../asciidoc/_chapters/grant_privileges.adoc | 9 +-
.../src/asciidoc/_chapters/introduction.adoc | 34 +-
.../_chapters/performance_troubleshooting.adoc | 20 +-
.../src/asciidoc/_chapters/sample_spjs.adoc | 330 +++++++++++--------
docs/spj_guide/src/asciidoc/index.adoc | 52 +--
.../src/images/call-statement-elements.jpg | Bin 16652 -> 33415 bytes
.../src/resources/acknowledgements.txt | 38 +++
docs/spj_guide/src/resources/source/Sales.java | 6 +-
.../src/resources/source/partData.java | 8 +-
docs/src/site/markdown/documentation.md | 63 ++--
docs/src/site/markdown/index.md | 2 +-
docs/src/site/site.xml | 13 +-
23 files changed, 561 insertions(+), 379 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/client_install/src/asciidoc/_chapters/introduction.adoc
----------------------------------------------------------------------
diff --git a/docs/client_install/src/asciidoc/_chapters/introduction.adoc b/docs/client_install/src/asciidoc/_chapters/introduction.adoc
index 0d88d72..91485b7 100644
--- a/docs/client_install/src/asciidoc/_chapters/introduction.adoc
+++ b/docs/client_install/src/asciidoc/_chapters/introduction.adoc
@@ -57,7 +57,7 @@ Trafodion database.
A driver that enables applications, which were developed for the Microsoft Open Database Connectivity (ODBC) application programming
interface (API) and which run on a Windows workstation, to connect to a Trafodion database.
| *Trafodion odb tool* | A multi-threaded, ODBC-based command-line tool for parallel data loading and extracting. For more information, see the
-http://trafodion.incubator.apache.org/docs/odb_user/index.html[Trafodion odb User Guide].
+http://trafodion.incubator.apache.org/docs/odb/index.html[Trafodion odb User Guide].
|===
^1^ License issues prevent us from including the ODBC Driver for Windows in this release. Contact the
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/client_install/src/asciidoc/_chapters/odb.adoc
----------------------------------------------------------------------
diff --git a/docs/client_install/src/asciidoc/_chapters/odb.adoc b/docs/client_install/src/asciidoc/_chapters/odb.adoc
index 4e397af..ff8745d 100644
--- a/docs/client_install/src/asciidoc/_chapters/odb.adoc
+++ b/docs/client_install/src/asciidoc/_chapters/odb.adoc
@@ -28,13 +28,13 @@
The odb tool runs on 64-bit Linux. On a Linux workstation, odb requires `pthread` libraries, which are usually installed by default. It also
requires the unixODBC Driver Manager to be installed and configured on the client workstation. For more information, see the
-http://trafodion.apache.org/docs/odb_user/index.html[_Trafodion odb User Guide_].
+http://trafodion.apache.org/docs/odb/index.html[_Trafodion odb User Guide_].
[[installation-instructions]]
== Installation Instructions
NOTE: Before following these installation instructions, please make sure to install and configure unixODBC on the client workstation. For more
-information, see the http://trafodion.apache.org/docs/odb_user/index.html[_Trafodion odb User Guide_].
+information, see the http://trafodion.apache.org/docs/odb/index.html[_Trafodion odb User Guide_].
You download and extract the Trafodion client package using the instructions in <<introduction-download, Download Installation Package>> above.
@@ -54,7 +54,7 @@ The command extracts these files:
* `README`
* `/bin/odb64luo` (the odb executable)
-3. You are now ready to run the odb executable. For more information, see the http://trafodion.apache.org/docs/odb_user/index.html[_Trafodion odb User Guide_].
+3. You are now ready to run the odb executable. For more information, see the http://trafodion.apache.org/docs/odb/index.html[_Trafodion odb User Guide_].
[[odb-uninstall]]
== Uninstall odb
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/load_transform/src/asciidoc/_chapters/trickle_load.adoc
----------------------------------------------------------------------
diff --git a/docs/load_transform/src/asciidoc/_chapters/trickle_load.adoc b/docs/load_transform/src/asciidoc/_chapters/trickle_load.adoc
index 4991619..8ab3964 100644
--- a/docs/load_transform/src/asciidoc/_chapters/trickle_load.adoc
+++ b/docs/load_transform/src/asciidoc/_chapters/trickle_load.adoc
@@ -114,7 +114,7 @@ The following odb commands/features are discussed in this guide:
* <<trickle-load-odb-extract, odb Extract>>
* <<trickle-load-odb-transform, odb Transform>>
-See the http://trafodion.incubator.apache.org/docs/odb_user/index.html[Trafodion odb User Guide]
+See the http://trafodion.incubator.apache.org/docs/odb/index.html[Trafodion odb User Guide]
for installation instructions and usage syntax for the odb tool.
The following subsections assume that you've installed odb.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/shared/license.txt
----------------------------------------------------------------------
diff --git a/docs/shared/license.txt b/docs/shared/license.txt
new file mode 100644
index 0000000..3dd96d1
--- /dev/null
+++ b/docs/shared/license.txt
@@ -0,0 +1,11 @@
+*License Statement*
+
+Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/spj_guide/pom.xml b/docs/spj_guide/pom.xml
index 8c2b3b4..9419051 100644
--- a/docs/spj_guide/pom.xml
+++ b/docs/spj_guide/pom.xml
@@ -184,8 +184,10 @@
<!-- Location of centralized stylesheet -->
<stylesheet>${basedir}/../shared/trafodion-manuals.css</stylesheet>
<project-version>${env.TRAFODION_VER}</project-version>
- <project-name>${env.PROJECT_NAME}</project-name>
- <project-logo>${env.PROJECT_LOGO}</project-logo>
+ <project-name>Trafodion</project-name>
+ <project-logo>${basedir}/../shared/trafodion-logo.jpg</project-logo>
+ <project-support>user@trafodion.incubator.apache.org</project-support>
+ <docs-url>http://trafodion.incubator.apache.org/docs</docs-url>
<build-date>${maven.build.timestamp}</build-date>
<google-analytics-account>UA-72491210-1</google-analytics-account>
</attributes>
@@ -211,8 +213,10 @@
<idprefix/>
<idseparator>-</idseparator>
<project-version>${env.TRAFODION_VER}</project-version>
- <project-name>${env.PROJECT_NAME}</project-name>
- <project-logo>${env.PROJECT_LOGO}</project-logo>
+ <project-name>Trafodion</project-name>
+ <project-logo>${basedir}/../shared/trafodion-logo.jpg</project-logo>
+ <project-support>user@trafodion.incubator.apache.org</project-support>
+ <docs-url>http://trafodion.incubator.apache.org/docs</docs-url>
<build-date>${maven.build.timestamp}</build-date>
</attributes>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/about.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/about.adoc b/docs/spj_guide/src/asciidoc/_chapters/about.adoc
index ebf0801..fa484cd 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/about.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/about.adoc
@@ -24,15 +24,15 @@
////
= About This Document
-This guide describes how to develop, deploy, and manage Stored Procedures in Java (SPJs) on the {project-name} database.
+This guide describes how to develop, deploy, and manage Stored Procedures in Java (SPJs) on {project-name}.
== Intended Audience
This manual is intended for application programmers who are writing and compiling Java code for stored procedures
-and for database administrators who are deploying and managing Stored Procedures in Java (SPJs) on the Trafodion
-database. The reader should know:
+and for database administrators who are deploying and managing Stored Procedures in Java (SPJs) on {project-name}.
+The reader should know:
* The Java programming language.
-* JDBC and the Trafodion JDBC Type-4 Driver.
+* JDBC and the {project-name} JDBC Type-4 Driver.
* Structured Query Language (SQL) and database terms and concepts.
Although not required, it helps to be familiar with the part of the ANSI SQL/Foundation standard called
@@ -46,18 +46,18 @@ This document is organized as follows:
|===
| Chapter | Description
| *<<introduction, Introduction>>* | Defines what an SPJ is, describes the benefits of using SPJs on the database,
-and lists steps for developing and deploying SPJs on Trafodion.
-| *<<get-started, Get Started>>* | Describes the software requirements for using SPJs on the Trafodion database.
+and lists steps for developing and deploying SPJs on {project-name}.
+| *<<get-started, Get Started>>* | Describes the software requirements for using SPJs on {project-name}.
| *<<develop-spj-methods, Develop SPJ Methods>>* | Provides guidelines for writing and compiling a Java method to be used as the
body of a stored procedure.
-| *<<deploy-spj-jar-files, Deploy SPJ JAR Files>>* | Explains how to deploy SPJ JAR files on the Trafodion database.
-| *<<create-spjs, Create SPJs>>* | Explains how to create, drop, and alter an SPJ on the Trafodion database.
+| *<<deploy-spj-jar-files, Deploy SPJ JAR Files>>* | Explains how to deploy SPJ JAR files on {project-name}.
+| *<<create-spjs, Create SPJs>>* | Explains how to create, drop, and alter an SPJ on {project-name}.
| *<<grant-privileges, Grant Privileges>>* | Explains how to grant and revoke privileges for executing SPJs on the
-Trafodion database.
-| *<<execute-spjs, Execute SPJs>>* | Explains how to execute an SPJ on the Trafodion database by using the CALL statement.
+{project-name} database.
+| *<<execute-spjs, Execute SPJs>>* | Explains how to execute an SPJ on {project-name} by using the CALL statement.
| *<<performance-and-troubleshooting, Performance and Troubleshooting>>* |
Describes how to improve and monitor the performance of SPJs and provides guidelines for troubleshooting common problems.
-| *<<sample-spjs, Appendix A: Sample SPJs>>* | Provides examples of SPJ methods that demonstrate business logic on the Trafodion database.
+| *<<sample-spjs, Appendix A: Sample SPJs>>* | Provides examples of SPJ methods that demonstrate business logic on {project-name}.
| *<<sample-database, Appendix B: Sample Database>>* | Describes the sample database on which the Sample SPJs operate.
|===
@@ -190,11 +190,8 @@ match-value [NOT] LIKE _pattern
<<<
== Comments Encouraged
-The Trafodion community encourages your comments concerning this document. We are committed to providing documentation that meets your
-needs. Send any errors found, suggestions for improvement, or compliments to:
-
-issues@trafodion.incubator.apache.org
+We encourage your comments concerning this document. We are committed to providing documentation that meets your
+needs. Send any errors found, suggestions for improvement, or compliments to {project-support}.
Include the document title and any comment, error found, or suggestion for improvement you have concerning this document.
-Or, even better, join our community and help us improve our documentation. Please refer to
-http://trafodion.incubator.apache.org/contributing_redirect.html[Trafodion Contributor Guide] for details.
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
index cccc674..7eb409c 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/create_spjs.adoc
@@ -23,7 +23,7 @@
[[create-spjs]]
= Create SPJs
-You can create the procedures in the Trafodion database after you've deployed the libraries for the SPJ JAR files.
+You can create the procedures in {project-name} after you've deployed the libraries for the SPJ JAR files.
See <<deploy-spj-jar-files, Deploy SPJ JAR Files>>.
The examples in this chapter are based on the sample database documented
@@ -37,16 +37,16 @@ The Create Procedure tool registers an existing Java method as a stored
procedure in Java (SPJ) within SQL.
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_statement[CREATE PROCEDURE]
+{docs-url}/sql_reference/index.html#create_procedure_statement[CREATE PROCEDURE]
statement including considerations and required privileges.
[[create-procedure-settings]]
=== Create Procedure Settings
Reference:
-http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_syntax[Syntax Description of CREATE PROCEDURE].
+{docs-url}/sql_reference/index.html#create_procedure_syntax[Syntax Description of CREATE PROCEDURE].
You need to determine the following settings for the CREATE PROCEDURE statement:
@@ -61,18 +61,17 @@ You need to determine the following settings for the CREATE PROCEDURE statement:
- *parameter-mode*: IN (pass data to SPJ), OUT (accept data from SPJ), or INOUT (passed data to and accepts data from SPJ). +
- *sql-identifier*: The name of the parameter passed to the SPJ. +
- *sql-datatype*: SQL data type mapped to Java data type. See <<java-parameters, Java Parameters>> for mapping,
-http://trafodion.incubator.apache.org/docs/sql_reference/index.html#data_types[Data Types] for SQL data types. +
+{docs-url}/sql_reference/index.html#data_types[Data Types] for SQL data types. +
+
Repeat for each parameter in the SPJ.
-| *external name* | `external name java-method-name [java-signature]` |
+| *external name* | `external name 'java-method-name [( java-signature )]'` |
- *java-method-name*: case-sensitive name of the SPJ method of the form `[package-name.]class-name.method-name`. The Java method must exist in a
Java class file, `_class-name_.class`, within a library registered in the database. If the class file that contains the SPJ method is part of a
package, then you must also specify the package name. +
- *java-signature*: specifies the signature of the SPJ method and consists of `([java-datatype[, java-datatype]…])`
Necessary only if you want to specify a Java wrapper class (for example, `java.lang.integer`) instead of a java
-primitive data type (for example, `int`). See
-http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_syntax[Syntax Description of CREATE PROCEDURE].
-for more information.
+primitive data type (for example, `int`). Use the `javap` utility to determine the correct values for
+java-signature.
| *library* | `library [[catalog-name.]schema-name.]library-name` |
- *catalog*: must be `trafodion`. +
- *schema-name*: the schema the library is associated with. +
@@ -87,9 +86,9 @@ the stored procedure. +
+
See <<understand-external-security, Understand External Security>> for more information.
| *language java* | `language java` | Must be set specified the procedure is an SPJ rather than a UDF.
-Compare: http://trafodion.incubator.apache.org/docs/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
+Compare: {docs-url}/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
| *parameter style java* | `parameter style java` | Must be set specified the procedure is an SPJ rather than a UDF.
-Compare: http://trafodion.incubator.apache.org/docs/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
+Compare: {docs-url}/sql_reference/index.html#create_function_statement[CREATE FUNCTION].
| *_sql access_* |
`no sql` \| +
`contains sql` (default) \| +
@@ -114,15 +113,16 @@ you want the stored procedure to inherit the transaction from the calling applic
`deterministic` \| +
`not deterministic` (default) |
Whether the SPJ always returns the same values for out and inout parameters for a given set of argument values
-(`deterministic`) or does not return the same values (`not deterministic`). `deterministic` means that Trafodion
+(`deterministic`) or does not return the same values (`not deterministic`). `deterministic` means that {project-name}
can cache the result to improve performance.
| *_isolation_* |
`isolate` (default) \| +
`no isolate` |
The SPJ executes either in the environment of the database server (`no isolate`) or in an isolated environment
-(`isolate`, the default option). Trafodion allows both options but always executes the SPJ in the UDR server process (`isolate`).
+(`isolate`, the default option). {project-name} allows both options but always executes the SPJ in the UDR server process (`isolate`).
|===
+<<<
Consider the following method in the `Sales.java` class:
[source, java]
@@ -130,6 +130,7 @@ Consider the following method in the `Sales.java` class:
include::{sourcedir}/totalPrice.java[totalPrice procedure source code]
----
+<<<
The CREATE PROCEDURE attributes for `totalPrice` are defined as follows:
[cols="15%,40%,45%",options="header",]
@@ -144,7 +145,7 @@ Possible values are: `economy`, `standard`, or `nextday`. `VARCHAR(10)` is a goo
The SPJ uses an input price to calculate to total price including taxes and shipping cost.
Therefore, `INOUT` is the appropriate choice. Given that the `_qty_` argument is NUMERIC(18), then this argument should be too. The precision choice fits the the
type of calculation being peformed.
-| *external name* | `EXTERNAL NAME Sales.totalPrice` | The class name is `Sales`. The procedure name is `totalPrice`.
+| *external name* | `EXTERNAL NAME 'Sales.totalPrice'` | The class name is `Sales`. The procedure name is `totalPrice`.
| *library* | `library trafodion.sales.sales` | The library name was defined using the CREATE LIBRARY statement.
See the example in <<create-a-library, Create a Library>>.
| *external security* | `invoker`^1^ | Use the privileges of the SPJ invoker.
@@ -159,6 +160,7 @@ See the example in <<create-a-library, Create a Library>>.
^1^ Definition represents default value.
+<<<
Using the information above, you create the new procedure as follows:
[source, sql]
@@ -194,6 +196,98 @@ CREATE PROCEDURE trafodion.sales.totalprice( IN qty NUMERIC (18),
;
----
+<<<
+To understand how to define `java-signature`, consider the following method in the
+`Inventory.java` class.
+
+[source,java]
+----
+public static void supplierInfo( BigDecimal suppNum
+ , String[] suppName
+ , String[] streetAddr
+ , String[] cityName
+ , String[] stateName
+ , String[] postCode
+ ) throws SQLException
+{
+ Connection conn =
+ DriverManager.getConnection( "jdbc:default:connection" ) ;
+
+ PreparedStatement getSupplier =
+ conn.prepareStatement( "SELECT suppname, street, city, "
+ + " state, postcode "
+ + "FROM trafodion.invent.supplier "
+ + "WHERE suppnum = ?"
+ ) ;
+
+ getSupplier.setBigDecimal( 1, suppNum ) ;
+ ResultSet rs = getSupplier.executeQuery() ;
+ rs.next() ;
+
+ suppName[0] = rs.getString( 1 ) ;
+ streetAddr[0] = rs.getString( 2 ) ;
+ cityName[0] = rs.getString( 3 ) ;
+ stateName[0] = rs.getString( 4 ) ;
+ postCode[0] = rs.getString( 5 ) ;
+
+ rs.close() ;
+ conn.close() ;
+}
+----
+
+<<<
+The CREATE PROCEDURE attributes for `supplierInfo` are defined as follows:
+
+[cols="20%,85%",options="header"]
+|===
+| Attribute | Definition
+| *procedure-ref* | `trafodion.invent.supplierinfo`
+| *sql-parameter-1* | `IN suppnum NUMERIC(4)`
+| *sql-parameter-2* | `OUT suppname CHARACTER(18)`
+| *sql-parameter-3* | `OUT address CHARACTER(22)`
+| *sql-parameter-4* | `OUT city CHARACTER(14)`
+| *sql-parameter-5* | `OUT state CHARACTER(12)`
+| *sql-parameter-6* | `OUT zipcode CHARACTER(10)`
+| *external name* |
+`EXTERNAL NAME 'Inventory.supplierInfo ( java.math.BigDecimal, java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[] )'`
+| *library* | `LIBRARY trafodion.invent.inventory`
+| *external security* | `invoker`^1^ +
+ +
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
+|===
+
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+<<<
+You can use the `javap` utility to inspect the attributes of the method.
+
+*Example*
+
+```
+$ javap Inventory.class
+Compiled from "Inventory.java"
+public class Inventory {
+ public Inventory();
+ public static void supplierInfo(java.math.BigDecimal, java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[], java.lang.String[]) throws java.sql.SQLException;
+ public static void supplyQuantities(int[], int[], int[]) throws java.sql.SQLException;
+ public static void partLocations(int, int, java.sql.ResultSet[], java.sql.ResultSet[]) throws java.sql.SQLException;
+}
+```
+
+The entry for `supplierInfo` method shows the attributes that should be used for `java-signature`.
+
+You don't specify for `java.sql.ResultSet[]` attributes; these are handled via the `DYNAMIC RESULTS SET` attribute
+in the `CREATE PROCEDURE` statement.
+
+<<<
[[understand-external-security]]
== Understand External Security
@@ -239,7 +333,7 @@ execute the SPJ without requiring privileges to the underlying database objects.
To set the external security of an SPJ, see <<create-a-procedure, Create a Procedure>>.
-
+<<<
[[drop-a-procedure]]
== Drop a Procedure
@@ -249,12 +343,12 @@ a schema-level privilege to other users or roles.
For example, if the schema owner granted you privileges to drop all objects in the schema,
you could drop procedures. For more information, see the GRANT SCHEMA statement in the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html#grant_statement[{project-name} SQL Reference Manual]
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#drop_procedure_statement[DROP PROCEDURE]
+{docs-url}/sql_reference/index.html#drop_procedure_statement[DROP PROCEDURE]
statement including considerations and required privileges.
*Example*
@@ -286,7 +380,8 @@ SQL> DROP PROCEDURE trafodion.sales.totalprice ;
SQL>
```
-[[display-procedures-and-their-properties}}
+<<<
+[[display-procedures-and-their-properties]]
== Display Procedures and Their Properties
In the trafci command-line interface, use the SHOW PROCEDURES command to
@@ -324,10 +419,10 @@ SQL>
----
For more information about trafci, see the
-http://trafodion.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide].
+{docs-url}/command_interface/index.html[{project-name} Command Interface Guide].
////
-20160323: Trafodion does not yet support the ALTER LIBRARY command.
+20160323: {project-name} does not yet support the ALTER LIBRARY command.
[[altering-an-spj-and-its-java-bytecode]]
=== Altering an SPJ and Its Java Bytecode
@@ -338,7 +433,7 @@ files that are packaged in the SPJ JAR file.
Suppose that you want to update the Java bytecode of an SPJ without
changing the class name, method name, or Java signature of the SPJ method.
In this case, you would alter the library by selecting the updated JAR file
-to upload to the Trafodion database, replacing the previous JAR file for the
+to upload to {project-name}, replacing the previous JAR file for the
library. For more information, see <<alter-a-library, Alter a Library>>.
NOTE: You are prevented from uploading a JAR file that is already in use
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
index 7a1a263..1f7ad25 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/deploy_spjs.adoc
@@ -24,7 +24,7 @@
= Deploy SPJ JAR Files
After developing and packaging the SPJ code into JAR files, you must
-move the JAR files from the client workstation to the Trafodion database.
+move the JAR files from the client workstation to {project-name}.
You can upload a SPJ JAR file and create a library by using
the CREATE LIBRARY command in the Trafodion Command Interface (trafci).
@@ -32,20 +32,21 @@ the CREATE LIBRARY command in the Trafodion Command Interface (trafci).
Libraries provide greater security for JAR files because libraries are
database objects whose access is controlled using standard SQL security.
-Deploying a JAR file to a Trafodion instance requires creating a library,
+Deploying a JAR file to a {project-name} instance requires creating a library,
and users must have the required privileges for creating libraries in order
to deploy JAR files.
The examples in this chapter are based on the sample database
documented in <<b-sample-database, Appendix B: Sample Database>>.
+<<<
[[create-a-library]]
== Create a Library
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
+{docs-url}/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
statement including considerations and required privileges.
NOTE: You must copy the jar file to the same directory on all the nodes in the cluster before running the CREATE LIBRARY statement.
@@ -89,7 +90,8 @@ $
```
$ pdsh $MY_NODES -x $HOSTNAME mkdir $HOME/trafodion-spjs
```
-
++
+<<<
3. Multi-node cluster only: Copy the jar file to all nodes in the cluster.
+
*Example*
@@ -135,9 +137,9 @@ SQL>
When you alter a library, you can change the underlying JAR file of the library.
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#alter_library_statement[ALTER LIBRARY]
+{docs-url}/sql_reference/index.html#alter_library_statement[ALTER LIBRARY]
statement including considerations and required privileges.
*Example*
@@ -184,17 +186,17 @@ SQL>
```
////
+<<<
[[drop-a-library]]
== Drop a Library
Dropping a library removes the library from the schema in the database
-and removes the library's underlying JAR file from the Trafodion
-database.
+and removes the library's underlying JAR file from {project-name}.
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#drop_library_statement[DROP LIBRARY]
+{docs-url}/sql_reference/index.html#drop_library_statement[DROP LIBRARY]
statement including considerations and required privileges.
*Example*
@@ -226,13 +228,14 @@ SQL> DROP LIBRARY trafodion.sales.saleslib ;
SQL>
```
+<<<
[[display-libraries]]
== Display Libraries
Refer to the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual]
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual]
for full documentation of the
-http://trafodion.apache.org/docs/sql_reference/index.html#get_statement[GET]
+{docs-url}/sql_reference/index.html#get_statement[GET]
statement.
Use the `GET libraries [ in schema [ catalog-name.] schema-name ] statement in trafci to
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
index 0b13648..acd0248 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/develop_spjs.adoc
@@ -49,7 +49,7 @@ public static void myMethodName ( java-parameter-list )
==== Public Access and Static Modifiers
The Java method must be defined as `public` and `static`. If a method is
-`private` or `protected`, then Trafodion is unable to find the Java
+`private` or `protected`, then {project-name} is unable to find the Java
method when you try to register the SPJ and returns an error. The Java
method must be defined as `static` so that the method can be invoked
without having to instantiate its class.
@@ -69,6 +69,7 @@ the parameter types in the Java signature must correspond to the SQL
parameters of the stored procedure that you are planning to create. For
type mappings, see the table below.
+<<<
[[table-1]]
.Mapping of Java Data Types to SQL Data Types
@@ -97,9 +98,9 @@ NUMERIC (including numeric with a precision greater than eighteen)^2^ | java.mat
| DOUBLE PRECISION | double or java.lang.double^4^
|===
-1. Trafodion stores PIC X as a CHAR data type.
-2. Numeric data types of SQL parameters must be signed, which is the default in Trafodion.
-3. Trafodion stores PIC S9 as a DECIMAL or NUMERIC data type.
+1. {project-name} stores PIC X as a CHAR data type.
+2. Numeric data types of SQL parameters must be signed, which is the default in {project-name}.
+3. {project-name} stores PIC S9 as a DECIMAL or NUMERIC data type.
4. By default, the SQL data type maps to a Java primitive type. The SQL data type maps to a Java wrapper class
only if you specify the wrapper class in the Java signature of the external name clause.
@@ -108,6 +109,7 @@ Output parameters in the Java signature must be arrays (for example,
the array at index 0. For more information, see
<<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>.
+<<<
[[returning-output-values-from-the-java-method]]
=== Returning Output Values From the Java Method
@@ -158,6 +160,7 @@ for each returned value. For example, the `supplierInfo()` method returns
a supplier's name, address, city, state, and post code, each as a single
string in an output parameter:
+<<<
The `supplyQuantities()` method returns an average quantity, a minimum
quantity, and a maximum quantity to separate output parameters of the
integer type:
@@ -167,12 +170,13 @@ integer type:
public static void supplyQuantities( int[] avgQty
, int[] minQty
, int[] maxQty
- )
+ ) throws SQLException
{
...
-throws SQLException
+}
+
----
For more information about the SPJ examples, see
@@ -189,13 +193,13 @@ type of the SPJ method must map to an SQL data type. See
The SQL data type must then map to a compatible data type in the calling
application. For the client application programming interfaces (APIs) that
support SPJs and for cross-references to the appropriate manuals for type
-mappings between Trafodion SQL and each API, see
+mappings between {project-name} SQL and each API, see
<<execute-spjs, Execute SPJs>> below.
[[returning-stored-procedure-result-sets]]
=== Returning Stored Procedure Result Sets
-The Trafodion database engine supports SPJs that return stored procedure
+{project-name} supports SPJs that return stored procedure
result sets. A stored procedure result set is a cursor that is left open
after the SPJ method executes (that is, after the CALL statement
executes successfully). After the CALL statement executes successfully,
@@ -267,13 +271,14 @@ to process them.
An SPJ method can return result sets that contain any data types, except
large object (LOB) data. An SPJ method can return a holdable or
-updatable cursor as a result set. However, Trafodion SQL does not expose
+updatable cursor as a result set. However, {project-name} SQL does not expose
those attributes in the calling application. An SPJ method can return a
ResultSet object that is a stored procedure result set acquired from a
nested CALL statement executed by the SPJ method. However, you are
discouraged from nesting CALL statements in SPJ methods. For more
information, see <<nested-java-method-invocations, Nested Java Method Invocations>>.
+<<<
If an SPJ method returns multiple ResultSet objects, the database engine
sorts the collection of valid result sets in chronological order
according to when the underlying SQL statements were executed. If the
@@ -283,7 +288,7 @@ database engine discards the other result sets and returns a warning to
the calling application.
When an SPJ method returns a ResultSet object through a
-`java.sql.ResultSet[]` parameter, Trafodion SQL exposes the underlying rows
+`java.sql.ResultSet[]` parameter, {project-name} SQL exposes the underlying rows
of data as an SQL cursor in the calling application.
If a returned result set is a scrollable cursor, all underlying rows are
@@ -379,17 +384,18 @@ method should be packaged in the same JAR file as the SPJ method. For
more information, see
<<compiling-and-packaging-java-classes, Compiling and Packaging Java Classes>>.
+<<<
[[accessing-a-trafodion-database]]
-== Accessing a Trafodion Database
+== Accessing {project-name}
-SPJ methods that access a Trafodion database must be from a Java class
+SPJ methods that access {project-name} must be from a Java class
that uses JDBC method calls. Follow these guidelines when writing an SPJ
-method that accesses a Trafodion database:
+method that accesses {project-name}:
[[use-of-java.sql.connection-objects]]
=== Use of java.sql.Connection Objects
-The Trafodion database engine supports a default connection in an SPJ
+{project-name} supports a default connection in an SPJ
execution environment, which has a data source URL of
`"jdbc:default:connection"`. For example:
@@ -400,13 +406,13 @@ Connection conn =
----
`java.sql.Connection` objects that use the `"jdbc:default:connection"` URL
-are portable to the Trafodion platform from other database management
+are portable to {project-name} from other database management
systems (DBMSs).
[[closing-default-connections]]
==== Closing Default Connections
-The Trafodion database engine controls default connections in the SPJ
+{project-name} controls default connections in the SPJ
environment and closes default connections when they are no longer
needed. Therefore, you do not need to use the `close()` method in an SPJ
method to explicitly close a default connection when the connection is
@@ -481,20 +487,21 @@ Connection conn =
DriverManager.getConnection( "jdbc:default:connection", props ) ;
----
+<<<
[[using-jdbc-method-calls]]
=== Using JDBC Method Calls
-The Trafodion platform uses a JDBC Type-4 driver internally to execute
+{project-name} uses a JDBC Type-4 driver internally to execute
the SQL statements inside an SPJ method. To enable an SPJ to perform SQL
-operations on a Trafodion database, use JDBC method calls in the SPJ
+operations on a {project-name} database, use JDBC method calls in the SPJ
method. The JDBC method calls must be supported by the JDBC Type-4
-driver on the Trafodion platform.
+driver on {project-name}.
-For example, if you want the SPJ method to operate on a Trafodion database,
-use the JDBC API that is supported by Trafodion.
+For example, if you want the SPJ method to operate on a {project-name} database,
+use the JDBC API that is supported by {project-name}.
NOTE: You do not have to explicitly load the JDBC driver before
-establishing a connection to the Trafodion database. The database engine
+establishing a connection to {project-name}. The database engine
automatically loads the JDBC driver when the SPJ is called.
Here is an example of an SPJ method, `adjustSalary()`, that uses JDBC
@@ -548,7 +555,7 @@ For other examples of SPJ methods, see <<sample-spjs, Appendix A: Sample SPJs>>.
In an SPJ method, you can refer to SQL database objects by specifying
three-part ANSI names that include the catalog, schema, and object name.
For more information about database object names, see the
-http://trafodion.incubator.apache.org/docs/sql_reference/index.hmtl[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.hmtl[{project-name} SQL Reference Manual].
The database engine propagates the names of the catalog and schema where
the SPJ is registered to the SPJ environment. By default, database
@@ -702,6 +709,7 @@ security is set to definer, any user who has the execute privilege on
the stored procedure can call the procedure using the privileges of the
user who created the stored procedure.
+<<<
For example, suppose that DB USERADMINUSER creates a stored procedure
named GETDEFINER using the `getUser(`) method and sets the external
security to definer. If the database user named GTAPPER, who has the
@@ -746,6 +754,7 @@ The SESSION_USER function returns the name of the authenticated database
user who started the session and invoked the function, regardless of the
external security setting of the stored procedure.
+<<<
For example, suppose that DB USERADMINUSER creates a stored procedure named
GETSESSIONUSER using the `getSessionUser()` method and sets the external
security to definer. If the database user named GTAPPER, who has the EXECUTE
@@ -775,11 +784,12 @@ For more information about external security, see
[[exception-handling]]
=== Exception Handling
-For SPJ methods that access a Trafodion database, no special code is
+For SPJ methods that access {project-name}, no special code is
necessary for handling exceptions. If an SQL operation fails inside an
SPJ, the error message associated with the failure is returned to the
application that issues the CALL statement.
+<<<
[[handling-java-exceptions]]
== Handling Java Exceptions
@@ -833,13 +843,14 @@ For more information about the numMonthlyOrders() method, see the
<<monthlyorders-procedure, MONTHLYORDERS Procedure>>.
For information about specific SQL errors, see the
-http://trafodion.incubator.apache.org/docs/messages_guide/index.html[Trafodion Messages Manual], which lists
+{docs-url}/messages_guide/index.html[{project-name} Messages Manual], which lists
the SQLCODE, SQLSTATE, message text, and cause-effect-recovery information for all SQL errors.
+<<<
[[compiling-and-packaging-java-classes]]
== Compiling and Packaging Java Classes
-On the Trafodion database, the class files of SPJ methods must be
+On {project-name}, the class files of SPJ methods must be
packaged in Java archive (JAR) files. After writing an SPJ method,
compile the Java source file of the SPJ method into Java bytecode and
package the Java bytecode in a JAR file. A Java method that you register
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
index 0bd5ae5..5100227 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/execute_spjs.adoc
@@ -24,8 +24,8 @@
= Execute SPJs
This chapter describes how to execute SPJs by using the CALL statement
-and assumes that you have already registered the SPJs in the Trafodion
-database and that you have granted privileges to execute the SPJs to the
+and assumes that you have already registered the SPJs in {project-name}
+and that you have granted privileges to execute the SPJs to the
appropriate database users. For information, see
<<deploy-spj-jar-files, Deploy SPJ JAR Files>>
and <<create-spjs, Create SPJs>>.
@@ -46,8 +46,7 @@ GTA 20160321: Triggers aren't supported yet. Uncommented as needed.
////
The CALL statement invokes an SPJ in the database. You can issue a CALL
-statement from any of these applications or interfaces supported by the
-Trafodion platform:
+statement from any of these applications or interfaces supported by {project-name}:
* trafci command-line interface or script file
* JDBC Type-4 client applications
@@ -59,6 +58,7 @@ use a CALL statement in a trigger but not inside a compound statement or
with rowsets. The SPJ that you use in a trigger must not have any OUT or
INOUT parameters or return any result sets.
+<<<
[[required-privileges-for-calling-an-spj]]
== Required Privileges for Calling an SPJ
@@ -98,7 +98,7 @@ automatically initiates a transaction if there is no active transaction.
[[using-transaction-control-statements-or-methods]]
==== Using Transaction Control Statements or Methods
-If you select Yes for the Transaction Required attribute when creating a
+If you select `Yes` for the Transaction Required attribute when creating a
stored procedure, then you should not use transaction control statements (or
equivalent JDBC transaction methods) in the SPJ method. Transaction
control statements include COMMIT WORK and ROLLBACK WORK, and the
@@ -133,7 +133,7 @@ WORK statement in the calling application to commit the transaction when
the CALL statement succeeds, and use the ROLLBACK WORK statement to roll
back the transaction when the CALL statement fails. For more information
about transaction management, see the
-http://trafodion.incubator.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual].
[[no-transaction-required]]
=== No Transaction Required
@@ -169,7 +169,8 @@ attribute to NO TRANSACTION REQUIRED when creating the stored procedure.
For more information, see the Transaction Required attribute in
<<create-a-procedure, Create a Procedure>>.
-If you select No for the Transaction Required attribute when creating a
+<<<
+If you select `No` for the Transaction Required attribute when creating a
stored procedure and if the SPJ method creates a JDBC default
connection, then that connection has autocommit enabled by default. You
can either use the autocommit transactions or disable autocommit
@@ -180,7 +181,7 @@ work where needed.
[[multithreading]]
== Multithreading
-The Trafodion database engine manages a single thread of execution within
+{project-name} manages a single thread of execution within
an SPJ environment, even if the application that issues a CALL statement
is a multi-threaded Java application.
@@ -198,8 +199,9 @@ and its arguments in a CALL statement, as shown in the figure below.
image:{images}/call-statement-elements.jpg[CALL Statement Elements]
For the syntax of the CALL statement, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#call_statement[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html#call_statement[{project-name} SQL Reference Manual].
+<<<
[[specifying-the-name-of-the-spj]]
=== Specifying the Name of the SPJ
@@ -309,12 +311,13 @@ that table below:
|===
For more information about SQL value expressions, see the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual].
Because an INOUT parameter passes a single value to and accepts a single
value from an SPJ, you can specify only dynamic parameters for INOUT
parameter arguments in a CALL statement.
+<<<
[[output-parameter-arguments]]
==== Output Parameter Arguments
@@ -351,6 +354,7 @@ result sets in different applications, see:
* <<returning-result-sets-in-an-odbc-client, Returning Result Sets in an ODBC Client>>
* <<returning-result-sets-in-a-jdbc-client, Returning Result Sets in a JDBC Client>>
+<<<
[[calling-spjs-in-trafci]]
== Calling SPJs in trafci
@@ -368,7 +372,7 @@ CALL statement. The procedure call changes the value of a named
parameter that you use as an OUT or INOUT parameter.
For more information about named and unnamed parameters, see the
-http://trafodion.incubator.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide].
+{docs-url}/command_interface/index.html[{project-name} Command Interface Guide].
[[using-named-parameters]]
=== Using Named Parameters
@@ -411,6 +415,7 @@ SQL> SHOW PARAM
p 253.97
----
+<<<
[[using-unnamed-parameters]]
=== Using Unnamed Parameters
@@ -464,6 +469,7 @@ PRICE
--- SQL operation complete.
----
+<<<
[[returning-result-sets-in-trafci]]
=== Returning Result Sets in trafci
@@ -504,6 +510,7 @@ ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
For other result set examples, see <<sample-spjs, Appendix A: Sample SPJs>>.
+<<<
[[calling-spjs-from-an-odbc-client-application]]
== Calling SPJs From an ODBC Client Application
@@ -550,10 +557,11 @@ once written.
For more information about the ODBC client applications,
see the
-http://trafodion.incubator.apache.org/docs/odbc_reference/index.html[Trafodion ODBC Driver Programmer's Reference].
+{docs-url}/odbc_reference/index.html[{project-name} ODBC Driver Programmer's Reference].
////
+<<<
[[returning-result-sets-in-an-odbc-client-application]]
=== Returning Result Sets in an ODBC Client Application
@@ -562,7 +570,7 @@ sets returned by a CALL statement. The `SQLMoreResults()` function closes
the current result set and moves processing to the next available result
set.
-NOTE: The Trafodion ODBC API does not currently support interleaved result set
+NOTE: The {project-name} ODBC API does not currently support interleaved result set
processing, where more than one returned result set can be open at a
time.
@@ -608,6 +616,7 @@ while ( ( rc = SQLMoreResults( s ) ) != SQL_NO_DATA )
}
----
+<<<
[[calling-spjs-from-a-jdbc-client-application]]
== Calling SPJs From a JDBC Client Application
@@ -649,12 +658,13 @@ BigDecimal z = stmt.getBigDecimal( 3 ) ; // Retrieve the value of the OUT parame
GTA 20160321: The JDBC T4 manual does not exist yet. Enable this line
once written.
-For more information about the Trafodion JDBC Type 4 driver and mappings of SQL to JDBC data types,
+For more information about the {project-name} JDBC Type 4 driver and mappings of SQL to JDBC data types,
see the
-http://trafodion.incubator.apache.org/docs/jdbct4_reference/index.html[Trafodion JDBC Type 4 Driver Programmer's Reference].
+{docs-url}/jdbct4_reference/index.html[{project-name} JDBC Type 4 Driver Programmer's Reference].
////
+<<<
[[returning-result-sets-in-a-jdbc-client-application]]
=== Returning Result Sets in a JDBC Client Application
@@ -744,7 +754,7 @@ are useful as triggered actions because they can help you encapsulate
and enforce rules in the database. For more information about the
benefits of using SPJs, see <<benefits-of-spjs, Benefits of SPJs>>
-Trafodion SQL supports a CALL statement in a trigger provided that the
+{project-name} SQL supports a CALL statement in a trigger provided that the
SPJ in the CALL statement does not have any OUT or INOUT parameters or
return any result sets. For more information, see
<<returning-output-values-from-the-java-method, Returning Output Values From the Java Method>>,
@@ -765,5 +775,5 @@ FOR EACH STATEMENT REFERENCING NEW as newqty
----
For information about the CREATE TRIGGER syntax, see the
-http://trafodion.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual].
////
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc b/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
index a8e5c2b..eeb4756 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/get_started.adoc
@@ -23,9 +23,9 @@
[[get-started]]
= Get Started
-Before you can start using SPJs on the Trafodion platform, verify that
-you have the required software installed on the client workstation. The
-Trafodion platform is delivered to you ready to use and pre-configured
+Before you can start using SPJs on {project-name}, verify that
+you have the required software installed on the client workstation.
+{project-name} is delivered to you ready to use and pre-configured
with the software required to support SPJs.
[[required-client-software]]
@@ -41,12 +41,13 @@ http://www.oracle.com/technetwork/java/index.html
The version of the JDK that you download and use on the client
workstation should be the same as or lower than the Java version running
-on the Trafodion database. To check the Java version that is running in
-the Trafodion database, use this approach:
+on {project-name}. To check the Java version that is running in
+{project-name}, use this approach:
-* Launch `trafci` on the Trafodion platform, and run the `LOCALHOST` or `lh java -version` command.
+* Launch `trafci` on {project-name}, and run the `LOCALHOST` or `lh java -version` command.
(To use the on-platform trafci client, see the
-http://trafodion.apache.org/docs/command_interface/index.html[Trafodion Command Interface Guide.)
+{docs-url}/command_interface/index.html[{project-name} Command Interface Guide].
++
For example:
+
```
@@ -59,14 +60,15 @@ Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode)
SQL>
```
+
-In this example, the returned Java version indicates that the Trafodion
+In this example, the returned Java version indicates that the {project-name}
instance supports Java SE 6 or JDK 6 (1.6.0), or earlier versions of the
JDK.
-NOTE: If you plan to install the Trafodion JDBC Type-4 Driver on the client
+NOTE: If you plan to install the {project-name} JDBC Type-4 Driver on the client
workstation, you must have JDK 6 (1.6.0) or higher installed on the
client workstation.
+<<<
[[recommended-client-software]]
== Recommended Client Software
@@ -76,15 +78,15 @@ client workstation.
`trafci` is a command-line interface in which you can run SQL statements,
such as GRANT PROCEDURE and CALL statements, interactively or from
script files. To install `trafci` on a client workstation, see the
-http://trafodion.apache.org/docs/client_install/index.html[Trafodion Client Installation Guide].
+{docs-url}/client_install/index.html[{project-name} Client Installation Guide].
[[hp-jdbc-type-4-driver]]
=== HP JDBC Type 4 Driver
-If you plan to use `trafci`, you must have a compatible version of the Trafodion
+If you plan to use `trafci`, you must have a compatible version of the {project-name}
JDBC Type-4 Driver installed on the client workstation.
To install the JDBC Type-4 driver on the client workstation, see the
-http://trafodion.apache.org/docs/client_install/index.html[Trafodion Client Installation Guide].
+{docs-url}/client_install/index.html[{project-name} Client Installation Guide].
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
index 9b1ed05..f369931 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/grant_privileges.adoc
@@ -28,7 +28,7 @@ granting privileges to specified database users and roles.
The schema in which an SPJ is registered is the unit of ownership. The
database user who creates the schema is the owner of that schema and all
-objects associated with it. In a Trafodion database, the schema owner
+objects associated with it. In {project-name}, the schema owner
automatically has these privileges:
* Ability to create and drop SPJs in the schema. You can create SPJs in
@@ -54,6 +54,7 @@ OPTION privileges to other users and roles. For more information, see:
To display the current ownership and privileges, see
<<display-procedures-and-their-properties, Display Procedures and Their Properties>>.
+<<<
[[granting-execute-privileges-on-an-spj]]
== Granting Execute Privileges on an SPJ
@@ -62,7 +63,7 @@ WITH GRANT OPTION privileges on an SPJ to specific database users and
roles. In a GRANT statement, specify ALL PRIVILEGES to grant the EXECUTE
privilege on an SPJ. For the syntax of the GRANT PROCEDURE and GRANT
statements, see the
-http://trafodion.incubator.apache.org/docs/sql_reference/index.html[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html[{project-name} SQL Reference Manual].
If you own the SPJ, then you can grant the EXECUTE and WITH GRANT OPTION
privileges on the SPJ to any database user or role. If you are not the
@@ -171,7 +172,7 @@ SELECT, UPDATE, DELETE, and INSERT, indicate which types of privileges
are required for the referenced database objects.
For the syntax of the GRANT statement, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#grant_statement[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html#grant_statement[{project-name} SQL Reference Manual].
[[revoking-execute-privileges-on-an-spj]]
== Revoking Execute Privileges on an SPJ
@@ -181,7 +182,7 @@ WITH GRANT OPTION privilege on an SPJ from specific database users or
roles. In a REVOKE statement, specify ALL PRIVILEGES to revoke the
EXECUTE privilege on an SPJ. For the syntax of the REVOKE PROCEDURE and
REVOKE statements, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#revoke_statement[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html#revoke_statement[{project-name} SQL Reference Manual].
If you own the SPJ, then you can revoke the EXECUTE and WITH GRANT OPTION
privileges on the SPJ from any database user or role to whom you granted
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc b/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
index 83fa291..d877409 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/introduction.adoc
@@ -23,8 +23,8 @@
[[introduction]]
= Introduction
-This chapter introduces stored procedures in Java (SPJs) in a Trafodion
-database and covers these topics:
+This chapter introduces stored procedures in Java (SPJs) in {project-name}
+and covers these topics:
[[what-is-an-spj]]
== What Is an SPJ?
@@ -38,27 +38,26 @@ function, which returns a value directly to the calling application, a
stored procedure returns each output value to a dynamic parameter in its
parameter list or returns a set of values to a result set array.
-The Trafodion database supports stored procedures written in the Java
-programming language. The Trafodion implementation of stored procedures
+{project-name} supports stored procedures written in the Java
+programming language. The {project-name} implementation of stored procedures
complies mostly, unless otherwise specified, with SQL/JRT (Java Routines
and Types), which extends the ANSI SQL/Foundation standard. A stored
procedure in Java (SPJ) is a Java method contained in a Java archive
-(JAR) file on the Trafodion platform, registered in the database, and
+(JAR) file on {project-name}, registered in the database, and
executed by the database engine when a client application issues a CALL
statement.
The body of a stored procedure consists of a public, static Java method
that returns void. These Java methods, called _SPJ methods_, are
-contained in classes within JAR files on the cluster hosting the
-Trafodion database.
+contained in classes within JAR files on the cluster hosting {project-name}.
An SPJ method must be registered as a stored procedure in the database before a
client application can execute it with a CALL statement. You upload the SPJ to
-the cluster where the Trafodion database is running
+the cluster where {project-name} is running
and then you register the SPJ as a library object using the
-http://trafodion.apache.org/docs/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
+{docs-url}/sql_reference/index.html#create_library_statement[CREATE LIBRARY]
statement. Next, you register the library object using the
-http://trafodion.apache.org/docs/sql_reference/index.html#create_procedure_statement[CREATE PROCEDURE]
+{docs-url}/sql_reference/index.html#create_procedure_statement[CREATE PROCEDURE]
statement.
[[benefits-of-spjs]]
@@ -77,7 +76,7 @@ the database. SPJs offer these advantages:
=== Java Methods Callable From SQL
With support for SPJs, Java methods are callable from any client
-application that connects to the Trafodion platform. For example, you can
+application that connects to {project-name}. For example, you can
invoke the same SPJ method from JDBC client applications and ODBC client
applications. By using the database engine to invoke Java methods, you
can extend the functionality of the database and share business logic
@@ -131,16 +130,16 @@ Java class files for SPJs once and deploy them anywhere.
Because SPJ methods are written in Java, and SPJs conform to the ANSI
SQL standard, SPJs are portable across different database servers. With
minimal changes to SPJ methods, you can port existing SPJ JAR files from
-another database server to a Trafodion platform and register the methods
-as stored procedures in a Trafodion database. You can also port client
-applications that call SPJs in other databases to Trafodion SQL with
+another database server to {project-name} and register the methods
+as stored procedures in a {project-name} database. You can also port client
+applications that call SPJs in other databases to {project-name} SQL with
minimal changes to the CALL statements in the application.
<<<
[[use-spjs]]
== Use SPJs
-To use SPJs in a Trafodion database:
+To use SPJs in {project-name}:
1. Verify that you have the required software installed on the client
workstation. See <<get-started, Get Started>>.
@@ -217,7 +216,7 @@ $
+
For details, see <<develop-spj-methods, Develop SPJ Methods>>.
-3. Deploy the SPJ JAR file on the Trafodion platform by creating a
+3. Deploy the SPJ JAR file on {project-name} by creating a
library object for the JAR file in one of the database schemas. For
details, see <<Deploy-spj-jar-files, Deploy SPJ JAR Files>>.
@@ -242,7 +241,8 @@ WITH GRANT OPTION ;
----
+
For details, see <<grant-privileges, Grant Privileges>>.
-
++
+<<<
6. Execute an SPJ by using a CALL statement in a client application.
For example, you can issue a CALL statement in an trafci session, as
shown below, or in a JDBC or ODBC client application:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2a4dcb02/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
index d0e1e2f..ed5b4e0 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/performance_troubleshooting.adoc
@@ -24,7 +24,7 @@
= Performance and Troubleshooting
This chapter describes how to improve and monitor the performance of
-SPJs on the Trafodion platform and provides guidelines for
+SPJs on {project-name} and provides guidelines for
troubleshooting common problems:
* <<troubleshooting-common-problems, Troubleshooting Common Problems>>
@@ -39,7 +39,7 @@ follow these guidelines:
* Note the SQLCODE or SQLSTATE value of the error messages and locate
the information in the
-http://trafodion.apache.org/docs/messages_guide/index.html[[Trafodion Messages Manual]],
+{docs-url}/messages_guide/index.html[[{project-name} Messages Manual]],
which provides cause, effect, and recovery information for all SQL errors.
* Check that the user has the appropriate permissions to create or call
@@ -73,16 +73,15 @@ SPJ method is not trying to insert more than one array element into a
`java.sql.ResultSets[]` array. For more information, see
<<returning-stored-procedure-result-sets, Returning Stored Procedure Result Sets>>.
-* To identify Java-related errors, execute the SPJ method outside the
-Trafodion database by invoking the Java method directly in a Java
-application that you run on a client workstation, using the Trafodion
-JDBC Type-4 driver to connect to the Trafodion platform.
+* To identify Java-related errors, execute the SPJ method outside {project-name}
+by invoking the Java method directly in a Java application that you run on a
+client workstation, using the {project-name} JDBC Type-4 driver to connect to {project-name}.
* If you are using JDBC tracing and logging, then follow these guidelines:
** Execute the SPJ method outside the database by invoking the Java
method directly from a Java application that you run on a client
-workstation, using the Trafodion JDBC Type-4 driver to connect to the Trafodion
+workstation, using the {project-name} JDBC Type-4 driver to connect to the {project-name}
platform.
** Verify that the file directory specified in the `T4LogFile` property
@@ -91,7 +90,7 @@ exists on the client workstation and that you have write access to it.
[[performance-tip]]
== Performance Tip
-To ensure the optimal performance of SPJs on the Trafodion platform,
+To ensure the optimal performance of SPJs on {project-name},
avoid nesting CALL statements in an SPJ method, which wastes resources
and might diminish performance. For more information, see
<<nested-java-method-invocations, Nested Java Method Invocations>>.
@@ -192,7 +191,7 @@ SQL>
The EXPLAIN statement generates and displays all the columns of the
result table of the EXPLAIN function. For the syntax of the EXPLAIN
statement, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#explain_statement[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html#explain_statement[{project-name} SQL Reference Manual].
[[using-the-explain-function]]
=== Using the EXPLAIN Function
@@ -230,6 +229,7 @@ For a CALL statement, the OPERATOR column of the result table contains a
row named CALL. The DESCRIPTION column contains special token pairs for
the CALL operator. For descriptions of the token pairs, see this table:
+<<<
.Token Pairs Description
[cols="30%,60%,10%", options="header"]
|===
@@ -261,5 +261,5 @@ DEFINER. For more information, see <<understand-external-security, Understand Ex
|===
For the syntax of the EXPLAIN function, see the
-http://trafodion.apache.org/docs/sql_reference/index.html#explain_statement[Trafodion SQL Reference Manual].
+{docs-url}/sql_reference/index.html#explain_statement[{project-name} SQL Reference Manual].
[14/14] incubator-trafodion git commit: Merge [TRAFODION-1905] PR 419
New SPJ Guide + some documentation fixes
Posted by db...@apache.org.
Merge [TRAFODION-1905] PR 419 New SPJ Guide + some documentation fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/00b3291a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/00b3291a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/00b3291a
Branch: refs/heads/master
Commit: 00b3291a372f710ff88aa006f362f50a70a3c0d3
Parents: b7ecf18 18119a6
Author: Dave Birdsall <db...@apache.org>
Authored: Fri Apr 8 18:49:56 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Fri Apr 8 18:49:56 2016 +0000
----------------------------------------------------------------------
docs/.gitignore | 2 -
.../src/asciidoc/_chapters/introduction.adoc | 2 +-
.../src/asciidoc/_chapters/odb.adoc | 6 +-
.../src/asciidoc/_chapters/trickle_load.adoc | 2 +-
docs/shared/license.txt | 11 +
docs/spj_guide/pom.xml | 8 +
.../spj_guide/src/asciidoc/_chapters/about.adoc | 31 +-
.../src/asciidoc/_chapters/create_spjs.adoc | 725 +++--
.../src/asciidoc/_chapters/deploy_spjs.adoc | 649 ++---
.../src/asciidoc/_chapters/develop_spjs.adoc | 171 +-
.../src/asciidoc/_chapters/execute_spjs.adoc | 625 ++--
.../src/asciidoc/_chapters/get_started.adoc | 57 +-
.../asciidoc/_chapters/grant_privileges.adoc | 254 +-
.../src/asciidoc/_chapters/introduction.adoc | 57 +-
.../_chapters/performance_troubleshooting.adoc | 461 +--
.../src/asciidoc/_chapters/sample_database.adoc | 826 +-----
.../src/asciidoc/_chapters/sample_spjs.adoc | 2678 ++++++------------
docs/spj_guide/src/asciidoc/index.adoc | 61 +-
.../src/images/call-statement-elements.jpg | Bin 0 -> 33415 bytes
.../src/resources/acknowledgements.txt | 38 +
.../src/resources/source/Inventory.java | 120 +
.../spj_guide/src/resources/source/Payroll.java | 151 +
docs/spj_guide/src/resources/source/Sales.java | 346 +++
.../src/resources/source/adjustSalary.java | 41 +
.../src/resources/source/employeeJob.java | 32 +
.../resources/source/invent_partloc_table.sql | 56 +
.../resources/source/invent_partsupp_table.sql | 128 +
.../src/resources/source/invent_schema.sql | 2 +
.../resources/source/invent_supplier_table.sql | 35 +
.../src/resources/source/lowerPrice.java | 44 +
.../src/resources/source/numDailyOrders.java | 29 +
.../src/resources/source/numMonthlyOrders.java | 41 +
.../src/resources/source/orderSummary.java | 76 +
.../src/resources/source/partData.java | 103 +
.../src/resources/source/partlocations.java | 42 +
.../src/resources/source/persnl_dept_table.sql | 70 +
.../resources/source/persnl_employee_table.sql | 99 +
.../src/resources/source/persnl_job_table.sql | 20 +
.../resources/source/persnl_project_table.sql | 45 +
.../src/resources/source/persnl_schema.sql | 2 +
.../src/resources/source/projectTeam.java | 25 +
.../resources/source/sales_customer_table.sql | 30 +
.../resources/source/sales_odetail_table.sql | 84 +
.../src/resources/source/sales_orders_table.sql | 66 +
.../src/resources/source/sales_parts_table.sql | 45 +
.../src/resources/source/sales_schema.sql | 2 +
.../src/resources/source/supplierinfo.java | 38 +
.../src/resources/source/supplyquantities.java | 32 +
.../src/resources/source/topSalesReps.java | 43 +
.../src/resources/source/totalPrice.java | 47 +
.../src/asciidoc/_chapters/sql_statements.adoc | 163 +-
docs/src/site/markdown/documentation.md | 63 +-
docs/src/site/markdown/index.md | 25 +-
.../resources/images/logo-carousel/slide-1.png | Bin 0 -> 58887 bytes
.../resources/images/logo-carousel/slide-2.png | Bin 0 -> 57783 bytes
docs/src/site/site.xml | 14 +-
56 files changed, 4406 insertions(+), 4417 deletions(-)
----------------------------------------------------------------------
[06/14] incubator-trafodion git commit: Merge remote-tracking branch
'origin/master' into TRAFODION-1905
Posted by db...@apache.org.
Merge remote-tracking branch 'origin/master' into TRAFODION-1905
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/23bfb3aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/23bfb3aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/23bfb3aa
Branch: refs/heads/master
Commit: 23bfb3aa413b75c976459fcf6490f0ddc07bb170
Parents: 6f5d4cc 4dda119
Author: Gunnar Tapper <gt...@esgyn.local>
Authored: Tue Mar 29 00:19:04 2016 -0600
Committer: Gunnar Tapper <gt...@esgyn.local>
Committed: Tue Mar 29 00:19:04 2016 -0600
----------------------------------------------------------------------
.../java/org/trafodion/jdbc/t2/BaseRow.java | 67 ---
.../java/org/trafodion/jdbc/t2/InsertRow.java | 89 ----
.../main/java/org/trafodion/jdbc/t2/Row.java | 275 ----------
core/sqf/sql/scripts/ilh_cleanhb | 106 ++++
core/sqf/sql/scripts/ilh_hbase_repair | 65 +++
core/sqf/sql/scripts/ilh_hbcheck | 72 +++
core/sqf/sql/scripts/ilh_traf_restart | 117 ++++
core/sqf/sql/scripts/ilh_trafinit | 108 ++++
.../sql/scripts/install_hadoop_regr_test_env | 4 +-
core/sqf/sql/scripts/install_local_hadoop | 5 +
core/sqf/sql/scripts/trafnodestatus | 105 ++++
core/sqf/sql/scripts/trafnodestatus.awk | 76 +++
core/sqf/tools/sqtools.sh | 56 ++
core/sql/generator/GenRelScan.cpp | 2 +-
core/sql/optimizer/NATable.cpp | 4 +-
core/sql/regress/core/EXPECTED131 | 89 +++-
core/sql/regress/core/TEST131 | 40 ++
core/sql/regress/privs1/EXPECTED133 | Bin 22984 -> 26383 bytes
core/sql/regress/privs1/TEST133 | 97 ++--
core/sql/regress/tools/runregr_udr.ksh | 2 +-
core/sql/regress/udr/EXPECTED103 | 529 +++++++++++++++++++
core/sql/regress/udr/TEST103 | 246 +++++++++
core/sql/regress/udr/TEST103_functions.cpp | 191 +++++++
core/sql/regress/udr/TEST103_procs.java | 224 ++++++++
core/sql/sqlcomp/CmpSeabaseDDL.h | 1 +
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 10 +
core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp | 23 +-
core/sql/sqlcomp/CmpSeabaseDDLschema.cpp | 101 +++-
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 2 +-
core/sql/ustat/hs_globals.cpp | 24 +-
install/installer/rest_installer | 11 +-
install/installer/traf_cloudera_mods98 | 64 ++-
install/installer/traf_config_check | 7 +-
install/installer/traf_createPasswordLessSSH | 6 +-
install/installer/traf_getHadoopNodes | 105 +++-
install/installer/traf_hortonworks_mods98 | 101 ++--
.../installer/trafodion_apache_hadoop_install | 12 +-
install/installer/trafodion_install | 12 -
install/installer/trafodion_uninstaller | 10 +-
39 files changed, 2408 insertions(+), 650 deletions(-)
----------------------------------------------------------------------
[03/14] incubator-trafodion git commit: Backup checkin. The basic
edit of the guide has been done. Need to change it to refer to trafci
commands to complete.
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6f5d4cc4/docs/spj_guide/src/asciidoc/_chapters/sample_database.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/sample_database.adoc b/docs/spj_guide/src/asciidoc/_chapters/sample_database.adoc
index 6ee790c..db1fd42 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/sample_database.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/sample_database.adoc
@@ -26,791 +26,159 @@
This appendix presents the Sample Database schemas and tables on which
the SPJs in this manual operate:
-* link:#_bookmark338["PERSNL Schema" (page 103)]
-** link:#_bookmark340["JOB Table" (page 103)]
-** link:#_bookmark342["EMPLOYEE Table" (page 104)]
-** link:#_bookmark344["DEPT Table" (page 106)]
-** link:#_bookmark346["PROJECT Table" (page 107)]
-* link:#_bookmark348["SALES Schema" (page 110)]
-** link:#_bookmark350["CUSTOMER Table" (page 110)]
-** link:#_bookmark352["ORDERS Table" (page 111)]
-** link:#_bookmark354["ODETAIL Table" (page 112)]
-** link:#_bookmark356["PARTS Table" (page 114)]
-* link:#_bookmark358["INVENT Schema" (page 115)]
-** link:#_bookmark360["SUPPLIER Table" (page 115)]
-** link:#_bookmark362["PARTSUPP Table" (page 116)]
-** link:#_bookmark364["PARTLOC Table" (page 119)]
+* <<persnl-schema, PERSNL Schema>>
+** <<job-table, JOB Table>>
+** <<employee-table, EMPLOYEE Table>>
+** <<dept-table, DEPT Table>>
+** <<project-table, PROJECT Table>>
+* <<sales-schema, SALES Schema>>
+** <<customer-table, CUSTOMER Table>>
+** <<orders-table, ORDERS Table>>
+** <<odetail-table, ODETAIL Table>>
+** <<parts-table, PARTS Table>>
+* <<invent-schema, INVENT Schema>>
+** <<supplier-table, SUPPLIER Table>>
+** <<partsupp-table, PARTSUPP Table>>
+** <<partloc-table, PARTLOC Table>>
+
+Click on the link for the schema or table name to download the definition file.
[[persnl-schema]]
== PERSNL Schema
-The PERSNL schema stores employee data.
+The link:resources/source/persnl_schema.sql[`PERSNL` schema] stores employee data.
-```
-CREATE SCHEMA DEMO.PERSNL ;
-SET SCHEMA DEMO.PERSNL ;
-```
+[source, sql]
+----
+include::{sourcedir}/persnl_schema.sql[PERSNL Schema Definition File]
+----
[[job-table]]
=== JOB Table
-```
-CREATE TABLE demo.persnl.job
-( jobcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, jobdesc VARCHAR (18) DEFAULT ' ' NOT NULL
-, PRIMARY KEY (jobcode)
-) ;
-
-INSERT INTO demo.persnl.job VALUES
- ( 100, 'MANAGER' )
-, ( 200, 'PRODUCTION SUPV' )
-, ( 250, 'ASSEMBLER' )
-, ( 300, 'SALESREP' )
-, ( 400, 'SYSTEM ANALYST' )
-, ( 420, 'ENGINEER' )
-, ( 450, 'PROGRAMMER' )
-, ( 500, 'ACCOUNTANT' )
-, ( 600, 'ADMINISTRATOR' )
-, ( 900, 'SECRETARY' )
-;
-
-UPDATE STATISTICS FOR TABLE demo.persnl.job ON EVERY COLUMN;
-```
+The link:resources/source/persnl_job_table.sql[`JOB` table] maps job codes to job descriptions.
+
+[source, sql]
+----
+include::{sourcedir}/persnl_job_table.sql[PERSNL JOB Table Definition File]
+----
[[employee-table]]
=== EMPLOYEE Table
-```
-CREATE TABLE demo.persnl.employee
-( empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, first_name CHARACTER (15) DEFAULT ' ' NOT NULL
-, last_name CHARACTER (20) DEFAULT ' ' NOT NULL
-, deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, jobcode NUMERIC (4) UNSIGNED DEFAULT NULL
-, salary NUMERIC (8, 2) UNSIGNED DEFAULT NULL
-, PRIMARY KEY (empnum)
-);
-
-ALTER TABLE demo.persnl.employee
- ADD CONSTRAINT empnum_constrnt CHECK (empnum BETWEEN 0001 AND 9999)
- ;
-
-CREATE INDEX xempname ON employee
-( last_name
-, first_name
-) ;
-
-CREATE INDEX xempdept ON employee
-( deptnum
-) ;
-
-CREATE VIEW demo.persnl.emplist AS
-SELECT
- empnum
-, first_name
-, last_name
-, deptnum
-, jobcode
-FROM employee
-;
-
-INSERT INTO demo.persnl.employee VALUES
- ( 1, 'ROGER', 'GREEN', 9000, 100, 175500.00 )
-, ( 23, 'JERRY', 'HOWARD', 1000, 100, 137000.10 )
-, ( 29, 'JANE', 'RAYMOND', 3000, 100, 136000.00 )
-, ( 32, 'THOMAS', 'RUDLOFF', 2000, 100, 138000.40 )
-, ( 39, 'KLAUS ', 'SAFFERT', 3200, 100, 75000.00 )
-, ( 43, 'PAUL', 'WINTER', 3100, 100, 90000.00 )
-, ( 65, 'RACHEL', 'MCKAY', 4000, 100, 118000.00 )
-, ( 72, 'GLENN', 'THOMAS', 3300, 100, 80000.00 )
-, ( 75, 'TIM', 'WALKER', 3000, 300, 32000.00 )
-, ( 87, 'ERIC', 'BROWN', 4000, 400, 89000.00 )
-, ( 89, 'PETER', 'SMITH', 3300, 300, 37000.40 )
-, ( 93, 'DONALD', 'TAYLOR', 3100, 300, 33000.00 )
-, ( 104, 'DAVID', 'STRAND', 4000, 400, 69000.00 )
-, ( 109, 'STEVE', 'COOK', 4000, 400, 68000.00 )
-, ( 111, 'SHERRIE', 'WONG', 3500, 100, 70000.00 )
-, ( 178, 'JOHN', 'CHOU', 3500, 900, 28000.00 )
-, ( 180, 'MANFRED', 'CONRAD', 4000, 450, 32000.00 )
-, ( 201, 'JIM', 'HERMAN', 3000, 300, 19000.00 )
-, ( 202, 'LARRY', 'CLARK', 1000, 500, 25000.75 )
-, ( 203, 'KATHRYN', 'HALL', 4000, 400, 96000.00 )
-, ( 205, 'GINNY', 'FOSTER', 3300, 900, 30000.00 )
-, ( 206, 'DAVE', 'FISHER', 3200, 900, 25000.00 )
-, ( 207, 'MARK', 'FOLEY', 4000, 420, 33000.00 )
-, ( 208, 'SUE', 'CRAMER', 1000, 900, 19000.00 )
-, ( 209, 'SUSAN', 'CHAPMAN', 1500, 900, 17000.00 )
-, ( 210, 'RICHARD', 'BARTON', 1000, 500, 29000.00 )
-, ( 211, 'JIMMY', 'SCHNEIDER', 1500, 600, 26000.00 )
-, ( 212, 'JONATHAN', 'MITCHELL', 1500, 600, 32000.00 )
-, ( 213, 'ROBERT', 'WHITE', 1500, 100, 90000.00 )
-, ( 214, 'JULIA', 'KELLY', 1000, 500, 50000.00 )
-, ( 215, 'WALTER', 'LANCASTER', 4000, 450, 33000.50 )
-, ( 216, 'JOHN', 'JONES', 4000, 450, 40000.00 )
-, ( 217, 'MARLENE', 'BONNY', 4000, 900, 24000.90 )
-, ( 218, 'GEORGE', 'FRENCHMAN', 4000, 420, 36000.00 )
-, ( 219, 'DAVID', 'TERRY', 2000, 250, 27000.12 )
-, ( 220, 'JOHN', 'HUGHES', 3200, 300, 33000.10 )
-, ( 221, 'OTTO', 'SCHNABL', 3200, 300, 33000.00 )
-, ( 222, 'MARTIN', 'SCHAEFFER', 3200, 300, 31000.00 )
-, ( 223, 'HERBERT', 'KARAJAN', 3200, 300, 29000.00 )
-, ( 224, 'MARIA', 'JOSEF', 4000, 420, 18000.10 )
-, ( 225, 'KARL', 'HELMSTED', 4000, 450, 32000.00 )
-, ( 226, 'HEIDI', 'WEIGL', 3200, 300, 22000.00 )
-, ( 227, 'XAVIER', 'SEDLEMEYER', 3300, 300, 30000.00 )
-, ( 228, 'PETE', 'WELLINGTON', 3100, 300, 32000.20 )
-, ( 229, 'GEORGE', 'STRICKER', 3100, 300, 32222.00 )
-, ( 230, 'ROCKY', 'LEWIS', 2000, 200, 24000.00 )
-, ( 231, 'HERB', 'ALBERT', 3300, 300, 33000.00 )
-, ( 232, 'THOMAS', 'SPINNER', 4000, 450, 45000.00 )
-, ( 233, 'TED', 'MCDONALD', 2000, 250, 29000.00 )
-, ( 234, 'MARY', 'MILLER', 2500, 100, 56000.00 )
-, ( 235, 'MIRIAM', 'KING', 2500, 900, 18000.00 )
-, ( 321, 'BILL', 'WINN', 2000, 900, 32000.00 )
-, ( 337, 'DINAH', 'CLARK', 9000, 900, 37000.00 )
-, ( 343, 'ALAN', 'TERRY', 3000, 900, 39500.00 )
-, ( 557, 'BEN', 'HENDERSON', 4000, 400, 65000.00 )
-, ( 568, 'JESSICA', 'CRINER', 3500, 300, 39500.00 )
-, ( 990, 'THOMAS', 'STIBBS', 3500, NULL, NULL )
-, ( 991, 'WAYNE', 'O''NEIL', 3500, NULL, NULL )
-, ( 992, 'BARRY', 'KINNEY', 3500, NULL, NULL )
-, ( 993, 'PAUL', 'BUSKETT', 3100, NULL, NULL )
-, ( 994, 'EMMY', 'BUSKETT', 3100, NULL, NULL )
-, ( 995, 'WALT', 'FARLEY', 3100, NULL, NULL )
-;
-
-UPDATE STATISTICS FOR TABLE demo.persnl.employee ON EVERY COLUMN ;
-```
+The link:resources/source/persnl_employee_table.sql[`EMPLOYEE` table] maps records employee information.
+
+[source, sql]
+----
+include::{sourcedir}/persnl_employee_table.sql[PERSNL EMPLOYEE Table Definition File]
+----
[[dept-table]]
=== DEPT Table
-```
-CREATE TABLE demo.persnl.dept
-( deptnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, deptname CHARACTER (12) NO DEFAULT NOT NULL
-, manager NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, rptdept NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
-, location VARCHAR (18) DEFAULT ' ' NOT NULL
-, PRIMARY KEY (deptnum)
-) ;
-
-CREATE INDEX xdeptmgr ON dept
-( manager
-) ;
-
-CREATE INDEX xdeptrpt ON dept
-( rptdept
-) ;
-
-ALTER TABLE demo.persnl.dept
- ADD CONSTRAINT mgrnum_constrnt
- CHECK (manager BETWEEN 0000 AND 9999)
- ;
-
-ALTER TABLE demo.persnl.dept
-
-ADD CONSTRAINT deptnum_constrnt
- CHECK ( deptnum IN
- ( 1000
- , 1500
- , 2000
- , 2500
- , 3000
- , 3100
- , 3200
- , 3300
- , 3500
- , 4000
- , 4100
- , 9000
- )
- ) ;
-
-CREATE VIEW demo.persnl.mgrlist
-( first_name
-, last_name
-, department
-)
-AS SELECT
- first_name
-, last_name
-, deptname
-FROM dept, employee
-WHERE dept.manager = employee.empnum
-;
-
-INSERT INTO demo.persnl.dept VALUES
- ( 1000, 'FINANCE', 23, 9000, 'CHICAGO' )
-, ( 1500, 'PERSONNEL', 213, 1000, 'CHICAGO' )
-, ( 2000, 'INVENTORY', 32, 9000, 'LOS ANGELES' )
-, ( 2500, 'SHIPPING', 234, 2000, 'PHOENIX' )
-, ( 3000, 'MARKETING', 29, 9000, 'NEW YORK' )
-, ( 3100, 'CANADA SALES', 43, 3000, 'TORONTO' )
-, ( 3200, 'GERMNY SALES', 39, 3000, 'FRANKFURT' )
-, ( 3300, 'ENGLND SALES', 72, 3000, 'LONDON' )
-, ( 3500, 'ASIA SALES', 111, 3000, 'HONG KONG' )
-, ( 4000, 'RESEARCH', 65, 9000, 'NEW YORK' )
-, ( 4100, 'PLANNING', 87, 4000, 'NEW YORK' )
-, ( 9000, 'xxCORPORATE', 1, 9000, 'CHICAGO' )
-;
-
-UPDATE STATISTICS FOR TABLE demo.persnl.dept ON EVERY COLUMN ;
-```
+The link:resources/source/persnl_dept_table.sql[`DEPT` table] maps records department information.
+
+[source, sql]
+----
+include::{sourcedir}/persnl_dept_table.sql[PERSNL DEPT Table Definition File]
+----
[[project-table]]
=== PROJECT Table
-```
-CREATE TABLE demo.persnl.project
-( projcode NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, empnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, projdesc VARCHAR (18) DEFAULT ' ' NOT NULL
-, start_date DATE DEFAULT DATE '2011-07-01' NOT NULL
-, ship_timestamp TIMESTAMP DEFAULT TIMESTAMP '2011-08-01:12:00:00.000000' NOT NULL
-, est_complete INTERVAL DAY DEFAULT INTERVAL '30' DAY NOT NULL
-, PRIMARY KEY (projcode, empnum)
-) ;
-
-INSERT INTO demo.persnl.project
-VALUES
- ( 1000, 213, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
-, ( 1000, 211, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
-, ( 1000, 23, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
-, ( 1000, 1, 'SALT LAKE CITY', DATE '2011-04-10', TIMESTAMP '2011-04-21:08:15:00.00', INTERVAL '15' DAY )
-, ( 2000, 227, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
-, ( 2000, 109, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
-, ( 2000, 215, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
-, ( 2000, 65, 'ROSS PRODUCTS', DATE '2011-06-10', TIMESTAMP '2011-07-21:08:30:00.0000', INTERVAL '30' DAY )
-, ( 2500, 65, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
-, ( 2500, 207, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
-, ( 2500, 232, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
-, ( 2500, 180, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
-, ( 2500, 93, 'MONTANA TOOLS', DATE '2011-10-10', TIMESTAMP '2011-12-21:09:00:00.0000', INTERVAL '60' DAY )
-, ( 3000, 65, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
-, ( 3000, 221, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
-, ( 3000, 226, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
-, ( 3000, 224, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
-, ( 3000, 225, 'AHAUS TOOL/SUPPLY', DATE '2011-08-21', TIMESTAMP '2011-10-21:08:10:00.0000', INTERVAL '60' DAY )
-, ( 4000, 75, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 4000, 29, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 4000, 231, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 4000, 228, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 4000, 223, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 4000, 568, 'THE WORKS', DATE '2011-09-21', TIMESTAMP '2011-10-21:10:15:00.0000', INTERVAL '30' DAY )
-, ( 5000, 65, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-, ( 5000, 568, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-, ( 5000, 557, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-, ( 5000, 216, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-, ( 5000, 203, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-, ( 5000, 218, 'ASIA PROJECT', DATE '2011-09-28', TIMESTAMP '2011-10-28:09:25:01.1111', INTERVAL '30' DAY )
-;
-
-UPDATE STATISTICS FOR TABLE demo.persnl.project ON EVERY COLUMN ;
-```
+The link:resources/source/persnl_project_table.sql[`PROJECT` table] maps records information about projects.
+
+[source, sql]
+----
+include::{sourcedir}/persnl_project_table.sql[PERSNL DEPT Table Definition File]
+----
[[sales-schema]]
== SALES Schema
-The SALES schema stores customer and sales data.
+The link:resources/source/sales_schema.sql[`SALES` schema] stores customer and sales data.
-```
-CREATE SCHEMA DEMO.SALES ;
-SET SCHEMA DEMO.SALES ;
-```
+[source, sql]
+----
+include::{sourcedir}/sales_schema.sql[SALES Schema Definition File]
+----
[[customer-table]]
=== CUSTOMER Table
-```
-CREATE TABLE demo.sales.customer
-( custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, custname CHARACTER (18) NO DEFAULT NOT NULL
-, street CHARACTER (22) NO DEFAULT NOT NULL
-, city CHARACTER (14) NO DEFAULT NOT NULL
-, state CHARACTER (12) DEFAULT ' ' NOT NULL
-, postcode CHARACTER (10) NO DEFAULT NOT NULL
-, credit CHARACTER (2) DEFAULT 'C1' NOT NULL
-, PRIMARY KEY (custnum)
-) ;
-
-INSERT INTO demo.sales.customer VALUES
- ( 21, 'CENTRAL UNIVERSITY', 'UNIVERSITY WAY', 'PHILADELPHIA', 'PENNSYLVANIA', '19104', 'A1' )
-, ( 123, 'BROWN MEDICAL CO', '100 CALIFORNIA STREET', 'SAN FRANCISCO', 'CALIFORNIA', '94944', 'C2' )
-, ( 143, 'STEVENS SUPPLY', '2020 HARRIS STREET', 'DENVER', 'COLORADO', '80734', 'A2' )
-, ( 324, 'PREMIER INSURANCE', '3300 WARBASH', 'LUBBOCK', 'TEXAS', '76308', 'A1' )
-, ( 543, 'FRESNO STATE BANK', '2300 BROWN BLVD', 'FRESNO', 'CALIFORNIA', '93921', 'B3' )
-, ( 926, 'METALL-AG.', '12 WAGNERRING', 'FRANKFURT', 'WEST GERMANY', '34', 'D4' )
-, ( 1234, 'DATASPEED', '300 SAN GABRIEL WAY', 'NEW YORK', 'NEW YORK', '10014', 'C1' )
-, ( 3210, 'BESTFOOD MARKETS', '3333 PHELPS STREET', 'LINCOLN', 'NEBRASKA', '68134', 'A4' )
-, ( 3333, 'NATIONAL UTILITIES', '6500 TRANS-CANADIENNE', 'QUEBEC', 'CANADA', 'H4T 1X4', 'A1' )
-, ( 5635, 'ROYAL CHEMICALS', '45 NEW BROAD STREET', 'LONDON', 'ENGLAND', 'EC2M 1NH', 'B2' )
-, ( 7654, 'MOTOR DISTRIBUTING', '2345 FIRST STREET', 'CHICAGO', 'ILLINOIS', '60610', 'E4' )
-, ( 7777, 'SLEEPWELL HOTELS', '9000 PETERS AVENUE', 'DALLAS', 'TEXAS', '75244', 'B1' )
-, ( 9000, 'BUNKNOUGHT INN', '4738 RALPH STREET', 'BAYONNE', 'NEW JERSEY', '09520', 'C1' )
-, ( 9010, 'HOTEL OREGON', '333 PORTLAND AVE.', 'MEDFORD', 'OREGON', '97444', 'C2' )
-, ( 9033, 'ART SUPPLIES, INC.', '22 SWEET ST.', 'PITTSBURGH', 'PENNA.', '08333', 'C3' )
-;
-
-UPDATE STATISTICS FOR TABLE demo.sales.customer ON EVERY COLUMN;
-```
+The link:resources/source/sales_customer_table.sql[`CUSTOMER` table] maps records information about customers.
+
+[source, sql]
+----
+include::{sourcedir}/sales_customer_table.sql[SALES CUSTOMER Table Definition File]
+----
[[orders-table]]
=== ORDERS Table
-```
-CREATE TABLE demo.sales.orders
-( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
-, order_date DATE DEFAULT DATE '2011-07-01' NOT NULL
-, deliv_date DATE DEFAULT DATE '2011-08-01' NOT NULL
-, salesrep NUMERIC (4) UNSIGNED DEFAULT 0 NOT NULL
-, custnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, PRIMARY KEY (ordernum)
-) ;
-
-ALTER TABLE demo.sales.orders
- ADD CONSTRAINT demo.sales.date_constrnt CHECK (deliv_date >= order_date)
- ;
-
-CREATE INDEX xordrep ON orders
-( salesrep
-) ;
-
-CREATE INDEX xordcus ON orders
-( custnum
-) ;
-
-CREATE VIEW demo.sales.ordrep AS SELECT
- empnum
-, last_name
-, ordernum
-, o.custnum
-FROM
- demo.persnl.employee e
-, demo.sales.orders o
-, demo.sales.customer c
-WHERE e.empnum = o.salesrep
- AND o.custnum = C.custnum
-;
-
-CREATE INDEX xcustnam ON customer
-(
-custname
-) ;
-
-CREATE VIEW demo.sales.custlist AS SELECT
- custnum
-, custname
-, street
-, city
-, state
-, postcode
-FROM demo.sales.customer
-;
-
-INSERT INTO demo.sales.orders VALUES
- ( 100210, DATE '2011-04-10', DATE '2011-04-10', 220, 1234 )
-, ( 100250, DATE '2011-01-23', DATE '2011-06-15', 220, 7777 )
-, ( 101220, DATE '2011-07-21', DATE '2011-12-15', 221, 5635 )
-, ( 200300, DATE '2011-02-06', DATE '2011-07-01', 222, 926 )
-, ( 200320, DATE '2011-02-17', DATE '2011-07-20', 223, 21 )
-, ( 200490, DATE '2011-03-19', DATE '2011-11-01', 226, 123 )
-, ( 300350, DATE '2011-03-03', DATE '2011-08-10', 231, 543 )
-, ( 300380, DATE '2011-03-19', DATE '2011-08-20', 226, 123 )
-, ( 400410, DATE '2011-03-27', DATE '2011-09-01', 227, 7654 )
-, ( 500450, DATE '2011-04-20', DATE '2011-09-15', 220, 324 )
-, ( 600480, DATE '2011-05-12', DATE '2011-10-10', 226, 3333 )
-, ( 700510, DATE '2011-06-01', DATE '2011-10-20', 229, 143 )
-, ( 800660, DATE '2011-10-09', DATE '2011-11-01', 568, 3210 )
-;
-
-UPDATE STATISTICS FOR TABLE demo.sales.orders ON EVERY COLUMN;
-```
+The link:resources/source/sales_orders_table.sql[`ORDERS` table] maps records information about sales orders.
+
+[source, sql]
+----
+include::{sourcedir}/sales_orders_table.sql[SALES ORDERS Table Definition File]
+----
[[odetail-table]]
=== ODETAIL Table
-```
-CREATE TABLE demo.sales.odetail
-( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL
-, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, unit_price NUMERIC (8, 2) NO DEFAULT NOT NULL
-, qty_ordered NUMERIC (5) UNSIGNED NO DEFAULT NOT NULL
-, PRIMARY KEY (ordernum,partnum)
-) ;
-
-INSERT INTO demo.sales.odetail VALUES
- ( 100210, 244, 3500.00, 3 )
-, ( 100210,2001, 1100.00, 3 )
-, ( 100210,2403, 620.00, 6 )
-, ( 100210,5100, 150.00, 10 )
-, ( 100250, 244, 3500.00, 4 )
-, ( 100250,5103, 400.00, 10 )
-, ( 100250,6301, 245.00, 15 )
-, ( 100250,6500, 95.00, 10 )
-, ( 101220, 255, 3900.00, 10 )
-, ( 101220,5103, 400.00, 3 )
-, ( 101220,7102, 275.00, 7 )
-, ( 101220,7301, 425.00, 8 )
-, ( 200300, 244, 3500.00, 8 )
-, ( 200300,2001, 1000.00, 10 )
-, ( 200300,2002, 1400.00, 10 )
-, ( 200320,5504, 165.00, 5 )
-, ( 200320,6201, 195.00, 16 )
-, ( 200320,6301, 245.00, 6 )
-, ( 200320,6400, 540.00, 7 )
-, ( 200490,3210, 715.00, 1 )
-, ( 200490,5505, 350.00, 1 )
-, ( 300350, 244, 2800.00, 20 )
-, ( 300350,5100, 150.00, 5 )
-, ( 300350,5110, 525.00, 12 )
-, ( 300350,6301, 245.00, 5 )
-, ( 300350,6400, 550.00, 5 )
-, ( 300380, 244, 3000.00, 6 )
-, ( 300380,2402, 320.00, 12 )
-, ( 300380,2405, 760.00, 8 )
-, ( 400410, 212, 2450.00, 12 )
-, ( 400410, 255, 3800.00, 12 )
-, ( 400410,2001, 1000.00, 36 )
-, ( 400410,6301, 240.00, 48 )
-, ( 400410,6400, 500.00, 70 )
-, ( 400410,7301, 415.00, 36 )
-, ( 500450, 212, 2500.00, 8 )
-, ( 500450, 255, 3900.00, 12 )
-, ( 500450,2001, 1100.00, 16 )
-, ( 500450,2002, 1500.00, 16 )
-, ( 500450,2402, 330.00, 48 )
-, ( 600480,2001, 1000.00, 60 )
-, ( 600480,2002, 1450.00, 20 )
-, ( 600480,2003, 1900.00, 40 )
-, ( 600480,3103, 4000.00, 40 )
-, ( 600480,3205, 625.00, 20 )
-, ( 600480,5100, 135.00, 60 )
-, ( 600480,5103, 390.00, 20 )
-, ( 600480,7301, 425.00, 40 )
-, ( 700410,2003, 1900.00, 65 )
-, ( 700410,2403, 650.00, 10 )
-, ( 700510, 255, 4000.00, 4 )
-, ( 700510,6500, 95.00, 8 )
-, ( 700510,7102, 275.00, 5 )
-, ( 800660, 244, 3000.00, 6 )
-, ( 800660,2001, 1000.00, 30 )
-, ( 800660,2403, 600.00, 48 )
-, ( 800660,2405, 795.00, 10 )
-, ( 800660,3201, 525.00, 6 )
-, ( 800660,3205, 600.00, 18 )
-, ( 800660,3210, 715.00, 6 )
-, ( 800660,4102, 26.00, 130 )
-, ( 800660,5100, 150.00, 12 )
-, ( 800660,5101, 200.00, 6 )
-, ( 800660,5110, 490.00, 48 )
-, ( 800660,5504, 165.00, 18 )
-, ( 800660,6201, 195.00, 6 )
-, ( 800660,6301, 235.00, 24 )
-, ( 800660,6400, 525.00, 30 )
-, ( 800660,6401, 700.00, 36 )
-, ( 800660,6500, 95.00, 22 )
-, ( 800660,7102, 275.00, 6 )
-, ( 800660,7301, 425.00, 12 )
-;
-
-UPDATE STATISTICS FOR TABLE demo.sales.odetail ON EVERY COLUMN;
-```
+The link:resources/source/sales_odetail_table.sql[`ODETAIL` table] maps records detailed information about sales orders.
+
+[source, sql]
+----
+include::{sourcedir}/sales_odetail_table.sql[SALES ODETAIL Table Definition File]
+----
[[parts-table]]
=== PARTS Table
-```
-CREATE TABLE demo.sales.parts
-( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, partdesc CHARACTER (18) NO DEFAULT NOT NULL
-, price NUMERIC (8, 2) NO DEFAULT NOT NULL
-, qty_available NUMERIC (5) DEFAULT 0 NOT NULL
-, PRIMARY KEY (partnum)
-) ;
-
-CREATE INDEX xpartdes ON parts
-( partdesc
-) ;
-
-INSERT INTO demo.sales.parts VALUES
- ( 186, '186 MegaByte Disk', 186186.86, 186 )
-, ( 212, 'PC SILVER, 20 MB', 2500.00, 3525 )
-, ( 244, 'PC GOLD, 30 MB', 3000.00, 4426 )
-, ( 255, 'PC DIAMOND, 60 MB', 4000.00, 3321 )
-, ( 2001, 'GRAPHIC PRINTER,M1', 1100.00, 2100 )
-, ( 2002, 'GRAPHIC PRINTER,M2', 1500.00, 3220 )
-, ( 2003, 'GRAPHIC PRINTER,M3', 2000.00, 2200 )
-, ( 2402, 'DAISY PRINTER,T1', 350.00, 4425 )
-, ( 2403, 'DAISY PRINTER,T2', 650.00, 3312 )
-, ( 2405, 'DAISY PRINTER, T3', 795.00, 2712 )
-, ( 3103, 'LASER PRINTER, X1', 4200.00, 3300 )
-, ( 3201, 'HARD DISK 20 MB', 525.00, 4436 )
-, ( 3205, 'HARD DISK 30 MB', 625.00, 2209 )
-, ( 3210, 'HARD DISK 40 MB', 715.00, 3314 )
-, ( 4102, 'DISKETTE HD, BOX', 28.00, 6540 )
-, ( 5100, 'MONITOR BW, TYPE 1', 150.00, 3237 )
-, ( 5101, 'MONITOR BW, TYPE 2', 200.00, 2400 )
-, ( 5103, 'MONITOR COLOR, M1', 400.00, 3328 )
-, ( 5110, 'MONITOR COLOR, M2', 525.00, 3236 )
-, ( 5504, 'MEMORY CARD, 512KB', 165.00, 2630 )
-, ( 5505, 'MEMORY CARD, 1 MB', 315.00, 3830 )
-, ( 6201, 'GRAPHIC CARD, LR', 195.00, 2306 )
-, ( 6301, 'GRAPHIC CARD, HR', 245.00, 2331 )
-, ( 6400, 'STREAMING TAPE,M20', 550.00, 1268 )
-, ( 6401, 'STREAMING TAPE,M60', 725.00, 1308 )
-, ( 6500, 'DISK CONTROLLER', 95.00, 2532 )
-, ( 6603, 'PRINTER CONTROLLER', 45.00, 430 )
-, ( 7102, 'SMART MODEM, 1200', 275.00, 2200 )
-, ( 7301, 'SMART MODEM, 2400', 425.00, 2332 )
-;
-
-UPDATE STATISTICS FOR TABLE demo.sales.parts ON EVERY COLUMN ;
-```
+The link:resources/source/sales_parts_table.sql[`PARTS` table] maps records information about parts.
+
+[source, sql]
+----
+include::{sourcedir}/sales_parts_table.sql[SALES PARTS Table Definition File]
+----
[[invent-schema]]
=== INVENT Schema
-The INVENT schema stored inventory data.
+The link:resources/source/invent_schema.sql[`INVENT` schema] stores inventory data.
-```
-CREATE SCHEMA DEMO.INVENT ;
-SET SCHEMA DEMO.INVENT ;
-```
+[source, sql]
+----
+include::{sourcedir}/invent_schema.sql[INVENT Schema Definition File]
+----
[[supplier-table]]
=== SUPPLIER Table
-```
-CREATE TABLE demo.invent.supplier
-( suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, suppname CHARACTER (18) NO DEFAULT NOT NULL
-, street CHARACTER (22) NO DEFAULT NOT NULL
-, city CHARACTER (14) NO DEFAULT NOT NULL
-, state CHARACTER (12) NO DEFAULT NOT NULL
-, postcode CHARACTER (10) NO DEFAULT NOT NULL
-, PRIMARY KEY (suppnum)
-) ;
-
-CREATE INDEX xsuppnam ON supplier
-( suppname
-) ;
-
-INSERT INTO demo.invent.supplier VALUES
- ( 1, 'NEW COMPUTERS INC', '1800 KING ST.', 'SAN FRANCISCO', 'CALIFORNIA', '94112' )
-, ( 2, 'DATA TERMINAL INC', '2000 BAKER STREET', 'LAS VEGAS', 'NEVADA', '66134' )
-, ( 3, 'HIGH DENSITY INC', '7600 EMERSON', 'NEW YORK', 'NEW YORK', '10230' )
-, ( 6, 'MAGNETICS INC', '1000 INDUSTRY DRIVE', 'LEXINGTON', 'MASS', '02159' )
-, ( 8, 'ATTRACTIVE CORP', '7777 FOUNTAIN WAY', 'CHICAGO', 'ILLINOIS', '60610' )
-, ( 10, 'LEVERAGE INC', '6000 LINCOLN LANE', 'DENVER', 'COLORADO', '80712' )
-, ( 15, 'DATADRIVE CORP', '100 MAC ARTHUR', 'DALLAS', 'TEXAS', '75244' )
-, ( 20, 'Macadam''S PC''s', '106 River Road', 'New Orleans', 'Louisiana', '67890' )
-, ( 25, 'Schroeder''s Ltd', '212 Strasse Blvd West', 'Hamburg', 'Rhode Island', '22222' )
-, ( 30, 'O''Donnell''s Drives', '729 West Palm Beach ', 'San Antonio', 'Texas', '78344' )
-, ( 35, 'Mac''Murphys PC''s', '93323 Alemeda', 'Menlo Park', 'California', '94025' )
-, ( 36, 'MAC''MURPHYS PCB''s', '93323 Alemeda Suite B', 'Menlo Park', 'California', '94025' )
-, ( 90, 'laser jets inc', '284 blue ridge way', 'levittown', 'penna.', '09520' )
-, ( 92, 'watercolors', '84 north grand avenue', 'menlo park', 'california', '94025' )
-, ( 95, 'application do''ers', '2846 yellowwood drive', 'wayland', 'mass', '02158' )
-, ( 99, 'terminals, inc.', '2 longfellow way', 'heightstown', 'nj', '08520' )
-, ( 186, '186 Disk Makers', '186 Dis Way', 'Dat Way', 'Wisconsin', '00186' )
-;
-
-UPDATE STATISTICS FOR TABLE demo.invent.supplier ON EVERY COLUMN;
-```
+The link:resources/source/invent_supplier_table.sql[`SUPPLIER` table] maps records information about suppliers.
+
+[source, sql]
+----
+include::{sourcedir}/invent_supplier_table.sql[INVENT SUPPLIER Table Definition File]
+----
[[partsupp-table]]
=== PARTSUPP Table
-```
-CREATE TABLE demo.invent.partsupp
-( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, partcost NUMERIC (8, 2) NO DEFAULT NOT NULL
-, qty_received NUMERIC (5) UNSIGNED DEFAULT 0 NOT NULL
-, PRIMARY KEY (partnum,suppnum)
-) ;
-
-CREATE INDEX XSUPORD ON partsupp
-( suppnum
-) ;
-
-CREATE VIEW demo.invent.view207
-( partnumber
-, partdescrpt
-, suppnumber
-, supplrname
-, partprice
-, qtyreceived
-)
-AS SELECT
- x.partnum
-, partdesc
-, x.suppnum
-, suppname
-, partcost
-, qty_received
-FROM
- demo.invent.partsupp x
-, demo.sales.parts p
-, demo.invent.supplier s
-WHERE x.partnum = p.partnum
- AND x.suppnum = s.suppnum
-;
-
-CREATE VIEW demo.invent.view207n
-( partnumber
-, partdescrpt
-, suppnumber
-, supplrname
-, partprice
-, qtyreceived
-)
-AS SELECT
- x.partnum
-, p.partdesc
-, s.suppnum
-, s.suppname
-, x.partcost
-, x.qty_received
-FROM demo.invent.supplier s
-LEFT JOIN demo.invent.partsupp x ON s.suppnum = x.suppnum
-LEFT JOIN demo.sales.parts p ON x.partnum = p.partnum
-;
-
-CREATE VIEW demo.invent.viewcust
-( custnumber
-, cusname
-, ordernum
-)
-AS SELECT
- c.custnum
-, c.custname
-, o.ordernum
-FROM demo.sales.customer c
-LEFT JOIN demo.sales.orders o ON c.custnum = o.custnum
-;
-
-CREATE VIEW demo.invent.viewcs AS SELECT
- custname
-FROM demo.sales.customer
-UNION SELECT
- suppname
-FROM demo.invent.supplier ;
-
-INSERT INTO demo.invent.partsupp VALUES
- ( 212, 1, 2000.00, 20 )
-, ( 212, 3, 1900.00, 35 )
-, ( 244, 1, 2400.00, 50 )
-, ( 244, 2, 2200.00, 66 )
-, ( 255, 1, 3300.00, 35 )
-, ( 255, 3, 3000.00, 46 )
-, ( 2001, 1, 700.00, 100 )
-, ( 2001, 2, 750.00, 55 )
-, ( 2002, 1, 1000.00, 120 )
-, ( 2002, 6, 1100.00, 20 )
-, ( 2003, 1, 1300.00, 100 )
-, ( 2003, 2, 1400.00, 50 )
-, ( 2003, 10, 1450.00, 50 )
-, ( 2402, 1, 200.00, 35 )
-, ( 2403, 1, 300.00, 200 )
-, ( 2405, 1, 500.00, 40 )
-, ( 2405, 6, 450.00, 50 )
-, ( 3103, 1, 3200.00, 200 )
-, ( 3103, 15, 3300.00, 100 )
-, ( 3201, 1, 380.00, 36 )
-, ( 3205, 1, 425.00, 150 )
-, ( 3210, 6, 470.00, 10 )
-, ( 3210, 15, 450.00, 25 )
-, ( 4102, 6, 20.00, 115 )
-, ( 4102, 8, 19.00, 140 )
-, ( 4102, 15, 21.00, 30 )
-, ( 5100, 6, 100.00, 50 )
-, ( 5100, 8, 105.00, 40 )
-, ( 5100, 15, 95.00, 60 )
-, ( 5101, 8, 135.00, 33 )
-, ( 5101, 15, 125.00, 43 )
-, ( 5103, 8, 265.00, 20 )
-, ( 5103, 15, 250.00, 58 )
-, ( 5110, 1, 335.00, 100 )
-, ( 5110, 2, 350.00, 36 )
-, ( 5504, 2, 85.00, 10 )
-, ( 5504, 6, 75.00, 10 )
-, ( 5504, 15, 78.00, 10 )
-, ( 5505, 15, 200.00, 100 )
-, ( 6201, 1, 100.00, 110 )
-, ( 6301, 1, 150.00, 230 )
-, ( 6400, 1, 390.00, 50 )
-, ( 6401, 2, 500.00, 20 )
-, ( 6401, 3, 480.00, 38 )
-, ( 6500, 2, 60.00, 140 )
-, ( 6500, 3, 65.00, 32 )
-, ( 6603, 2, 25.00, 150 )
-, ( 7102, 10, 165.00, 100 )
-, ( 7301, 1, 300.00, 32 )
-;
-
-UPDATE STATISTICS FOR TABLE demo.invent.partsupp ON EVERY COLUMN;
-```
+The link:resources/source/invent_partsupp_table.sql[`PARTSUPP` table] maps parts to suppliers.
+
+[source, sql]
+----
+include::{sourcedir}/invent_partsupp_table.sql[INVENT PARTSUPP Table Definition File]
+----
[[partloc-table]]
=== PARTLOC Table
-```
-CREATE TABLE demo.invent.partloc
-( loc_code CHARACTER (3) NO DEFAULT NOT NULL
-, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
-, qty_on_hand NUMERIC (7) DEFAULT 0 NOT NULL
-, PRIMARY KEY (loc_code,partnum)
-) ;
-
-INSERT INTO demo.invent.partloc VALUES
- ('A10', 2001, 800 )
-, ('A21', 255, 21 )
-, ('A34', 6201, 0 )
-, ('A35', 6301, 0 )
-, ('A36', 6400, 34 )
-, ('A66', 6603, 300 )
-, ('A67', 6401, 454 )
-, ('A78', 244, 43 )
-, ('A78', 5505, 100 )
-, ('A87', 212, 18 )
-, ('A88', 2403, 735 )
-, ('A88', 5504, 30 )
-, ('A94', 3205, 200 )
-, ('A98', 5110, 510 )
-, ('G11', 2002, 20 )
-, ('G34', 6201, 106 )
-, ('G35', 6301, 331 )
-, ('G36', 6400, 1034 )
-, ('G43', 5100, 77 )
-, ('G45', 4102, 69 )
-, ('G65', 3201, 36 )
-, ('G68', 6500, 1132 )
-, ('G76', 2405, 42 )
-, ('G76', 7301, 32 )
-, ('G78', 5505, 0 )
-, ('G87', 212, 20 )
-, ('G87', 3103, 0 )
-, ('G87', 3210, 44 )
-, ('G87', 2402, 0 )
-, ('G88', 2403, 32 )
-, ('G88', 5504, 0 )
-, ('G89', 5101, 86 )
-, ('G94', 3205, 59 )
-, ('G98', 5103, 28 )
-, ('G98', 5110, 136 )
-, ('P10', 2001, 0 )
-, ('P12', 2002, 200 )
-, ('P12', 2003, 0 )
-, ('P15', 2003, 200 )
-, ('P66', 6603, 40 )
-, ('P67', 6401, 54 )
-, ('P68', 6500, 0 )
-, ('P76', 7102, 200 )
-, ('P78', 244, 23 )
-, ('P87', 3103, 300 )
-;
-
-UPDATE STATISTICS FOR TABLE demo.invent.partloc ON EVERY COLUMN ;
-```
+The link:resources/source/invent_partloc_table.sql[`PARTLOC` table] records number of parts to on hand.
+
+[source, sql]
+----
+include::{sourcedir}/invent_partloc_table.sql[INVENT PARTLOC Table Definition File]
+----
[08/14] incubator-trafodion git commit: Backup checkin
Posted by db...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
index 758b156..1383718 100644
--- a/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
+++ b/docs/spj_guide/src/asciidoc/_chapters/sample_spjs.adoc
@@ -85,36 +85,50 @@ include::{sourcedir}/lowerPrice.java[lowerPrice procedure source code]
[[creating-the-procedure-lowerprice]]
==== Creating the Procedure: LOWERPRICE
-Before creating the procedure, use HPDM to create a library named `SALES`
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
Trafodion platform for that library. For more information, see
<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-3]]
-.HPDM Create Procedure Settings: LOWERPRICE Procedure
+.Create Procedure Settings: LOWERPRICE Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `lowerprice`
-| *Code* | Library | `DEMO.SALES.SALES`
-| | Class Name | `Sales`
-| | Method Name | `lowerPrice`
-| *Parameters* | | None
-| *Attributes* | Number of dynamic results sets | `0`
-| | Access Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.lowerprice`
+| *sql-parameter* | Not applicable.
+| *external name* | `EXTERNAL NAME sales.lowerPrice`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-*NOTE*: Depending on your security requirements, you can select Definer
-instead. For more information, see
-<<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `MODIFIES SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.lowerprice( )
+ EXTERNAL NAME 'sales.lowerPrice'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ MODIFIES SQL DATA
+ ;
+----
+
[[calling-the-procedure-lowerprice]]
==== Calling the Procedure: LOWERPRICE
@@ -126,7 +140,7 @@ To invoke the LOWERPRICE procedure in trafci:
[source, sql]
----
-SQL> CALL demo.sales.lowerprice() ;
+SQL> CALL trafodion.sales.lowerprice() ;
--- SQL operation complete.
----
@@ -142,8 +156,8 @@ FROM
( SELECT p.partnum
, SUM(qty_ordered) AS qtyOrdered
, p.price
- FROM demo.sales.parts p
- LEFT OUTER JOIN demo.sales.odetail o ON p.partnum = o.partnum
+ FROM trafodion.sales.parts p
+ LEFT OUTER JOIN trafodion.sales.odetail o ON p.partnum = o.partnum
GROUP BY p.partnum, p.price
) AS allparts
WHERE qtyOrdered < 51 ;
@@ -206,43 +220,53 @@ include::{sourcedir}/numDailyOrders.java[numDailyOrders procedure source code]
[[creating-the-procedure-dailyorders]]
==== Creating the Procedure: DAILYORDERS
-Before creating the procedure, use HPDM to create a library named `SALES`
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
Trafodion platform for that library. For more information, see
<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema, launch
-the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-4]]
-.HPDM Create Procedure Settings: DAILYORDERS Procedure
+.Create Procedure Settings: DAILYORDERS Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | dailyorders
-| *Code* | Library | DEMO.SALES.SALES
-| | Class Name | Sales
-| | Method Name | numDailyOrders
-3+<| *Parameters*
-| _First_ | Parameter Name | date1
-| | SQL Data Type | DATE
-| | Direction | IN
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.sql.Date`
-| _Second_ | Parameter Name | number
-| | SQL Data Type | SIGNED INTEGER
-| | Direction | OUT
-| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
-| *Attributes* | Number of dynamic result sets | 0
-| | Accesses Database | selected
-| | External security | Invoker +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.dailyorders`
+| *sql-parameter-1* | `IN date1 DATE`
+| *sql-parameter-2* | `OUT number SIGNED INTEGER`
+| *external name* | `EXTERNAL NAME sales.numDailyOrders`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select Definer
-instead. For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction required | Yes
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.dailyorders( IN date1 DATE
+ , OUT number SIGNED INTEGER
+ )
+ EXTERNAL NAME 'sales.numDailyOrders'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-dailyorders]]
==== Calling the Procedure: DAILYORDERS
@@ -254,7 +278,7 @@ To invoke the DAILYORDERS procedure in trafci:
[source, sql]
----
-SQL> CALL demo.sales.dailyorders( DATE '2011-03-19', ? ) ;
+SQL> CALL trafodion.sales.dailyorders( DATE '2011-03-19', ? ) ;
----
The DAILYORDERS procedure determines the total number of orders on a
@@ -291,43 +315,53 @@ include::{sourcedir}/numMonthlyOrders.java[numMonthlyOrders procedure source cod
[[creating-the-procedure-monthlyorders]]
==== Creating the Procedure: MONTHLYORDERS
-Before creating the procedure, use HPDM to create a library named SALES
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-5]]
-.HPDM Create Procedure Settings: MONTHLYORDERS Procedure
+.Create Procedure Settings: MONTHLYORDERS Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `monthlyorders`
-| *Code* | Library | `DEMO.SALES.SALES`
-| | Class Name | `Sales`
-| | Method Name | `numMonthlyOrders`
-3+<| *Parameters*
-| _First_ | Parameter Name | `monthnum`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| _Second_ | Parameter Name | `ordernum`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.monthlyorders`
+| *sql-parameter-1* | `IN monthnum SIGNED INTEGER`
+| *sql-parameter-2* | `OUT ordernum SIGNED INTEGER`
+| *external name* | `EXTERNAL NAME sales.numMonthlyOrders`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.monthlyorders( IN monthnum SIGNED INTEGER
+ , OUT ordernum SIGNED INTEGER
+ )
+ EXTERNAL NAME 'sales.numMonthlyOrders'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-monthlyorders]]
==== Calling the Procedure: MONTHLYORDERS
@@ -339,7 +373,7 @@ To invoke the MONTHLYORDERS procedure in trafci:
[source, sql]
----
-SQL> CALL demo.sales.monthlyorders( 3,? ) ;
+SQL> CALL trafodion.sales.monthlyorders( 3,? ) ;
----
The MONTHLYORDERS procedure determines the total number of orders during
@@ -376,56 +410,55 @@ include::{sourcedir}/totalPrice.java[totalPrice procedure source code]
[[creating-the-procedure-totalprice]]
==== Creating the Procedure: TOTALPRICE
-Before creating the procedure, use HPDM to create a library named SALES
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-6]]
-.HPDM Create Procedure Settings: TOTALPRICE Procedure
+.Create Procedure Settings: TOTALPRICE Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `totalprice`
-| *Code* | Library | `DEMO.SALES.SALES`
-| | Class Name | `Sales`
-| | Method Name | `totalPrice`
-3+<| *Parameters*
-| _First_ | Parameter Name | `qty`
-| | SQL Data Type | `SIGNED NUMERIC` +
- +
-- Precision: `18` +
-- Scale: `0`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
-| _Second_ | Parameter Name | `rate`
-| | SQL Data Type | `VARCHAR` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.totalprice`
+| *sql-parameter-1* | `IN gty NUMERIC(18)`
+| *sql-parameter-2* | `IN speed VARCHAR(10)`
+| *sql-parameter-3* | `INOUT price NUMERIC(18,2)`
+| *external name* | `EXTERNAL NAME sales.totalPrice`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-- Length: `10` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String`
-| _Third_ | Parameter Name | `price`
-| | SQL Data Type | `SIGNED NUMERIC` +
- +
-- Precision: `18` +
-- Scale: `2`
-| | Direction | `INOUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Accesses Database | `not selected`
-| | External Security | `Invoker` +
- +
-*NOTE:* External security is disabled because the stored procedure does not access the database.
-| | Transaction Required | No
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `NO SQL`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.totalprice( IN gty NUMERIC(18)
+ , IN speed VARCHAR(10)
+ , INOUT price NUMERIC(18,2)
+ )
+ EXTERNAL NAME 'sales.totalPrice'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ NO SQL
+ ;
+----
+
[[calling-the-procedure-totalprice]]
==== Calling the Procedure: TOTALPRICE
@@ -438,7 +471,7 @@ To invoke the TOTALPRICE procedure in trafci:
[source, sql]
----
SQL> SET PARAM ?p 10 ;
-SQL> CALL demo.sales.totalprice( 23, 'standard', ?p ) ;
+SQL> CALL trafodion.sales.totalprice( 23, 'standard', ?p ) ;
----
The TOTALPRICE procedure calculates the total price of a purchase and
@@ -481,59 +514,58 @@ include::{sourcedir}/partData.java[partData procedure source code]
[[creating-the-procedure-partdata]]
==== Creating the Procedure: PARTDATA
-Before creating the procedure, use HPDM to create a library named SALES
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-7]]
-.HPDM Create Procedure Settings: PARTDATA Procedure
+.Create Procedure Settings: PARTDATA Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `partdata`
-| *Code* | Library | `DEMO.SALES.SALES`
-| | Class Name | `Sales`
-| | Method Name | `partData`
-3+<| *Parameters*
-| _First_ | Parameter Name | `partnum`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| _Second_ | Parameter Name | `partdesc`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `18` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| _Third_ | Parameter Name | `price`
-| | SQL Data Type | `SIGNED NUMERIC` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.partdata`
+| *sql-parameter-1* | `IN partnum SIGNED INTEGER`
+| *sql-parameter-2* | `OUT partdesc CHARACTER(18)`
+| *sql-parameter-3* | `INOUT price NUMERIC(18,2)`
+| *sql-parameter-4* | `OUT qty_available SIGNED INTEGER`
+| *external name* | `EXTERNAL NAME sales.partData`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-- Precision: `8` +
-- Scale: `2`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
-| _Fourth_ | Parameter Name | `qty_available`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int[]`
-| *Attributes* | Number of dynamic result sets | `4`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
- +
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 4`
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.partdata( IN partnum SIGNED INTEGER
+ , OUT partdesc CHARACTER(18)
+ , INOUT price NUMERIC(18,2)
+ , OUT qty_available SIGNED INTEGER
+ )
+ EXTERNAL NAME 'sales.partData'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ DYNAMIC RESULT SETS 4
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-partdata]]
==== Calling the Procedure: PARTDATA
@@ -545,7 +577,7 @@ To invoke the PARTDATA procedure in trafci:
[source, sql]
----
-SQL> CALL demo.sales.partdata(212,?,?,?) ;
+SQL> CALL trafodion.sales.partdata(212,?,?,?) ;
----
The PARTDATA procedure returns this information about part 212:
@@ -616,47 +648,54 @@ include::{sourcedir}/orderSummary.java[orderSummary procedure source code]
[[creating-the-procedure-ordersummary]]
==== Creating the Procedure: ORDERSUMMARY
-Before creating the procedure, use HPDM to create a library named SALES
-in the `DEMO.SALES` schema and select the `Sales.jar` file to upload to the
-Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `SALES`
+in the `TRAFODION.SALES` schema and select the `Sales.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the SALES schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-8]]
-.HPDM Create Procedure Settings: ORDERSUMMARY Procedure
+.Create Procedure Settings: ORDERSUMMARY Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `ordersummary`
-| *Code* | Library | `DEMO.SALES.SALES`
-| | Class Name | `Sales`
-| | Method Name | `orderSummary`
-3+<| *Parameters*
-| _First_ | Parameter Name | `on_or_after_date`
-| | SQL Data Type | `VARCHAR` +
- +
-- Length: `20`
-- Upshift: `not selected`
-- Character set: `ISO88591`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String`
-| _Second_ | Parameter Name | `num_orders`
-| | SQL Data Type | `SIGNED LARGEINT`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `long[]`
-| *Attributes* | Number of dynamic result sets | `2`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.sales.ordersummary`
+| *sql-parameter-1* | `IN on_or_after_date VARCHAR(20)`
+| *sql-parameter-2* | `OUT num_orders LARGEINT`
+| *external name* | `EXTERNAL NAME sales.orderSummary`
+| *library* | `LIBRARY trafodion.sales.sales`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 2`
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.sales.ordersummary( IN on_or_after_date VARCHAR(20)
+ , OUT num_orders LARGEINT
+ )
+ EXTERNAL NAME 'sales.orderSummary'
+ LIBRARY trafodion.sales.sales
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ DYNAMIC RESULT SETS 2
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-ordersummary]]
==== Calling the Procedure: ORDERSUMMARY
@@ -668,7 +707,7 @@ To invoke the ORDERSUMMARY procedure in trafci:
[source, sql]
----
-SQL> CALL demo.sales.ordersummary('01-01-2011', ?);
+SQL> CALL trafodion.sales.ordersummary('01-01-2011', ?);
----
The ORDERSUMMARY procedure returns this information about the orders on
@@ -729,7 +768,7 @@ See the following sections for more information about each SPJ method.
=== ADJUSTSALARY Procedure
The ADJUSTSALARY procedure accepts an employee number and a percentage
-vvalue and updates the employee's salary in the database based on that
+value and updates the employee's salary in the database based on that
percentage. This method also returns the updated salary to an output
parameter.
@@ -746,53 +785,55 @@ include::{sourcedir}/adjustSalary.java[adjustSalary procedure source code]
[[creating-the-procedure-adjustsalary]]
==== Creating the Procedure: ADJUSTSALARY
-Before creating the procedure, use HPDM to create a library named
-`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `PAYROLL`
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-9]]
-.HPDM Create Procedure Settings: ADJUSTSALARY Procedure
+.Create Procedure Settings: ADJUSTSALARY Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `adjustsalary`
-| *Code* | Library | `DEMO.PERSNL.PAYROLL`
-| | Class Name | `Payroll`
-| | Method Name | `adjustSalary`
-3+<| *Parameters*
-| _First_ | Parameter Name | `empnum`
-| | SQL Data Type | `SIGNED NUMERIC` +
- +
-- Precision: `4` +
-- Scale: `0`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
-| _Second_ | Parameter Name | `percent`
-| | SQL Data Type | `FLOAT`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `double`
-| _Third_ | Parameter Name | `newsalary`
-| | SQL Data Type | `SIGNED NUMERIC` +
- +
-- Precision: `8` +
-- Scale: `2`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal[]`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.persnl.adjustsalary`
+| *sql-parameter-1* | `IN empnum NUMERIC(4)`
+| *sql-parameter-2* | `IN percent FLOAT`
+| *sql-parameter-3* | `OUT newsalary NUMERIC(8,2)`
+| *external name* | `EXTERNAL NAME persnl.adjustSalary`
+| *library* | `LIBRARY trafodion.persnl.payroll`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `MODIFIES SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
+ , IN percent FLOAT
+ , OUT newsalary NUMERIC(8,2)
+ )
+ EXTERNAL NAME 'persnl.adjustSalary'
+ LIBRARY trafodion.persnl.payroll
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ MODIFIES SQL DATA
+ ;
+----
+
[[calling-the-procedure-adjustsalary]]
==== Calling the Procedure: ADJUSTSALARY
@@ -804,7 +845,7 @@ To invoke the ADJUSTSALARY procedure in trafci:
[source, sql]
----
-SQL> CALL demo.persnl.adjustsalary(29, 2.5, ?) ;
+SQL> CALL trafodion.persnl.adjustsalary(29, 2.5, ?) ;
----
The ADJUSTSALARY procedure updates the salary of employee number 29 by
@@ -841,46 +882,53 @@ include::{sourcedir}/employeeJob.java[employeeJob procedure source code]
[[creating-the-procedure-employeejob]]
==== Creating the Procedure: EMPLOYEEJOB
-Before creating the procedure, use HPDM to create a library named
-`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `PAYROLL`
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use these values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-10]]
-.HPDM Create Procedure Settings: EMPLOYEEJOB Procedure
+.Create Procedure Settings: EMPLOYEEJOB Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `employeejob`
-| *Code* | Library | `DEMO.PERSNL.PAYROLL`
-| | Class Name | `Payroll`
-| | Method Name | `employeeJob`
-3+<| *Parameters*
-| _First_ | Parameter Name | `empnum`
-| | SQL Data Type | `SIGNED NUMERIC` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.persnl.employeejob`
+| *sql-parameter-1* | `IN empnum NUMERIC(4)`
+| *sql-parameter-2* | `OUT jobcode INT`
+| *external name* | `EXTERNAL NAME persnl.employeeJob (int, java.lang.Integer[])`
+| *library* | `LIBRARY trafodion.persnl.payroll`
+| *external security* | `invoker`^1^ +
+
-- Precision: `4` +
-- Scale: `0`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
-| _Second_ | Parameter Name | `jobcode`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.Integer[]`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
- +
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
+ , OUT jobcode INT
+ )
+ EXTERNAL NAME 'persnl.employeeJob (int, java.lang.Integer[])'
+ LIBRARY trafodion.persnl.payroll
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-employeejob]]
==== Calling the Procedure: EMPLOYEEJOB
@@ -892,7 +940,7 @@ To invoke the EMPLOYEEJOB procedure in trafci:
[source, sql]
----
-SQL> CALL demo.persnl.employeejob(337, ?) ;
+SQL> CALL trafodion.persnl.employeejob(337, ?) ;
----
The EMPLOYEEJOB procedure accepts the employee number 337 and returns
@@ -929,39 +977,53 @@ include::{sourcedir}/projectTeam.java[projectTeam procedure source code]
[[creating-the-procedure-projectteam]]
==== Creating the Procedure: PROJECTTEAM
-Before creating the procedure, use HPDM to create a library named
-`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `PAYROLL`
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-11]]
-.HPDM Create Procedure Settings: PROJECTTEAM Procedure
+.Create Procedure Settings: PROJECTTEAM Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `projectteam`
-| *Code* | Library | `DEMO.PERSNL.PAYROLL`
-| | Class Name | `Payroll`
-| | Method Name | `projectTeam`
-3+<| *Parameters*
-| _First_ | Parameter Name | `projectcode`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| *Attributes* | Number of dynamic result sets | `1`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.persnl.projectteam`
+| *sql-parameter-1* | `IN projectcode INTEGER`
+| *external name* | `EXTERNAL NAME persnl.projectTeam`
+| *library* | `LIBRARY trafodion.persnl.payroll`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 1`
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.persnl.projectteam( IN projectcode INTEGER
+ , OUT jobcode INT
+ )
+ EXTERNAL NAME 'persnl.projectTeam'
+ LIBRARY trafodion.persnl.payroll
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ DYNAMIC RESULT SETS 1
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-projectteam]]
==== Calling the Procedure: PROJECTTEAM
@@ -973,7 +1035,7 @@ To invoke the PROJECTTEAM procedure in trafci:
[source, sql]
----
-SQL> CALL demo.persnl.projectteam( 5000 ) ;
+SQL> CALL trafodion.persnl.projectteam( 5000 ) ;
----
The PROJECTTEAM procedure returns this information about the employees
@@ -1014,39 +1076,52 @@ include::{sourcedir}/topSalesReps.java[topSalesReps procedure source code]
[[creating-the-procedure-topsalesreps]]
==== Creating the Procedure: TOPSALESREPS
-Before creating the procedure, use HPDM to create a library named
-`PAYROLL` in the `DEMO.PERSNL` schema and select the `Payroll.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `PAYROLL`
+in the `TRAFODION.PERSNL` schema and select the `Payroll.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the `Procedures` folder in the `PERSNL` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-12]]
-.HPDM Create Procedure Settings: TOPSALESREPS Procedure
+.Create Procedure Settings: TOPSALESREPS Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `topsalesreps`
-| *Code* | Library | `DEMO.PERSNL.PAYROLL`
-| | Class Name | `Payroll`
-| | Method Name | `topSalesReps`
-3+<| *Parameters*
-| _First_ | Parameter Name | `whichquarter`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| *Attributes* | Number of dynamic result sets | `1`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.persnl.topsalesreps`
+| *sql-parameter-1* | `IN whichquarter INTEGER`
+| *external name* | `EXTERNAL NAME persnl.topSalesReps`
+| *library* | `LIBRARY trafodion.persnl.payroll`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 1`
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.persnl.topsalesreps( IN whichquarter INTEGER
+ )
+ EXTERNAL NAME 'persnl.topSalesReps'
+ LIBRARY trafodion.persnl.payroll
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ DYNAMIC RESULT SETS 1
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-topsalesreps]]
==== Calling the Procedure: TOPSALESREPS
@@ -1058,7 +1133,7 @@ To invoke the TOPSALESREPS procedure in trafci:
[source, sql]
----
-SQL> CALL demo.persnl.topsalesreps( 1 ) ;
+SQL> CALL trafodion.persnl.topsalesreps( 1 ) ;
----
The TOPSALESREPS procedure returns this information about the top five
@@ -1123,87 +1198,61 @@ include::{sourcedir}/supplierInfo.java[supplierInfo procedure source code]
[[creating-the-procedure-supplierinfo]]
==== Creating the Procedure: SUPPLIERINFO
-Before creating the procedure, use HPDM to create a library named
-`INVENTORY` in the `DEMO.INVENT` schema and select the `Inventory.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `INVENTORY`
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the `INVENT` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-13]]
-.HPDM Create Procedure Settings: SUPPLIERINFO Procedure
+.Create Procedure Settings: SUPPLIERINFO Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `supplierinfo`
-| *Code* | Library | `DEMO.INVENT.INVENTORY`
-| | Class Name | `Inventory`
-| | Method Name | `supplierInfo`
-3+<| *Parameters*
-| _First_ | Parameter Name | `empnum`
-| | SQL Data Type | `SIGNED NUMERIC` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.invent.supplierinfo`
+| *sql-parameter-1* | `IN empnum NUMERIC(4)`
+| *sql-parameter-2* | `IN suppnum CHARACTER(18)`
+| *sql-parameter-3* | `OUT address CHARACTER(22)`
+| *sql-parameter-4* | `OUT city CHARACTER(14)`
+| *sql-parameter-5* | `OUT state CHARACTER(12)`
+| *sql-parameter-6* | `OUT zipcode CHARACTER(10)`
+| *external name* | `EXTERNAL NAME persnl.supplierInfo`
+| *library* | `LIBRARY trafodion.invent.inventory`
+| *external security* | `invoker`^1^ +
+
-- Precision: `4` +
-- Scale: `0`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.math.BigDecimal`
-| _Second_ | Parameter Name | `suppname`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `18` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| _Third_ | Parameter Name | `address`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `22` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| _Fourth_ | Parameter Name | `city`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `14` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| _Fifth_ | Parameter Name | `state`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `12` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| _Sixth_ | Parameter Name | `zipcode`
-| | SQL Data Type | `CHARACTER` +
- +
-- Length: `10` +
-- Varying: `not selected` +
-- Upshift: `not selected` +
-- Character set: `ISO88591`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `java.lang.String[]`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
- +
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.invent.supplierinfo( IN empnum NUMERIC(4)
+ , IN suppnum CHARACTER(18)
+ , OUT address CHARACTER(22)
+ , OUT city CHARACTER(14)
+ , OUT state CHARACTER(12)
+ , OUT zipcode CHARACTER(10)
+ )
+ EXTERNAL NAME 'persnl.supplierInfo'
+ LIBRARY trafodion.invent.inventory
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-supplierinfo]]
==== Calling the Procedure: SUPPLIERINFO
@@ -1215,7 +1264,7 @@ To invoke the SUPPLIERINFO procedure in trafci:
[source, sql]
----
-SQL> CALL demo.invent.supplierinfo( 25,?,?,?,?,? ) ;
+SQL> CALL trafodion.invent.supplierinfo( 25,?,?,?,?,? ) ;
----
The SUPPLIERINFO procedure accepts the supplier number 25 and returns
@@ -1251,47 +1300,55 @@ include::{sourcedir}/supplyQuantities.java[supplyQuantities procedure source cod
[[creating-the-procedure-supplyquantities]]
==== Creating the Procedure: SUPPLYQUANTITIES
-Before creating the procedure, use HPDM to create a library named
-`INVENTORY` in the `DEMO.INVENT` schema and select the `Inventory.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `INVENTORY`
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the `INVENT` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-14]]
-.HPDM Create Procedure Settings: SUPPLYQUANTITIES Procedure
+.Create Procedure Settings: SUPPLYQUANTITIES Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `supplyquantities`
-| *Code* | Library | `DEMO.INVENT.INVENTORY`
-| | Class Name | `Inventory`
-| | Method Name | `supplyQuantities`
-3+<| *Parameters*
-| _First_ | Parameter Name | `avrg`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| _Second_ | Parameter Name | `minm`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| _Third_ | Parameter Name | `maxm`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `OUT`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| *Attributes* | Number of dynamic result sets | `0`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.invent.supplyquantities`
+| *sql-parameter-1* | `OUT avrg INT`
+| *sql-parameter-2* | `OUT minm INT`
+| *sql-parameter-3* | `OUT maxm INT`
+| *external name* | `EXTERNAL NAME persnl.supplyQuantities`
+| *library* | `LIBRARY trafodion.invent.inventory`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 0`^1^
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.invent.supplyquantities( OUT avrg INT
+ , OUT minm INT
+ , OUT maxm INT
+ )
+ EXTERNAL NAME 'persnl.supplyQuantities'
+ LIBRARY trafodion.invent.inventory
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-supplyquantities]]
==== Calling the Procedure: SUPPLYQUANTITIES
@@ -1303,7 +1360,7 @@ To invoke the SUPPLYQUANTITIES procedure in trafci:
[source, sql]
----
-SQL> CALL demo.invent.supplynumbers( ?,?,? ) ;
+SQL> CALL trafodion.invent.supplynumbers( ?,?,? ) ;
----
The SUPPLYQUANTITIES procedure returns this output in trafci:
@@ -1341,42 +1398,55 @@ include::{sourcedir}/partLocations.java[partLocations procedure source code]
[[creating-the-procedure-partlocs]]
==== Creating the Procedure: PARTLOCS
-Before creating the procedure, use HPDM to create a library named
-`INVENTORY` in the `DEMO.INVENT` schema and select the `Inventory.jar` file to
-upload to the Trafodion platform for that library.
-For more information, see <<create-a-library, Create a Library>>.
+Before creating the procedure, create a library named `INVENTORY`
+in the `TRAFODION.INVENT` schema and select the `Inventory.jar` file to upload to the
+Trafodion platform for that library. For more information, see
+<<create-a-library, Create a Library>>.
-After creating the library, navigate to the Procedures folder in the `INVENT` schema,
-launch the Create Procedure dialog box, and then enter or select these values.
-For more information, see <<create-a-procedure, Create a Procedure>>.
+After creating the library, use the values listed in the table below to define and execute the
+CREATE PROCEDURE command. For more information, see <<create-a-procedure, Create a Procedure>>.
[[table-15]]
-.HPDM Create Procedure Settings: PARTLOCS Procedure
+.Create Procedure Settings: PARTLOCS Procedure
-[cols="15%,30%,55%", options="header"]
+[cols="20%,85%",options="header"]
|===
-| Group Box | Field or Option | Value or Setting
-| *Name* | Procedure Name | `partlocs`
-| *Code* | Library | `DEMO.INVENT.INVENTORY`
-| | Class Name | `Inventory`
-| | Method Name | `partLocs`
-3+<| *Parameters*
-| _First_ | Parameter Name | `partnum`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| | Java Data Type | Displays the signature of the Java method that you selected: `int`
-| _Second_ | Parameter Name | `qty`
-| | SQL Data Type | `SIGNED INTEGER`
-| | Direction | `IN`
-| *Attributes* | Number of dynamic result sets | `2`
-| | Acceses Database | `selected`
-| | External Security | `Invoker` +
+| Attribute | Definition
+| *procedure-ref* | `trafodion.invent.partlocs`
+| *sql-parameter-1* | `IN partnum INT`
+| *sql-parameter-2* | `IN qty INT`
+| *external name* | `EXTERNAL NAME persnl.partLocations`
+| *library* | `LIBRARY trafodion.invent.inventory`
+| *external security* | `invoker`^1^ +
+
-*NOTE:* Depending on your security requirements, you can select `Definer` instead.
-For more information, see <<understand-external-security, Understand External Security>>.
-| | Transaction Required | `Yes`
+Choice depends on your security requirements, you can select `definer` instead.
+For more information, see <<understand-external-security, Understand External Security>>.
+| *language java* | `LANGUAGE JAVA`
+| *parameter style java* | `PARAMETER STYLE JAVA`
+| *_sql access_* | `READS SQL DATA`
+| *dynamic result sets* | `DYNAMIC RESULT SETS 2`
+| *_transaction_* | `TRANSACTION REQUIRED`^1^
+| *_determinism_* | `NOT DETERMINISTIC`^1^
+| *_isolation_* | `ISOLATE`^1^
|===
+^1^ Definition represents default value. Not included in the CREATE PROCEDURE example.
+
+[source, sql]
+----
+CREATE PROCEDURE trafodion.invent.partlocs( IN partnum INT
+ , IN qty INT
+ , OUT maxm INT
+ )
+ EXTERNAL NAME 'persnl.partLocations'
+ LIBRARY trafodion.invent.inventory
+ LANGUAGE JAVA
+ PARAMETER STYLE JAVA
+ DYNAMIC RESULT SETS 2
+ READS SQL DATA
+ ;
+----
+
[[calling-the-procedure-partlocs]]
==== Calling the Procedure: PARTLOCS
@@ -1388,7 +1458,7 @@ To invoke the PARTLOCS procedure in trafci:
[source, sql]
----
-SQL> CALL demo.invent.partlocs( 212, 18 ) ;
+SQL> CALL trafodion.invent.partlocs( 212, 18 ) ;
----
The PARTLOCS procedure accepts the part number 212 and returns a set of
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/Inventory.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Inventory.java b/docs/spj_guide/src/resources/source/Inventory.java
index becfbee..76c5359 100644
--- a/docs/spj_guide/src/resources/source/Inventory.java
+++ b/docs/spj_guide/src/resources/source/Inventory.java
@@ -23,7 +23,7 @@ public class Inventory
PreparedStatement getSupplier =
conn.prepareStatement( "SELECT suppname, street, city, "
+ " state, postcode "
- + "FROM demo.invent.supplier "
+ + "FROM trafodion.invent.supplier "
+ "WHERE suppnum = ?"
) ;
@@ -60,7 +60,7 @@ public class Inventory
conn.prepareStatement( "SELECT AVG(qty_on_hand), "
+ " MIN(qty_on_hand), "
+ " MAX(qty_on_hand) "
- + "FROM demo.invent.partloc"
+ + "FROM trafodion.invent.partloc"
) ;
ResultSet rs = getQty.executeQuery() ;
@@ -93,7 +93,7 @@ public class Inventory
PreparedStatement getLocationsExact =
conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
+ + "FROM trafodion.invent.partloc L "
+ "WHERE L.partnum = ? "
+ " AND L.qty_on_hand = ? "
+ " ORDER BY L.partnum "
@@ -104,7 +104,7 @@ public class Inventory
PreparedStatement getLocationsMoreThan =
conn.prepareStatement( "SELECT L.loc_code, L.partnum, L.qty_on_hand "
- + "FROM demo.invent.partloc L "
+ + "FROM trafodion.invent.partloc L "
+ "WHERE L.partnum = ? "
+ " AND L.qty_on_hand > ? "
+ "ORDER BY L.partnum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/Payroll.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Payroll.java b/docs/spj_guide/src/resources/source/Payroll.java
index 7a85254..89c28a5 100644
--- a/docs/spj_guide/src/resources/source/Payroll.java
+++ b/docs/spj_guide/src/resources/source/Payroll.java
@@ -19,14 +19,14 @@ public class Payroll
DriverManager.getConnection( "jdbc:default:connection" ) ;
PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
+ conn.prepareStatement( "UPDATE trafodion.persnl.employee "
+ "SET salary = salary * (1 + (? / 100)) "
+ "WHERE empnum = ?"
) ;
PreparedStatement getSalary =
conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
@@ -59,7 +59,7 @@ public class Payroll
PreparedStatement getJobcode =
conn.prepareStatement( "SELECT jobcode "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
@@ -93,7 +93,7 @@ public class Payroll
PreparedStatement getMembers =
conn.prepareStatement( "SELECT E.empnum, E.first_name, E.last_name, D.location "
- + "FROM demo.persnl.employee E, demo.persnl.dept D, demo.persnl.project P "
+ + "FROM trafodion.persnl.employee E, trafodion.persnl.dept D, trafodion.persnl.project P "
+ "WHERE P.projcode = ? "
+ " AND P.empnum = E.empnum "
+ " AND E.deptnum = D.deptnum "
@@ -132,10 +132,10 @@ public class Payroll
PreparedStatement getTopReps =
conn.prepareStatement( "SELECT [first 5] e.empnum, e.first_name, "
+ "e.last_name, totals.total "
- + "FROM demo.persnl.employee e, "
+ + "FROM trafodion.persnl.employee e, "
+ " ( SELECT o.salesrep, "
+ " SUM( od.unit_price * od.qty_ordered ) as total "
- + " FROM demo.sales.orders o, demo.sales.odetail od "
+ + " FROM trafodion.sales.orders o, trafodion.sales.odetail od "
+ " WHERE o.ordernum = od.ordernum "
+ " AND QUARTER( o.order_date ) = ? "
+ " GROUP BY o.salesrep "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/Sales.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/Sales.java b/docs/spj_guide/src/resources/source/Sales.java
index e66fbe1..eba4fe2 100644
--- a/docs/spj_guide/src/resources/source/Sales.java
+++ b/docs/spj_guide/src/resources/source/Sales.java
@@ -17,14 +17,14 @@ public class Sales
PreparedStatement getParts =
conn.prepareStatement( "SELECT p.partnum, "
+ "SUM(qty_ordered) AS qtyOrdered "
- + "FROM demo.sales.parts p "
- + "LEFT JOIN demo.sales.odetail o "
+ + "FROM trafodion.sales.parts p "
+ + "LEFT JOIN trafodion.sales.odetail o "
+ "ON p.partnum = o.partnum "
+ "GROUP BY p.partnum"
) ;
PreparedStatement updateParts =
- conn.prepareStatement( "UPDATE demo.sales.parts "
+ conn.prepareStatement( "UPDATE trafodion.sales.parts "
+ "SET price = price * 0.9 "
+ "WHERE partnum = ?"
) ;
@@ -61,7 +61,7 @@ public class Sales
PreparedStatement getNumOrders =
conn.prepareStatement( "SELECT COUNT(order_date) "
- + "FROM demo.sales.orders "
+ + "FROM trafodion.sales.orders "
+ "WHERE order_date = ?"
) ;
@@ -102,7 +102,7 @@ public class Sales
PreparedStatement getNumOrders =
conn.prepareStatement( "SELECT COUNT( month( order_date ) ) "
- + "FROM demo.sales.orders "
+ + "FROM trafodion.sales.orders "
+ "WHERE month( order_date ) = ?"
) ;
@@ -194,7 +194,7 @@ public class Sales
// Retrieve detail about this part into the output parameters
PreparedStatement getPartInfo =
conn.prepareStatement( "SELECT P.partdesc, P.price, P.qty_available "
- + "FROM demo.sales.parts P "
+ + "FROM trafodion.sales.parts P "
+ "WHERE partnum = ? "
) ;
@@ -214,9 +214,9 @@ public class Sales
// quantity of this part that was ordered.
PreparedStatement getOrders =
conn.prepareStatement( "SELECT O.*, QTY.QTY_ORDERED "
- + "FROM demo.sales.orders O "
+ + "FROM trafodion.sales.orders O "
+ " , ( select ordernum, sum(qty_ordered) as QTY_ORDERED "
- + " from demo.sales.odetail "
+ + " from trafodion.sales.odetail "
+ " where partnum = ? "
+ " group by ordernum ) QTY "
+ "WHERE O.ordernum = QTY.ordernum "
@@ -232,7 +232,7 @@ public class Sales
// have on hand.
PreparedStatement getLocations =
conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partloc "
+ + "FROM trafodion.invent.partloc "
+ " WHERE partnum = ? "
) ;
@@ -243,7 +243,7 @@ public class Sales
// suppliers who supply this part.
PreparedStatement getSuppliers =
conn.prepareStatement( "SELECT * "
- + "FROM demo.invent.partsupp "
+ + "FROM trafodion.invent.partsupp "
+ "WHERE partnum = ? "
) ;
@@ -254,10 +254,10 @@ public class Sales
// sales reps that have sold this part.
PreparedStatement getReps =
conn.prepareStatement( "SELECT * "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum in ( SELECT O.salesrep "
- + " FROM demo.sales.orders O, "
- + " demo.sales.odetail D "
+ + " FROM trafodion.sales.orders O, "
+ + " trafodion.sales.odetail D "
+ " D.partnum = ? "
+ " O.ordernum = D.ordernum ) "
+ "ORDER BY empnum "
@@ -295,7 +295,7 @@ public class Sales
DriverManager.getConnection( "jdbc:default:connection" ) ;
// Get the number of orders on or after this date
- s = "SELECT COUNT(ordernum) FROM demo.sales.orders "
+ s = "SELECT COUNT(ordernum) FROM trafodion.sales.orders "
+ "WHERE order_date >= CAST(? AS DATE) "
;
@@ -314,13 +314,13 @@ public class Sales
+ " o.ordernum "
+ " , COUNT(d.partnum) AS num_parts "
+ " , SUM(d.unit_price * d.qty_ordered) AS amount "
- + " FROM demo.sales.orders o, demo.sales.odetail d "
+ + " FROM trafodion.sales.orders o, trafodion.sales.odetail d "
+ " WHERE o.ordernum = d.ordernum "
+ " AND o.order_date >= CAST(? AS DATE) "
+ " GROUP BY o.ordernum "
+ " ) amounts "
- + " , demo.sales.orders orders "
- + " , demo.persnl.employee emps "
+ + " , trafodion.sales.orders orders "
+ + " , trafodion.persnl.employee emps "
+ "WHERE amounts.ordernum = orders.ordernum "
+ " AND orders.salesrep = emps.empnum "
+ "ORDER BY orders.ordernum "
@@ -332,7 +332,7 @@ public class Sales
// Open a result set for order detail rows
s = "SELECT d.*, p.partdesc "
- + "FROM demo.sales.odetail d, demo.sales.parts p, demo.sales.orders O "
+ + "FROM trafodion.sales.odetail d, trafodion.sales.parts p, trafodion.sales.orders O "
+ "WHERE d.partnum = p.partnum AND d.ordernum = o.ordernum "
+ " AND o.order_date >= CAST(? AS DATE) "
+ "ORDER BY d.ordernum "
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/adjustSalary.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/adjustSalary.java b/docs/spj_guide/src/resources/source/adjustSalary.java
index 70ee558..cc2b095 100644
--- a/docs/spj_guide/src/resources/source/adjustSalary.java
+++ b/docs/spj_guide/src/resources/source/adjustSalary.java
@@ -14,14 +14,14 @@ public static void adjustSalary( BigDecimal empNum
DriverManager.getConnection( "jdbc:default:connection" ) ;
PreparedStatement setSalary =
- conn.prepareStatement( "UPDATE demo.persnl.employee "
+ conn.prepareStatement( "UPDATE trafodion.persnl.employee "
+ "SET salary = salary * (1 + (? / 100)) "
+ "WHERE empnum = ?"
) ;
PreparedStatement getSalary =
conn.prepareStatement( "SELECT salary "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/employeeJob.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/employeeJob.java b/docs/spj_guide/src/resources/source/employeeJob.java
index 99196bd..ce5cdab 100644
--- a/docs/spj_guide/src/resources/source/employeeJob.java
+++ b/docs/spj_guide/src/resources/source/employeeJob.java
@@ -12,7 +12,7 @@ public static void employeeJob( int empNum
PreparedStatement getJobcode =
conn.prepareStatement( "SELECT jobcode "
- + "FROM demo.persnl.employee "
+ + "FROM trafodion.persnl.employee "
+ "WHERE empnum = ?"
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/invent_partloc_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_partloc_table.sql b/docs/spj_guide/src/resources/source/invent_partloc_table.sql
index 03ecebb..6268f7f 100644
--- a/docs/spj_guide/src/resources/source/invent_partloc_table.sql
+++ b/docs/spj_guide/src/resources/source/invent_partloc_table.sql
@@ -1,56 +1,56 @@
-CREATE TABLE demo.invent.partloc
+CREATE TABLE trafodion.invent.partloc
( loc_code CHARACTER (3) NO DEFAULT NOT NULL
, partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, qty_on_hand NUMERIC (7) DEFAULT 0 NOT NULL
-, PRIMARY KEY (loc_code,partnum)
+, PRIMARY KEY ( loc_code, partnum )
) ;
-INSERT INTO demo.invent.partloc VALUES
- ('A10', 2001, 800 )
-, ('A21', 255, 21 )
-, ('A34', 6201, 0 )
-, ('A35', 6301, 0 )
-, ('A36', 6400, 34 )
-, ('A66', 6603, 300 )
-, ('A67', 6401, 454 )
-, ('A78', 244, 43 )
-, ('A78', 5505, 100 )
-, ('A87', 212, 18 )
-, ('A88', 2403, 735 )
-, ('A88', 5504, 30 )
-, ('A94', 3205, 200 )
-, ('A98', 5110, 510 )
-, ('G11', 2002, 20 )
-, ('G34', 6201, 106 )
-, ('G35', 6301, 331 )
-, ('G36', 6400, 1034 )
-, ('G43', 5100, 77 )
-, ('G45', 4102, 69 )
-, ('G65', 3201, 36 )
-, ('G68', 6500, 1132 )
-, ('G76', 2405, 42 )
-, ('G76', 7301, 32 )
-, ('G78', 5505, 0 )
-, ('G87', 212, 20 )
-, ('G87', 3103, 0 )
-, ('G87', 3210, 44 )
-, ('G87', 2402, 0 )
-, ('G88', 2403, 32 )
-, ('G88', 5504, 0 )
-, ('G89', 5101, 86 )
-, ('G94', 3205, 59 )
-, ('G98', 5103, 28 )
-, ('G98', 5110, 136 )
-, ('P10', 2001, 0 )
-, ('P12', 2002, 200 )
-, ('P12', 2003, 0 )
-, ('P15', 2003, 200 )
-, ('P66', 6603, 40 )
-, ('P67', 6401, 54 )
-, ('P68', 6500, 0 )
-, ('P76', 7102, 200 )
-, ('P78', 244, 23 )
-, ('P87', 3103, 300 )
+INSERT INTO trafodion.invent.partloc VALUES
+ ( 'A10', 2001, 800 )
+, ( 'A21', 255, 21 )
+, ( 'A34', 6201, 0 )
+, ( 'A35', 6301, 0 )
+, ( 'A36', 6400, 34 )
+, ( 'A66', 6603, 300 )
+, ( 'A67', 6401, 454 )
+, ( 'A78', 244, 43 )
+, ( 'A78', 5505, 100 )
+, ( 'A87', 212, 18 )
+, ( 'A88', 2403, 735 )
+, ( 'A88', 5504, 30 )
+, ( 'A94', 3205, 200 )
+, ( 'A98', 5110, 510 )
+, ( 'G11', 2002, 20 )
+, ( 'G34', 6201, 106 )
+, ( 'G35', 6301, 331 )
+, ( 'G36', 6400, 1034 )
+, ( 'G43', 5100, 77 )
+, ( 'G45', 4102, 69 )
+, ( 'G65', 3201, 36 )
+, ( 'G68', 6500, 1132 )
+, ( 'G76', 2405, 42 )
+, ( 'G76', 7301, 32 )
+, ( 'G78', 5505, 0 )
+, ( 'G87', 212, 20 )
+, ( 'G87', 3103, 0 )
+, ( 'G87', 3210, 44 )
+, ( 'G87', 2402, 0 )
+, ( 'G88', 2403, 32 )
+, ( 'G88', 5504, 0 )
+, ( 'G89', 5101, 86 )
+, ( 'G94', 3205, 59 )
+, ( 'G98', 5103, 28 )
+, ( 'G98', 5110, 136 )
+, ( 'P10', 2001, 0 )
+, ( 'P12', 2002, 200 )
+, ( 'P12', 2003, 0 )
+, ( 'P15', 2003, 200 )
+, ( 'P66', 6603, 40 )
+, ( 'P67', 6401, 54 )
+, ( 'P68', 6500, 0 )
+, ( 'P76', 7102, 200 )
+, ( 'P78', 244, 23 )
+, ( 'P87', 3103, 300 )
;
-UPDATE STATISTICS FOR TABLE demo.invent.partloc ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.invent.partloc ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_partsupp_table.sql b/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
index 5f388c1..e5d4e1d 100644
--- a/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
+++ b/docs/spj_guide/src/resources/source/invent_partsupp_table.sql
@@ -1,16 +1,16 @@
-CREATE TABLE demo.invent.partsupp
+CREATE TABLE trafodion.invent.partsupp
( partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, partcost NUMERIC (8, 2) NO DEFAULT NOT NULL
, qty_received NUMERIC (5) UNSIGNED DEFAULT 0 NOT NULL
-, PRIMARY KEY (partnum,suppnum)
+, PRIMARY KEY ( partnum, suppnum )
) ;
CREATE INDEX XSUPORD ON partsupp
( suppnum
) ;
-CREATE VIEW demo.invent.view207
+CREATE VIEW trafodion.invent.view207
( partnumber
, partdescrpt
, suppnumber
@@ -26,14 +26,14 @@ AS SELECT
, partcost
, qty_received
FROM
- demo.invent.partsupp x
-, demo.sales.parts p
-, demo.invent.supplier s
+ trafodion.invent.partsupp x
+, trafodion.sales.parts p
+, trafodion.invent.supplier s
WHERE x.partnum = p.partnum
AND x.suppnum = s.suppnum
;
-CREATE VIEW demo.invent.view207n
+CREATE VIEW trafodion.invent.view207n
( partnumber
, partdescrpt
, suppnumber
@@ -48,12 +48,12 @@ AS SELECT
, s.suppname
, x.partcost
, x.qty_received
-FROM demo.invent.supplier s
-LEFT JOIN demo.invent.partsupp x ON s.suppnum = x.suppnum
-LEFT JOIN demo.sales.parts p ON x.partnum = p.partnum
+FROM trafodion.invent.supplier s
+LEFT JOIN trafodion.invent.partsupp x ON s.suppnum = x.suppnum
+LEFT JOIN trafodion.sales.parts p ON x.partnum = p.partnum
;
-CREATE VIEW demo.invent.viewcust
+CREATE VIEW trafodion.invent.viewcust
( custnumber
, cusname
, ordernum
@@ -62,18 +62,18 @@ AS SELECT
c.custnum
, c.custname
, o.ordernum
-FROM demo.sales.customer c
-LEFT JOIN demo.sales.orders o ON c.custnum = o.custnum
+FROM trafodion.sales.customer c
+LEFT JOIN trafodion.sales.orders o ON c.custnum = o.custnum
;
-CREATE VIEW demo.invent.viewcs AS SELECT
+CREATE VIEW trafodion.invent.viewcs AS SELECT
custname
-FROM demo.sales.customer
+FROM trafodion.sales.customer
UNION SELECT
suppname
-FROM demo.invent.supplier ;
+FROM trafodion.invent.supplier ;
-INSERT INTO demo.invent.partsupp VALUES
+INSERT INTO trafodion.invent.partsupp VALUES
( 212, 1, 2000.00, 20 )
, ( 212, 3, 1900.00, 35 )
, ( 244, 1, 2400.00, 50 )
@@ -125,4 +125,4 @@ INSERT INTO demo.invent.partsupp VALUES
, ( 7301, 1, 300.00, 32 )
;
-UPDATE STATISTICS FOR TABLE demo.invent.partsupp ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.invent.partsupp ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/invent_schema.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_schema.sql b/docs/spj_guide/src/resources/source/invent_schema.sql
index 9074be8..69ec911 100644
--- a/docs/spj_guide/src/resources/source/invent_schema.sql
+++ b/docs/spj_guide/src/resources/source/invent_schema.sql
@@ -1,2 +1,2 @@
-CREATE SCHEMA DEMO.INVENT ;
-SET SCHEMA DEMO.INVENT ;
+CREATE SCHEMA trafodion.invent ;
+SET SCHEMA trafodion.invent ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/invent_supplier_table.sql
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/invent_supplier_table.sql b/docs/spj_guide/src/resources/source/invent_supplier_table.sql
index 0fc4da3..0391052 100644
--- a/docs/spj_guide/src/resources/source/invent_supplier_table.sql
+++ b/docs/spj_guide/src/resources/source/invent_supplier_table.sql
@@ -1,18 +1,18 @@
-CREATE TABLE demo.invent.supplier
+CREATE TABLE trafodion.invent.supplier
( suppnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL
, suppname CHARACTER (18) NO DEFAULT NOT NULL
, street CHARACTER (22) NO DEFAULT NOT NULL
, city CHARACTER (14) NO DEFAULT NOT NULL
, state CHARACTER (12) NO DEFAULT NOT NULL
, postcode CHARACTER (10) NO DEFAULT NOT NULL
-, PRIMARY KEY (suppnum)
+, PRIMARY KEY ( suppnum )
) ;
CREATE INDEX xsuppnam ON supplier
( suppname
) ;
-INSERT INTO demo.invent.supplier VALUES
+INSERT INTO trafodion.invent.supplier VALUES
( 1, 'NEW COMPUTERS INC', '1800 KING ST.', 'SAN FRANCISCO', 'CALIFORNIA', '94112' )
, ( 2, 'DATA TERMINAL INC', '2000 BAKER STREET', 'LAS VEGAS', 'NEVADA', '66134' )
, ( 3, 'HIGH DENSITY INC', '7600 EMERSON', 'NEW YORK', 'NEW YORK', '10230' )
@@ -32,4 +32,4 @@ INSERT INTO demo.invent.supplier VALUES
, ( 186, '186 Disk Makers', '186 Dis Way', 'Dat Way', 'Wisconsin', '00186' )
;
-UPDATE STATISTICS FOR TABLE demo.invent.supplier ON EVERY COLUMN ;
+UPDATE STATISTICS FOR TABLE trafodion.invent.supplier ON EVERY COLUMN ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/lowerPrice.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/lowerPrice.java b/docs/spj_guide/src/resources/source/lowerPrice.java
index fd25ecd..b49ff2f 100644
--- a/docs/spj_guide/src/resources/source/lowerPrice.java
+++ b/docs/spj_guide/src/resources/source/lowerPrice.java
@@ -12,14 +12,14 @@ public static void lowerPrice() throws SQLException
PreparedStatement getParts =
conn.prepareStatement( "SELECT p.partnum, "
+ "SUM(qty_ordered) AS qtyOrdered "
- + "FROM demo.sales.parts p "
- + "LEFT JOIN demo.sales.odetail o "
+ + "FROM trafodion.sales.parts p "
+ + "LEFT JOIN trafodion.sales.odetail o "
+ "ON p.partnum = o.partnum "
+ "GROUP BY p.partnum"
) ;
PreparedStatement updateParts =
- conn.prepareStatement( "UPDATE demo.sales.parts "
+ conn.prepareStatement( "UPDATE trafodion.sales.parts "
+ "SET price = price * 0.9 "
+ "WHERE partnum = ?"
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/numDailyOrders.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/numDailyOrders.java b/docs/spj_guide/src/resources/source/numDailyOrders.java
index d7aab43..568d71f 100644
--- a/docs/spj_guide/src/resources/source/numDailyOrders.java
+++ b/docs/spj_guide/src/resources/source/numDailyOrders.java
@@ -12,7 +12,7 @@ public static void numDailyOrders( Date date
PreparedStatement getNumOrders =
conn.prepareStatement( "SELECT COUNT(order_date) "
- + "FROM demo.sales.orders "
+ + "FROM trafodion.sales.orders "
+ "WHERE order_date = ?"
) ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5e15be3e/docs/spj_guide/src/resources/source/numMonthlyOrders.java
----------------------------------------------------------------------
diff --git a/docs/spj_guide/src/resources/source/numMonthlyOrders.java b/docs/spj_guide/src/resources/source/numMonthlyOrders.java
index 605f605..942ea01 100644
--- a/docs/spj_guide/src/resources/source/numMonthlyOrders.java
+++ b/docs/spj_guide/src/resources/source/numMonthlyOrders.java
@@ -23,7 +23,7 @@ public static void numMonthlyOrders( int month
PreparedStatement getNumOrders =
conn.prepareStatement( "SELECT COUNT( month( order_date ) ) "
- + "FROM demo.sales.orders "
+ + "FROM trafodion.sales.orders "
+ "WHERE month( order_date ) = ?"
) ;