Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

executing a function in sql plus

I created a function in oracle that inserts records in specific tables and return an output according to what occurs within the function. e.g (ins_rec return number)

How do I call this function and see its output in sql plus

like image 555
maher Avatar asked Feb 26 '11 14:02

maher


People also ask

How do you call a function in SQL Developer?

About calling a FUNCTION, you can use a PL/SQL block, with variables: SQL> create or replace function f( n IN number) return number is 2 begin 3 return n * 2; 4 end; 5 / Function created. SQL> declare 2 outNumber number; 3 begin 4 select f(10) 5 into outNumber 6 from dual; 7 -- 8 dbms_output.


2 Answers

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

Alternatively:

select myfunc(myargs) from dual; 
like image 131
GriffeyDog Avatar answered Sep 21 '22 03:09

GriffeyDog


One option would be:

SET SERVEROUTPUT ON  EXEC DBMS_OUTPUT.PUT_LINE(your_fn_name(your_fn_arguments)); 
like image 34
cagcowboy Avatar answered Sep 22 '22 03:09

cagcowboy