0

I have created a simple procedure with date as parameter in oracle. I need to call this procedure from shell, how do I call the procedure ? pseudo code is

CREATE OR REPLACE
 procedure  my_procedure (date1 IN date )
 begin
  delete from Result_table;
  make different calculations from different tables, insert values row by row in 
  Result_table;
 end;

1 Answers1

1

In one line you can run

sqlplus user/password@db <<< "exec my_procedure(SYSDATE);"
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • Also see alternatives here: [sqlplus statement from command line](https://stackoverflow.com/questions/1639704/sqlplus-statement-from-command-line) – Hilarion May 18 '18 at 13:58
  • And here: [How can I issue a single command from the command line through sql plus?](https://stackoverflow.com/questions/638705/how-can-i-issue-a-single-command-from-the-command-line-through-sql-plus) – Hilarion May 18 '18 at 14:01
  • And here: [Sqlplus oracle : How can I run sql command on bash in 1 line?](https://stackoverflow.com/questions/11237824/sqlplus-oracle-how-can-i-run-sql-command-on-bash-in-1-line) – Hilarion May 18 '18 at 14:01
  • As all those revolve around using SQL*Plus command line application in various ways, I have to also say, that you can use any kind of Oracle client application, which can be called from command line. One of those would be [Oracle SQL Developer Command Line (SQLcl)](https://blogs.oracle.com/proactivesupportdevtools/oracle-sql-developer-command-line-sqlcl-overview). – Hilarion May 18 '18 at 14:05
  • 3
    @Hilarion : Shouldn't all these comments of yours posted on the question's comment section rather than this answer's? – Kaushik Nayak May 18 '18 at 14:57
  • @KaushikNayak: I was referring to using SQL*Plus, as in the answer, in some slightly different ways. Although I did mention some other tool, but it does not significantly deviate from the answer itself. I'd rather comment on the question, when I have doubts around the question itself, or suggesting looking at the problem from a different angle (i.e. asking a different question). – Hilarion May 18 '18 at 18:26