Java Examples for ASE 12.5


Class Routines3

java.lang.Object
  |
  +--Routines3

public class Routines3
extends java.lang.Object

A class with an orderedEmpsmethod for an SQLJ create procedure that returns an SQL result set.


Constructor Summary
Routines3()
           
 
Method Summary
static void orderedEmps(int regionParm, java.sql.ResultSet[] rs)
          An example method that returns a result set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Routines3

public Routines3()
Method Detail

orderedEmps

public static void orderedEmps(int regionParm,
                               java.sql.ResultSet[] rs)
                        throws java.sql.SQLException
An example method that returns a result set.

This method is intended for an SQLJ create procedure such as the following:

  create procedure rankedemps(region integer)
  	dynamic result sets 1
  	language java parameter style java
  	external name 'Routines3.orderedEmps(int)'  
  

That SQLJ procedure "rankedemps" would be called as a stored procedure by an SQL client. For example, a Java client such as the following:

  java.sql.CallableStatement stmt =
  	conn.prepareCall({call rankedemps(?)});
  stmt.setInt(1,3);
  ResultSet rs = stmt.executeQuery();
  while (rs.next()) {
  	String name = rs.getString(1);
  	int.region = rs.getInt(2);
  	BigDecimal sales = rs.get.BigDecimal(3);
  	System.out.print(Name =  + name);
  	System.out.print(Region =  + region);
  	System.out.print(Sales =  + sales);
  	System.out.printIn():
  }
  

The main method of the Java class CallRankedEmps contains such a call of "rankedemps".

Parameters:
int - an int with a region value
rs - the result set that will be returned on the SQLJ call

Java Examples for ASE 12.5