Solved

How to Call Oracle stored function within shell script

Posted on 2004-11-02
250 Views
Last Modified: 2013-12-26
I am trying to write a shell script that should call an Oracle stored function. Some values needs to be passed to this function, and it would also return one value. Please help me on it.
0
Question by:taniatangri
    4 Comments
     
    LVL 12

    Accepted Solution

    by:
    Hi taniatangri,
    Use sqlplus:

    sqlplus login/password@instance << EOL
    begin
        ...
    end
    /
    quit
    EOL


    Cheers!

    Stefan
    0
     
    LVL 12

    Expert Comment

    by:stefan73
    (Be aware that anyone can see your user and password using the "ps" tool this way)
    0
     
    LVL 20

    Assisted Solution

    by:dsacker
    You can also hide your logon/password with the following:

    sqlplus /nolog << EOL
    connect login/password@instance
    declare
        return_value    varchar2(32);    -- change the type if you are returning another type
    begin
        return_value := my_stored_function(passed_value1, passed_value2);
    end;
    /
    quit
    EOL
    0
     
    LVL 16

    Expert Comment

    by:manav_mathur
    Taniatangri,

    Do you want to pass UNIX variables to your Oracle SP??
    and do you want the oracle returned values in UNIX too?? Coz then the scenario changes

    Manav
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Title # Comments Views Activity
    Error on moodle after upgrade 3 85
    Folder Comparison 12 49
    substring method in java 1 49
    move a line in eclipse 3 42
    Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now