public class MyJavaSubstr
{
public static String my_java_substr( String in, int start, int length )
{
String rc = null;
if ( start < 1 )
{
start = 1;
}
// Convert the SQL start, length to Java start, end.
start --; // Java is 0 based, but SQL is one based.
int endindex = start+length;
try {
if ( in != null )
{
rc = in.substring( start, endindex );
}
} catch ( IndexOutOfBoundsException ex )
{
System.out.println("ScalarTestFunctions:
my_java_substr("+in+","+start+","+length+") failed");
System.out.println(ex);
}
return rc;
}