Java Examples for ASE 12.5


Class Routines1

java.lang.Object
  |
  +--Routines1

public class Routines1
extends java.lang.Object

A class with two methods for simple SQL create function and create procedure examples.


Constructor Summary
Routines1()
           
 
Method Summary
static void correctStates(java.lang.String oldSpelling, java.lang.String newSpelling)
          A method that updates the "salesemp" table to correct the spelling of a given state.
static int region(java.lang.String s)
          A method that returns a code for the geographic region of a given state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Routines1

public Routines1()
Method Detail

region

public static int region(java.lang.String s)
                  throws java.sql.SQLException
A method that returns a code for the geographic region of a given state.

This method is intended for use with an SQLJ create function such as the following:

  create function regionof(state char(20)) 
		returns integer
  language java parameter style java
  external name 'Routines1.region(java.lang.String)'
  

That SQLJ function "regionof" would be called in SQL as follows:

  select name, dbo.regionof(state) as region
  	from salesemps
  where dbo.regionof(state)=3
  
Parameters:
s - the given state abbreviation

correctStates

public static void correctStates(java.lang.String oldSpelling,
                                 java.lang.String newSpelling)
                          throws java.sql.SQLException
A method that updates the "salesemp" table to correct the spelling of a given state.

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

  create procedure correctstates(old char(20), 
		notold char(20))
	modifies sql data
	language java parameter style java
	external name
		'Routines1.correctStates(java.lang.String
		java.lang.String)'

  

That SQLJ procedure 'correctstates' would be called in SQL as follows:

  execute correctstates 'GEO', 'GA'
  
Parameters:
oldSpelling - the incorrect spelling, e.g. "Calif"
newSpelling - the correct spelling, e.g. "CA"

Java Examples for ASE 12.5