Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to execute an function from the commandline?
You can use SQL*Plus variable:
v734> CREATE OR REPLACE FUNCTION TEST(a VARCHAR2) RETURN NUMBER IS
2 i NUMBER;
3 BEGIN
4 SELECT COUNT(*) INTO i FROM dual;
5 RETURN i;
6 END TEST;
7 /
Function created.
v734> var nb number
v734> exec :nb := test('Hello');
PL/SQL procedure successfully completed.
v734> print nb
NB
1
--
Have a nice day
Michel
Dirk Joosen <d.joosen_at_planetinternet.nl> a écrit dans le message :
3832B96B.3A996A55_at_REMOVETHIS.planetinternet.nl...
> Hello
>
> I don't no if it works but I have wrote an function and I want to test
> if it works can I run from the commandline?
>
> Here is an example (for me to check if it works) what doesn't run
> CREATE OR REPLACE FUNCTION TEST(a VARCHAR2) RETURN NUMBER IS
> i NUMBER;
> BEGIN
> SELECT COUNT(*) INTO i FROM SOA;
> RETURN i;
> END TEST;
> /
>
> I type from the command line EXEC TEST('Hello')
> It won't execute it give me an error
> begin test('hallo'); end;
>
> *
> ERROR at line 1:
> ORA-06550: line 1, column 7:
> PLS-00221: 'TEST' is not a procedure or is undefined
> ORA-06550: line 1, column 7:
> PL/SQL: Statement ignored
>
> Can some give me a helpful hint, regards Dirk
>
Received on Wed Nov 17 1999 - 09:57:22 CST
![]() |
![]() |