executing a function in sql plus executing a function in sql plus oracle oracle

executing a function in sql plus


declare  x number;begin  x := myfunc(myargs);end;

Alternatively:

select myfunc(myargs) from dual;


One option would be:

SET SERVEROUTPUT ONEXEC DBMS_OUTPUT.PUT_LINE(your_fn_name(your_fn_arguments));


As another answer already said, call select myfunc(:y) from dual; , but you might find declaring and setting a variable in sqlplus a little tricky:

sql> var y numbersql> begin  2  select 7 into :y from dual;  3  end;  4  /PL/SQL procedure successfully completed.sql> print :y         Y----------         7sql> select myfunc(:y) from dual;