Sheel Script

22/01/2014

0

SQL

Bom Tarde Pessoal! Tem algumas parte do código que tem ${Descrição}, O queria seria isso ? E onde posso configura-lo ?

#!/usr/bin/bash
#. $HOME/.profile
#DENTRO DE UN BUCLE QUE SE EJECUTA CADA 10 MIN MIENTRAS QUE EXISTA ALGUN IND_EXTRAC_FINALIZADA =0
#recibe la periodicidad (DIA o MES)
. /odscore/bin/mx_ods.cfg
FECHAHORA=`date '+%Y%m%d%H%M%S'$$`
echo $FECHAHORA
echo LOG $LOG
echo $FECHAHORA >> $/salida_extracc_$.txt
PROCESO_SH="sp_he0_detect_inf_ext.sh"
PROCESO_PL="EXTRACCION"
FICHERO_TXT="5"

sqlplus -s $ << ENDSQL2
SET SERVEROUTPUT ON SIZE 1000000
SET TIME ON
SET TIMING ON
SET ECHO ON
spool $/extraccion_$1_$3_$4_$_$2.txt
whenever sqlerror exit 9
whenever oserror exit 1
define   x=0
VARIABLE p_error_code  NUMBER;
col      x  new_value  bye
declare Fecha_Ejecucion date;
cod_error number :=0;
BEGIN
:p_error_code :=0;
Pck_Ods_Control_Cargas_Tabla.SP_HE0_DETECT_INF_EXT_TABLA('$' ,$1, '$','$','$','$', :p_error_code);
commit;
END;
/
spool off
set termout off
select :p_error_code x from dual
/
exit &bye;
ENDSQL2
retorno=$?
echo $ >> $/salida_extracc_$.txt
if [ $ = 0 ]; then
    if [ $ = 0 ]; then
       cp $/lanza_spool_$_*.spo $
       retorno=$?
    fi
       echo $retorno >> $/salida_extracc_$.txt
    if [ $ = 0 ]; then       
       cp $/*.qry $
       retorno=$?
    fi       
       echo $retorno >> $/salida_extracc_$.txt
    if [ $ = 0 ]; then
       cp $/*.cnt $
       retorno=$?
    fi       
       echo $retorno >> $/salida_extracc_$.txt
       
       chmod 777 $/*.qry
       echo $retorno >> $/salida_extracc_$.txt
       chmod 777 $/*.cnt
       echo $retorno >> $/salida_extracc_$.txt
       chmod 777 $/lanza_spool_$_*.spo
       echo $retorno >> $/salida_extracc_$.txt
       
       for shell in `ls -1 $/lanza_spool_$_*.spo`; do
    echo $shell
          echo $shell >> $/salida_extracc_$.txt
          echo $retorno >> $/salida_extracc_$.txt
          if [ $ = 0 ]; then
#             $shell &
             $shell
             retorno=$?
          fi               
       done
#       wait
fi
if  [ $retorno != "0" ]; then
$/ms0_envia_mail_ODS.sh $1 "$PROCESO_SH" "$PROCESO_PL" $3 $4 "$FICHERO_TXT" $retorno $2
fi
exit $retorno

#FIN DEL BUCLE


Alan Miranda

Alan Miranda

Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar