Pierre-olivier Gendraud
Pierre-olivier Gendraud

Reputation: 1897

How to use a sql plus variable when calling a script?

I want to execute a powershell script from sqlplus which use a the variable a. As you can see if you execute this code, a isn't recognized. I would like this code to print 22, not a or :a

variable a varchar2;
a='22'
host powershell.exe echo :a
host powershell.exe echo a

:a

a

Upvotes: 0

Views: 95

Answers (1)

Alex Poole
Alex Poole

Reputation: 191275

You could use a substitution variable:

define a=22

host powershell.exe echo &a

If you already have the bind variable defined and populated by a process you don't want to change, you can set the substitution variable value using a dummy query and column ... new_value syntax.

Upvotes: 1

Related Questions