Home » SQL & PL/SQL » SQL & PL/SQL » How to pass value from host command to PL/SQL block?
How to pass value from host command to PL/SQL block? [message #2798] Wed, 14 August 2002 01:14 Go to next message
didier
Messages: 3
Registered: August 2002
Junior Member
hy,
how to have the result of a host command in a variable in a pl/sql function block?
In a query result, i need to used a host command to calculate a column. so i try to make a function but how take the result in the block?

regards
didier
Re: How to pass value from host command to PL/SQL block? [message #2799 is a reply to message #2798] Wed, 14 August 2002 01:55 Go to previous messageGo to next message
santosh
Messages: 85
Registered: October 2000
Member
hi,
From which host environment are you calling the function. I mean to ask that are you calling a function in another plsql block or through vb program or java program or c program.Please be more specific cause everywhere you got different methods for calling plsql function with parameters.

Santosh
Re: How to pass value from host command to PL/SQL block? [message #2803 is a reply to message #2798] Wed, 14 August 2002 03:51 Go to previous messageGo to next message
Gilbey
Messages: 87
Registered: March 2002
Member
Try this way..
SQL> variable a number;
SQL> begin
2 :a:=10;
3 end;
4 /

PL/SQL procedure successfully completed.

SQL> declare
2 x number(2);
3 begin
4 x:=:a;
5 end;
6 /

PL/SQL procedure successfully completed.

SQL> ed
Wrote file afiedt.buf

1 declare
2 x number(2);
3 begin
4 x:=:a;
5 dbms_output.put_line('The value of x taken from host variable is ->'||x);
6* end;
SQL> set serveroutput on
SQL> declare
2 x number(2);
3 begin
4 x:=:a;
5 dbms_output.put_line('The value of x taken from host variable is ->'||x);
6 end;
7 /
The value of x taken from host variable is ->10

PL/SQL procedure successfully completed.

SQL>
Re: How to pass value from host command to PL/SQL block? [message #2806 is a reply to message #2798] Wed, 14 August 2002 06:02 Go to previous messageGo to next message
didier
Messages: 3
Registered: August 2002
Junior Member
thanks
but the problem is not exactly that....
in this
SQL> variable a number;
SQL> begin
2 :a:=10;
3 end;
4 /
you put 10 in a or a in x in the rest of your example
but i want to put the result of the plsql command 'host' (you can execute this cmd in 'host grep pierre pierre.txt')

thanks
Re: How to pass value from host command to PL/SQL block? [message #2814 is a reply to message #2798] Wed, 14 August 2002 09:17 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
u have to use external procedure (pro*c) or
utl_file for this.
Previous Topic: Re: Summing up data by quarters
Next Topic: SQL Plus environment setting
Goto Forum:
  


Current Time: Wed Apr 24 20:49:14 CDT 2024