Don't know much about oscript, but I do know about pl/sql (sounds like a techie version of "What a Wonderful World it Would Be").
If you write a stored function in pl/sql, you can then use it in your straight SQL. Eg a function called Get_Age(My_Birthday) would be used in SQL like this...
select Get_Age('01-01-1994')
from dual;
...would retrieve the number 21 (I wish). This works in SQL*Plus, which is very primitive, so it should work from oscript. Try it with something simple.