db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "DerbySQLroutines" by Sreedish
Date Tue, 03 Apr 2012 06:07:46 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "DerbySQLroutines" page has been changed by Sreedish:
http://wiki.apache.org/db-derby/DerbySQLroutines?action=diff&rev1=29&rev2=30

- 8This page describes how to implement SQL routines -- functions and procedures -- in java.
Feel free to edit. Especially please add working examples.
+ This page describes how to implement SQL routines -- functions and procedures -- in java.
Feel free to edit. Especially please add working examples.
  
  '''Table of Contents''' <<TableOfContents(2)>>
  
@@ -355, +355 @@

  return: int
  
  This function takes two instances of Dates as input and returns the number of days between
them.
+ 
+ Create function statement:
+ 
+ create function DateDifference(d1 Date,d2 Date) returns int parameter style java no sql
language java external name 'DateDifference.daysBetween';
  }}}
  {{{
  Function name   :findDayOfTheWeek
@@ -365, +369 @@

  This method takes three integers(date, month, and year) as input arguments and returns values
  
  from 0 to 6 indicating from Sunday to Saturday.
+ 
+ Create function statement:
+ 
+ create function DayOfTheWeekFinder(day int,month int,year int) returns double parameter
style java no sql language java external name 'DayOfTheWeekFinder.findDayOfTheWeek';
  }}}
  {{{
  Function name   :findExpm
@@ -377, +385 @@

  useful while calculating values when they are very much close to zero and they will be truncated
  
  because of precision issues.
+ 
+ Create function statement:
+ 
+ create function Expm(d double) returns double parameter style java no sql language java
external name 'Expm.findExpm';
  }}}
  {{{
  Function name   :findDate
@@ -391, +403 @@

  forward. Example: If you want to find the date which is 100 days from 11/03/2011, make a
call
  
  like FindDate(11,3,2011,100). Returns 1 if function executred perfectly.
+ 
+ Create function statement:
+ create function FindDate(dd int,mm int,yy int,int count) returns int parameter style java
no sql language java external name 'FindDate.findDate';
  }}}
  {{{
  Function name   :findIsPrime
@@ -398, +413 @@

  input:int
  return:boolean
  
- This function takes an integer as input and returns true or false based on the primality
of the
+ This function takes an integer as input and returns true or false based on the primality
of the number.
  
- number.
+ Create function statement:
+ create function IsPrime(n int) returns boolean parameter style java no sql language java
external name 'IsPrime.findIsPrime';
  }}}
  {{{
  Function name   :findMD5
@@ -408, +424 @@

  input:String
  return:String
  
- This function takes a string as input and calculates its MD5 checksum and returns the checksum
+ This function takes a string as input and calculates its MD5 checksum and returns the checksum
value as a string.
  
- value as a string.
+ Create function statement:
+ create function MD5(str varchar(100)) returns varchar(100) parameter style java no sql language
java external name 'MD5.findMD5';
  }}}
  {{{
  Function name   :findNextPrime
@@ -419, +436 @@

  return:int
  
  This function finds the next prime number followed by the given number
+ 
+ Create function statement:
+ create function NextPrime(n int) returns int parameter style java no sql language java external
name
  }}}
  {{{
  Function name   :findNumberofPrimes
@@ -429, +449 @@

  This function returns an integer and takes an integer as input. The return value indicates
the
  
  number of prime numbers which are less than or equal to the passed argument.
+ 
+ Create function statement:
+ create function NumberOfPrimes(n int) returns int parameter style java no sql language java
external name 'NumberOfPrimes.findNumberOfPrimes'
  }}}
  {{{
  Function name   :shuffleString
@@ -439, +462 @@

  This functions takes a string as input and returns a randomly shuffled permutation of the
  
  string. This shuffling is done based on several random numbers generated.
+ 
+ Create function statement:
+ create function Shuffle(str varchar(20)) returns varchar(20) parameter style java no sql
language java external name 'Shuffle.shuffleString';
  }}}
  {{{
  Function name   :findSimilarText
@@ -450, +476 @@

  
  double value in the range from 0 to 100 indicating how much similar these strings are. Two
  
- identical strings will produce a return value of 100 and two completely disjoint strings
will
+ identical strings will produce a return value of 100 and two completely disjoint strings
will produce a return value of 0.
  
- produce a return value of 0.
+ Create function statement:
+ create function SimilarText(str1 varchar(20),str2 varchar(20)) returns double parameter
style java no sql language java external name 'SimilarText.FindSimilarText';
  }}}
  {{{
  Function name   :SpaceBuilder
@@ -461, +488 @@

  return:int
  
  This function returns a string composed only of spaces and the number of spaces is.
+ 
+ Create function statement:
+ create function Space(num int) returns varchar(200) parameter style java no sql language
java external name 'Space.SpaceBuilder';
  }}}
  {{{
  Function name   :MethodStripTag
@@ -471, +501 @@

  This method takes a string as inpuit and based on a regular expression, it strips of all
the
  
  tags such as HTML tags from the string and returns the string wihtout any tags.
+ 
+ Create function statement:
+ create function StripTag(str varchar(200)) returns varchar(200) parameter style java no
sql language java external name 'StripTag.MethodStripTag';
  }}}
  {{{
  Function name   :strSet
@@ -478, +511 @@

  input:string , char
  return:String
  
- This function takes a string and character as input and returns a string re writed with
that
+ This function takes a string and character as input and returns a string re writed with
that input argument.
  
- input argument.
+ Create function statement:
+ create function StrSet(str varchar(200)) returns varchar(200) parameter style java no sql
language java external name 'StrSet.convert';
  }}}
  {{{
  Function name   :convert
@@ -491, +525 @@

  This function takes a string as input and returns a string with the first letter changed
to
  
  uppercase. This function can be made useful in cases like formatting names etc.
+ 
+ Create function statement:
+ create function UppercaseFirst(str varchar(200)) returns varchar(200) parameter style java
no sql language java external name 'UppercaseFirst.convert';
  }}}
  {{{
  Function name   :bitAnd

Mime
View raw message