Home » SQL & PL/SQL » SQL & PL/SQL » Query Execution in UNIX AIX system
Query Execution in UNIX AIX system [message #256269] Fri, 03 August 2007 11:07 Go to next message
prashanth_gs
Messages: 67
Registered: November 2005
Location: chennai
Member
Hi all,

We want to get snap id after taking the snapshot with the statspack

Following is the query:

SnapId=`sqlplus -s /nolog <<EOF
whenever sqlerror exit failure
connect $User/$Pwd@$DBName
SET FEEDBACK OFF;
SET TERMOUT OFF;
SET ECHO OFF;
set serveroutput on;
DECLARE
snap INTEGER;
BEGIN
snap := statspack.snap;
DBMS_OUTPUT.PUT_LINE(snap);
END;
/
exit;


This piece of code is working fine for the Korn shell in Unix, while we try to migrate the code to UNIX AIX system, then
the problem starts bcos its not executing the pl/SQL block. Is there any settings or plsql statements has to be modified to make it executable in UNIX AIX system.

What would be the issue.

Thanks and Regards,
Prashanth.g.s.
Re: Query Execution in UNIX AIX system [message #256271 is a reply to message #256269] Fri, 03 August 2007 11:11 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>This piece of code is working fine for the Korn shell in Unix,
I don't believe as posted!
It seems to be missing closing back tic/quote mark & terminating EOF.

Are you incapable or unwilling to simply use CUT & PASTE to allow us to actually see what is happening rather than depnding upon you to accurately report reality?
Re: Query Execution in UNIX AIX system [message #256277 is a reply to message #256271] Fri, 03 August 2007 11:24 Go to previous messageGo to next message
prashanth_gs
Messages: 67
Registered: November 2005
Location: chennai
Member
Sorry, Can you please check now the syntax:

SnapId=sqlplus -s /nolog <<EOF
whenever sqlerror exit failure
connect $User/$Pwd@$DBName
SET FEEDBACK OFF;
SET TERMOUT OFF;
SET ECHO OFF;
set serveroutput on;
DECLARE
snap INTEGER;
BEGIN
snap := statspack.snap;
DBMS_OUTPUT.PUT_LINE(snap);
END;
/
exit;
EOF
Re: Query Execution in UNIX AIX system [message #256279 is a reply to message #256277] Fri, 03 August 2007 11:30 Go to previous messageGo to next message
prashanth_gs
Messages: 67
Registered: November 2005
Location: chennai
Member
Can you please replace the correct code if anything is wrong on the above posted code.

Thanks and Regards,
prashanth
Re: Query Execution in UNIX AIX system [message #256280 is a reply to message #256269] Fri, 03 August 2007 11:32 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
So?
You are you creating an environmental variable "SnapId"?
Am I supposed to be impressed?

SnapId=Useless


cat abc.sh
MINUS_DAY=2
sqlplus << EOF
/ as sysdba
set term on echo on
select trunc(sysdate-${MINUS_DAY}) from dual;
exit 
EOF

Previous Topic: Exclusive Select By Historical Data
Next Topic: Why this random drawing doesn't do the thing intended
Goto Forum:
  


Current Time: Fri Dec 06 14:20:53 CST 2024