How to execute a oracle procedure from shell

14,729

Connect Oracle using SqlPlus, then run the procedure like this:

execute package_name.procedure_name (parameters...)

If you want to call sqlplus from within Windows shell:

@echo execute some_procedure | sqlplus username/password@databasename

(See this question )

On Unix, try this:

echo "execute <some_procedure>" | sqlplus -s username/password@host:1521/service 
Share:
14,729
lucifer
Author by

lucifer

Updated on June 04, 2022

Comments

  • lucifer
    lucifer almost 2 years

    I have a stored procedure in oracle i want to call that procedure from cygwin. This is the procedure

    CREATE OR REPLACE PROCEDURE greetings
    AS
    BEGIN
     dbms_output.put_line('Hello World!');
     END;
    

    i am doing this

    sqlplus -s system@orcl/oracle10g<<END
    execute greetings();
    commit;
    exit;
    END