Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Function vs Function()-no input parms-
A copy of this was sent to Richard Elliott <bullseye_at_flash.net>
(if that email address didn't require changing)
On Sat, 10 Apr 1999 00:13:27 GMT, you wrote:
>I gave it a try, but same result as the other attempts I have made. I can run
>it as test_function or test_function('') but not as test_function(). I can not
>use the parens, but if I do use them I must supply a value or I get "illegal
>function". I remain truly baffeled by this one, but thanks for trying !
>
In 7.x, i don't think you'll be able to do this. In 8.x, you can (the addition of the object stuff had them rewrite lots of the parser).
Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production With the Partitioning and Objects options PL/SQL Release 8.0.3.0.0 - Production
SQL> create function foo return number
2 as
3 begin return 1;
4 end;
5 /
Function created.
SQL> select foo() from dual;
FOO()
1
>Richard Elliott wrote:
>
>> Thanks Bill, I'll give it a try!
>>
>> Bill Frost wrote:
>>
>> > You should do something like this:
>> >
>> > function test_func (junk varchar2 default '') return varchar2
>> > is
>> > begin
>> > return 'test_func was here';
>> > end;
>> >
>> > ---------
>> > Then, you invoke it with test_func()
>> >
>> > :)BF
>> >
>> > Richard Elliott <bullseye_at_flash.net> wrote in message
>> > news:370BF4E9.12CFDED5_at_flash.net...
>> > > I wrote a function to return a specific table/row/column. It needs no
>> > > input parms. To execute this function I just reference it in the sql
>> > > directly. ie
>> > >
>> > > select get_accounting_date from dual;
>> > >
>> > > The problem, a small but annoying one, is I want it to look like a
>> > > function, ie
>> > > select get_accounting_date() from dual;
>> > >
>> > > The way it is now it looks like a column name, not a function. I have
>> > > tried default null parms but then I am forced to supply a value in the
>> > > reference ie
>> > > select get_accounting_date(' ') from dual.
>> > > There has to be a solution, other functions work the way I would like
>> > > this one to, like sysdate() etc...
>> > > I have quite a few of these and I would really like for the SQL to be
>> > > more readable by using the () with every function.
>> > > I really have tried everything I can think of to get it to work with
>> > > select get_accounting_date().
>> > >
>> > > Thanks in advance for your help.
>> > >
>> > >
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |