Invoking Java methods in SQL  Exceptions in Java-SQL methods

Chapter 3: Using Java Classes in SQL

Sample methods

The sample Address and Address2Line classes have instance methods named toString( ), and the sample Misc class has static methods named stripLeadingBlanks( ), getNumber( ), and getStreet( ). You can invoke value methods as functions in a value expression.

declare @name varchar(100)
declare @street varchar(100)
declare @streetnum int
declare @A2 Address2Line
 
select @name = Misc.stripLeadingBlanks(name), 
		@street = Misc.stripLeadingBlanks(home_addr>>street),
		@streetnum = Misc.getNumber(home_addr>>street),
		@A2 = mailing_addr
	from emps
	where home_addr>>toString( ) like '%Shoreline%'

For information about void methods (methods with no returned value) see “Type and void methods”.





Copyright © 2005. Sybase Inc. All rights reserved. Exceptions in Java-SQL methods

View this book as PDF