This discussion is archived
1 2 Previous Next 20 Replies Latest reply: Mar 23, 2013 10:06 PM by sb92075 RSS

Problem to pass Oracle variable to Unix

jmft2012 Explorer
Currently Being Moderated
11gr2

Problem to pass Oracle variable to Unix
refer to echo $x
in korn shell

$cat /tmp/x.sh
"/tmp/x.sh" 11 lines, 208 characters 
#!/bin/ksh

x=`sqlplus -s myacc/myacc <<endl
set echo off verify off feed off termout off pages 0
SELECT p.spid
FROM v$session s, v$process p
WHERE s.paddr = p.addr
AND s.sid =2;
exit
endl`

. /tmp/x.sh

$ echo $x    
FROM v s, v p check_logfiles._var_adm_kernlog.seek csn.16 myspid.sh pw_management ssh-BbLO7942 x.sh ERROR at line 2: ORA-04044: procedure, function, package, or type is not allowed here
use sqlplus
sql> select p.spid
  2  FROM v$session s, v$process p
  3  WHERE s.paddr = p.addr
  4  AND s.sid =2;


SERVER
PID
------
22965
Edited by: jmft2012 on Mar 23, 2013 9:23 PM
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points