passing variables from shell script to separate sqlplus script
Hi, I am having issues passing variables to a separate sqlplus script invoked by the shell script, e.g.
#!/bin/sh
DB_NAME=TEST
PWD1=PA55W0rd
echo exit | sqlplus / as sysdba @${DB_NAME}.sql ${DB_NAME} $PWD1 >> ${DB_NAME}.sql
exit 0
The script picks up the $DB_NAME variable fine, and therefore invokes the required sql script.
However, when I pass the variable $PWD1 to the sql script I get an error.
The script creates a database link:
create or replace procedure new.link
is
begin
execute immediate 'create database link TEST
connect to TESTSCH identified by '$PWD1'
using ''TEST''';
end;
/
exec new.link;
/
output is:
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at "NEW.LINK", line 4
ORA-06512: at line 1
any help appreciated!
Edited by: 969765 on Apr 5, 2013 4:24 AM