SQL Language (MOSC)

MOSC Banner

plsql block in shell script

edited Jan 25, 2015 10:00AM in SQL Language (MOSC) 1 commentAnswered

Hi,

I need to write   a shell script like below

please help me completing this script ,

not allowed to write procedure as it will be a db object.

not sure about the construction and the approach of the  programme

===================================================

$ORACLE_HOME/bin/sqlplus  user/passwd <<EOF

declare

v_status  varchar2(30)

v_sttm  date;

v_endtm  date

v_dur  varchar2(30)

begin

select status into v_status  from batch_info where id = 1234 ;

if v_status = 'COMPLETE'

select starttime, endtime ,  duration

into sttm, endtm, dur

from batch_info where id = 1234 ;

dbms_output.put_line (||sttm||' '||endtm||' '||duration);

else

dbms_output.put_line (||v_status);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center