We help IT Professionals succeed at work.

CALLING A SIMPLE ORACLE FUNCTION FROM SHELL SCRIPT

NUCLEARE
NUCLEARE asked
on
Hi
I need a little example to call a simple function (example like a sum function) where
i pass two parameter and i get the sum result inside the shell script to work with it

it's better put all the code inside ksh file o call separately a sql that return the result to
the shell script

Comment
Watch Question

CERTIFIED EXPERT
Commented:
you can use sqlplus  as stated here
https://forums.oracle.com/forums/thread.jspa?threadID=621681
and to be more specific here
"
If you must use an argument to sqlplus, you could write a generic script like this one called foo.sql:

spool bar.sql
prompt &1
spool off
@bar

Than you could call it like so:

$ sqlplus scott/tiger @foo "select 1 from dual;"

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Feb 22 13:22:19 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.

select 1 from dual;

1
"
so you substitute this prompt with your arguments.

hope that helps

Explore More ContentExplore courses, solutions, and other research materials related to this topic.