Database Guide : Appendixes : Function Calls using Native Oracle
Function Calls using Native Oracle
An Oracle function is a PL/SQL construct, similar to a stored procedure but returns a value. Some databases make heavy use of functions to contain a single business rule or single-row query. In the past, functions, from within Oracle, needed to be wrappered by a stored procedure to be callable from VA Smalltalk. VA Smalltalk now provides an AbtFunctionSpec class where the user specifies the function name and parameters. The return value of the function spec is the return value of the function itself.
These examples were done with ‘Oracle Database 10g Enterprise Edition Release 10.2.0.1.0’, ‘Oracle Database 11 (version 11.1.0.6.0)’, and VA Smalltalk 8.0.1. The following is shown/discussed:
Function with a string as a parameter and returns a string
Function that has an integer as an ‘in’ parameter and returns a float
A no parameter function that returns a string
A function that has a timestamp as a parameter and returns a timestamp
The following assumptions are made:
The reader has Oracle installed and has the proper permissions. I logged in as ‘System’ and did the following ‘grant’ (check with your administrator to see which grants you need):
 
GRANT create session, alter session, create table,
create view, create procedure, create trigger, create library,
create tablespace, alter tablespace, drop tablespace,
execute any procedure, unlimited tablespace, create public synonym,
drop public synonym, create sequence
to <username>;
 
The user has the Native Oracle 10 feature loaded into their Smalltalk image.
The user has created an access set and is able to log into Oracle from the Smalltalk image.
The user has a good working knowledge of Smalltalk and knows how to execute and inspect Smalltalk scripts.
Last modified date: 02/27/2021