error in sql plus in executing large string header - shell

I am getting this error in sql plus after executing this script . This is header of a file with >150 columns.I tried other options like
rtrim (xmlagg (xmlelement (e, x || '|')).extract ('//text()'), '|')
but no luck.
SP2-0027: Input is too long (> 2499 characters) - line ignored
abc.sh
sqlplus -s /nolog << EOF
connect abc/pwd#orcl;
whenever sqlerror exit sql.sqlcode;
set wrap ON
set trimout ON
set trimspool on
set serveroutput on
set pagesize 0
set long 20000000
set longchunksize 20000000
set linesize 4000
spool abc.sql
select TO_CLOB('SCSTSUMID|IMAILSUMID|FTOMERSUMKY|FGHERNAME|EILSUMADDR|FSTSUMNM|MIHZDLESUMNM|LZSTSUMNM|PRIMSUMADDR|SECSUMADDR|CITY|STATE|POSTALSUMCD|ISOSUMCODE|UNIVSUMDCOM|UNIVSUMDCOMSUMALWSUM13T17|UNIVSUMDCOMSUMALWSUMCAN|UNIVSUMDCOMSUMALWSUMCANSUM13T17|UNIVSUMPRTR|UNIVSUMPRTRSUMALWSUM13T17|UNIVSUMPRTRSUMALWSUMCAN|UNIVSUMPRTRSUMALWSUMCANSUM13T17|UNIVSUMSHOP|UNIVSUMDCOMSUMALWSUMUKDB|UNIVSUMLIVESUMCOMBINE|UNIVSUMLIVESUMDRAFT|UNIVSUMLIVESUMKICKOFF|UNIVSUMLIVESUMISGUKSUMUKDB|UNIVSUMLIVESUMISGUKSUMNOSUMUKDB|UNIVSUMLIVESUMISGMX|UNIVSUMLIVESUMPROBOWL|UNIVSUMLIVESUMSUPERBOWL|UNIVSUMDCOMSUMRECURR|UNIVSUMDCOMSUMRECURRSUM13T17|UNIVSUMDCOMSUMALWSUMHOLDOUT|UNIVSUMDCOMSUMRCRSUMALWSUMHLDOUT|AGE|GENDER|BIRTHSUMDT|CUSTSUMRECENCYSUMDT|HISPANICSUMFLG|FAVSUMTEAMSUMCD|ACTIVESUM0SUM3MSUMFLG|ACTIVESUM4SUM6MSUMFLG|ACTIVESUM7SUM9MSUMFLG|ACTIVESUM10SUM12MSUMFLG|ACTI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USTERSUMN|CLUSTERSUMPNL|LSTSUMPBSUMFMPSUMSSN|EXTRACTSUMSEQ|HASDKSUMPROBS|SBSPNDSUMPROBS|DRAFTEDSUMFLG|EMAILSUMTIER|TSPSUMZIPSUMCD|TSPSUMSTATESUMABBREVIATION|TSPSUMADDRSUMTYPE|TSPSUMADVSUMHMSUMOWNR|TSPSUMADVSUMHHSUMSIZE|TSPSUMADVSUMHHSUMSIZESUMINDICATOR|TSPSUMADVSUMHHSUMMARITALSUMSTATUS|TSPSUMADVSUMHHSUMMARITALSUMSTATSUMIND|TSPSUMADVSUMDWELLINGSUMTYPE|TSPSUMADVSUMDWELLINGSUMTYPESUMIND|TSPSUMADVSUMTARGETSUMINCOMESUM2|TSPSUMADVSUMTARGETSUMINCOMESUMINDSUM2|TSPSUMADVSUMHHSUMEDUCATION|TSPSUMADVSUMHHSUMEDUCATIONSUMINDICATOR|TSPSUMAGESUMUNK|TSPSUMAGESUM75SUMPLUS|TSPSUMAGESUM65SUM74|TSPSUMAGESUM55SUM64|TSPSUMAGESUM45SUM54|TSPSUMAGESUM35SUM44|TSPSUMAGESUM25SUM34|TSPSUMAGESUM18SUM24|TSPSUMCHILDRENSUMAGESUM0SUM2|TSPSUMCHILDRENSUMAGESUM3SUM5|TSPSUMCHILDRENSUMAGESUM6SUM10|TSPSUMCHILDRENSUMAGESUM11SUM15|TSPSUMCHILDRENSUMAGESUM16SUM17|TSPSUMHHSUMTYPESUMFAMILYSUMCOMP|TSPSUMOCCUPATION|TSPSUMGENDERSUMPRSN|TSPSUMETHNICSUMGRP|TSPSUMETHNICSUMGRPSUMPRSN|TSPSUMLANGUAGESUMPRSN|TSPSUMTARGETSUMVALUESCORESUM2|TSPSUMCCSUMAMERSUMEXPRESS|TSPSUMCCSUMANYSUMCC|TSPSUMCCSUMBANKSUMCARD|TSPSUMCCSUMCATALOGSUMSHOWROOM|TSPSUMCCSUMCOMPUTERSUMELECTRONIC|TSPSUMCCSUMDEBITSUMCARD|TSPSUMCCSUMFINANCESUMCOSUMCARD|TSPSUMCCSUMFURNITURE|TSPSUMCCSUMGROCERY|TSPSUMCCSUMHMSUMIMPROVEMENT|TSPSUMCCSUMHMSUMOFFICESUMSUPPLY|TSPSUMCCSUMLOWSUMENDSUMDEPTSUMSTORE|TSPSUMCCSUMMAINSUMSTREETSUMRETAIL|TSPSUMCCSUMMASTERCARD|TSPSUMCCSUMMBRSHPSUMWHS|TSPSUMCCSUMMISC|TSPSUMCCSUMOILSUMGASSUMCARD|TSPSUMCCSUMSPECIALTYSUMAPPAREL|TSPSUMCCSUMSPORTINGSUMGOODS|TSPSUMCCSUMSTANDARDSUMRETAIL|TSPSUMCCSUMSTANDARDSUMSPECIALTYSUMCARD|TSPSUMCCSUMTRAVELSUMENTERTAINMENT|TSPSUMCCSUMTVSUMMAILSUMORDER|')||'TSPSUMCCSUMUPSCALESUMRETAIL|TSPSUMCCSUMUPSCALESUMSPECSUMRETAIL|TSPSUMCCSUMVISA|TSPSUMMTSUMFOOTBALLSUMENTHUSIASTS|TSPSUMMTSUMSMARTSUMPHONESUMUSER|TSPSUMMTSUMHIGHENDSUMAMSUMRANKSUMTM2|FANTSUMOPPSUMTEAMSUMNMSUMTM2|FANTSUMOPPSUMTEAMSUMRANKSUMTM2|FANTSUMLEAGUESUMIDSUMTM3|FANTSUMTEAMSUMIDSUMTM3|FANTSUMTEAMSUMNMSUMTM3|FANTSUMTEAMSUMRANKSUMTM3|FANTSUMOPPSUMTEAMSUMNMSUMTM3|FANTSUMOPPSUMTEAMSUMRANKSUMTM3|JEBBITSUMATTRIB13SUMFLG|JEBBITSUMATTRIB12SUMFANTSUMFLG|JEBBITSUMATTRIB11SUMKIDSSUMFLG|MSSUMONSUMLOCATION|MSSUMBARCLAY|BARCLAYSUMPASSIONSUMJETSETSUMIND|BARCLAYSUMPASSIONSUMELECSUMIND|BARCLAYSUMPASSIONSUMEGOERSUMIND|LSTSUMGPDSUMSTREAMSUMDT|GPDSUMMINSUMWATCHEDSUMCURRSUMSSN|GPDSUMMINSUMWATCHEDSUMPREV1SUMSSN|GPDSUMMINSUMWATCHEDSUMPREV2SUMSSN|FAVSUMTEAMSUMCDSUMIMPLIED|FAVSUMTEAMSUMCDSUMSUPPLIED|EXTRACTSUMDT' x from dual ;
spool off;
exit;
EOF
any suggestions will be highly appreciated.

You are hitting a physical limit on the length of a line of SQL in SQL*Plus. See this posting for more information on how to resolve: https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4789399600346029472
Basically you're going to have to break up your input text with line breaks and concatenate the individual lines, like this:
abc.sh
sqlplus -s /nolog << EOF
connect abc/pwd#orcl;
whenever sqlerror exit sql.sqlcode;
set wrap ON
set trimout ON
set trimspool on
set serveroutput on
set pagesize 0
set long 20000000
set longchunksize 20000000
set linesize 4000
spool abc.sql
select TO_CLOB('SCSTSUMID|IMAILSUMID|FTOMERSUMKY|FGHERNAME|EILSUMADDR|FSTSUMNM|MIHZDLESUMNM|LZSTSUMNM|PRIMSUMADDR|SECSUMADDR|CITY|STATE|POSTALSUMCD|ISOSUMCODE|UNIVSUMDCOM|UNIVSUMDCOMSUMALWSUM13T17|UNIVSUMDCOMSUMALWSUMCAN|UNIVSUMDCOMSUMALWSUMCANSUM13T17|UNIVSUMPRTR|UNIVSUMPRTRSUMALWSUM13T17|UNIVSUMPRTRSUMALWSUMCAN|UNIVSUMPRTRSUMALWSUMCANSUM13T17|UNIVSUMSHOP|UNIVSUMDCOMSUMALWSUMUKDB|UNIVSUMLIVESUMCOMBINE|UNIVSUMLIVESUMDRAFT|UNIVSUMLIVESUMKICKOFF|UNIVSUMLIVESUMISGUKSUMUKDB|'
|| 'UNIVSUMLIVESUMISGUKSUMNOSUMUKDB|UNIVSUMLIVESUMISGMX|UNIVSUMLIVESUMPROBOWL|UNIVSUMLIVESUMSUPERBOWL|UNIVSUMDCOMSUMRECURR|UNIVSUMDCOMSUMRECURRSUM13T17|UNIVSUMDCOMSUMALWSUMHOLDOUT|UNIVSUMDC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MPAGEVISITSUMLSTSUMACTIVITYSUMDT|NFLNSUMAAMSUMSEGMENTSUMFLG|CURRSUMSSNSUMVIDEOSUMVIEWSSUMFLG|'
|| 'GPDSUMSTATUS|GPISUMSTATUS|GPESUMSTATUS|MXSUMOPTSUMINSUMFLAG|DESUMOPTSUMINSUMFLAG|CASUMOPTSUMINSUMFLAG|UKSUMOPTSUMINSUMFLAG|CLUSTERSUMN|CLUSTERSUMPNL|LSTSUMPBSUMFMPSUMSSN|EXTRACTSUMSEQ|HASDKSUMPROBS|SBSPNDSUMPROBS|DRAFTEDSUMFLG|EMAILSUMTIER|TSPSUMZIPSUMCD|TSPSUMSTATESUMABBREVIATION|TSPSUMADDRSUMTYPE|TSPSUMADVSUMHMSUMOWNR|TSPSUMADVSUMHHSUMSIZE|TSPSUMADVSUMHHSUMSIZESUMINDICATOR|TSPSUMADVSUMHHSUMMARITALSUMSTATUS|TSPSUMADVSUMHHSUMMARITALSUMSTATSUMIND|TSPSUMADVSUMDWELLINGSUMTYPE|'
|| 'TSPSUMADVSUMDWELLINGSUMTYPESUMIND|TSPSUMADVSUMTARGETSUMINCOMESUM2|TSPSUMADVSUMTARGETSUMINCOMESUMINDSUM2|TSPSUMADVSUMHHSUMEDUCATION|TSPSUMADVSUMHHSUMEDUCATIONSUMINDICATOR|TSPSUMAGESUMUNK|TSPSUMAGESUM75SUMPLUS|TSPSUMAGESUM65SUM74|TSPSUMAGESUM55SUM64|TSPSUMAGESUM45SUM54|TSPSUMAGESUM35SUM44|TSPSUMAGESUM25SUM34|TSPSUMAGESUM18SUM24|TSPSUMCHILDRENSUMAGESUM0SUM2|TSPSUMCHILDRENSUMAGESUM3SUM5|TSPSUMCHILDRENSUMAGESUM6SUM10|TSPSUMCHILDRENSUMAGESUM11SUM15|TSPSUMCHILDRENSUMAGESUM16SUM17|'
|| 'TSPSUMHHSUMTYPESUMFAMILYSUMCOMP|TSPSUMOCCUPATION|TSPSUMGENDERSUMPRSN|TSPSUMETHNICSUMGRP|TSPSUMETHNICSUMGRPSUMPRSN|TSPSUMLANGUAGESUMPRSN|TSPSUMTARGETSUMVALUESCORESUM2|TSPSUMCCSUMAMERSUMEXPRESS|TSPSUMCCSUMANYSUMCC|TSPSUMCCSUMBANKSUMCARD|TSPSUMCCSUMCATALOGSUMSHOWROOM|TSPSUMCCSUMCOMPUTERSUMELECTRONIC|TSPSUMCCSUMDEBITSUMCARD|TSPSUMCCSUMFINANCESUMCOSUMCARD|TSPSUMCCSUMFURNITURE|TSPSUMCCSUMGROCERY|TSPSUMCCSUMHMSUMIMPROVEMENT|TSPSUMCCSUMHMSUMOFFICESUMSUPPLY|TSPSUMCCSUMLOWSUMENDSUMDEPTSUMSTORE|'
|| 'TSPSUMCCSUMMAINSUMSTREETSUMRETAIL|TSPSUMCCSUMMASTERCARD|TSPSUMCCSUMMBRSHPSUMWHS|TSPSUMCCSUMMISC|TSPSUMCCSUMOILSUMGASSUMCARD|TSPSUMCCSUMSPECIALTYSUMAPPAREL|TSPSUMCCSUMSPORTINGSUMGOODS|TSPSUMCCSUMSTANDARDSUMRETAIL|TSPSUMCCSUMSTANDARDSUMSPECIALTYSUMCARD|TSPSUMCCSUMTRAVELSUMENTERTAINMENT|TSPSUMCCSUMTVSUMMAILSUMORDER|')||'TSPSUMCCSUMUPSCALESUMRETAIL|TSPSUMCCSUMUPSCALESUMSPECSUMRETAIL|TSPSUMCCSUMVISA|TSPSUMMTSUMFOOTBALLSUMENTHUSIASTS|TSPSUMMTSUMSMARTSUMPHONESUMUSER|'
|| 'TSPSUMMTSUMHIGHENDSUMAMSUMRANKSUMTM2|FANTSUMOPPSUMTEAMSUMNMSUMTM2|FANTSUMOPPSUMTEAMSUMRANKSUMTM2|FANTSUMLEAGUESUMIDSUMTM3|FANTSUMTEAMSUMIDSUMTM3|FANTSUMTEAMSUMNMSUMTM3|FANTSUMTEAMSUMRANKSUMTM3|FANTSUMOPPSUMTEAMSUMNMSUMTM3|FANTSUMOPPSUMTEAMSUMRANKSUMTM3|JEBBITSUMATTRIB13SUMFLG|JEBBITSUMATTRIB12SUMFANTSUMFLG|JEBBITSUMATTRIB11SUMKIDSSUMFLG|MSSUMONSUMLOCATION|MSSUMBARCLAY|BARCLAYSUMPASSIONSUMJETSETSUMIND|BARCLAYSUMPASSIONSUMELECSUMIND|BARCLAYSUMPASSIONSUMEGOERSUMIND|LSTSUMGPDSUMSTREAMSUMDT|'
|| 'GPDSUMMINSUMWATCHEDSUMCURRSUMSSN|GPDSUMMINSUMWATCHEDSUMPREV1SUMSSN|GPDSUMMINSUMWATCHEDSUMPREV2SUMSSN|FAVSUMTEAMSUMCDSUMIMPLIED|FAVSUMTEAMSUMCDSUMSUPPLIED|EXTRACTSUMDT' x
from dual ;
spool off;
exit;
EOF

Related

UNIX/Oracle - how to spool a LONG string whose length is greater than 32767 chars

Below script write data from Oracle table to file.
Problem: When the length of a string exceeds 32767 characters (let say 45000) then I get the string till 32767 characters in the file only.
How to spool such a long string to the file.
#!/bin/sh
.
.
sqlplus -s $USER/$PWD#$SID <<ENDSQL > $SQLOUT
set trimout on
set trimspool on
set HEAD OFF
set TAB OFF
set FEED OFF
set echo off
SET TERMOUT OFF
set linesize 32767 long 32767 longchunksize 32767 pagesize 0
WHENEVER SQLERROR EXIT 1;
spool $EXTFILE
select SQL_FULLTEXT||chr(10)||';' from v$sql;
spool off
.
.
#Unix script ends
UTL may help here but cant use it.

Error while connecting the sqlplus from shell script

REQ_OUTPUT1=`echo $XXOLA_TOP/log/Inv/xxola_inv_item_conv_int`
echo Connecting in sqlplus
sqlplus -s $1#$TWO_TASK <<+ > $REQ_OUTPUT1
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
SET LINESIZE 500;
SET SERVEROUTPUT ON SIZE 1000000;
SELECT 1 FROM DUAL;
exit;
Above is my code to connect sqlplus from shell program.
But when i am running this i am getting below error..
line 36: warning: here-document at line 29 delimited by end-of-file (wanted `+')
You are not ending the here document properly. Don't use symbols like + for here document delimiters. Use proper meaningful strings.
REQ_OUTPUT1=`echo $XXOLA_TOP/log/Inv/xxola_inv_item_conv_int`
echo Connecting in sqlplus
sqlplus -s $1#$TWO_TASK <<INP > $REQ_OUTPUT1
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
SET LINESIZE 500;
SET SERVEROUTPUT ON SIZE 1000000;
SELECT 1 FROM DUAL;
exit;
INP

Pass Table name as Variable in sql query in Unix Shell Script Solaris

I'm creating a Unix shell script in solaris on which my task is to run the sql queries for 35 tables and bring the output to a csv file.For Which what I thought is that I will create an array of and by using for loop I will the pass the table name one by one to sql query.So as a sample I'm trying to pass the table name as variable in sql query.
I'm passing table name is sql query as well as the CSV which I m creating.
But is not working.Please help....
table_nm="PRODUCT"
sqlplus -s admin/admin_123#extend12 <<EOF
SPOOL /data2/interfaces/scripts/`$table_nm`.CSV;
set colsep ,
set feedback off
set trimspool on
set linesize 5000
set pagesize 1000
set heading on
set term off
set verify off
set timing off
set echo off
select * from `$table_nm` where PROD_ID = '1618' AND PROD_SER_NUM = 21 ;
spool off;
EXIT;
EOF
echo "end"
Loop through the array. Don't use back ticks.
tablearry=(PRODUCT SALES EMPLOYEES)
for i in "${tablearry[#]}"
do
table_nm=$i
sqlplus -s admin/admin_123#extend12 <<EOF
SPOOL /data2/interfaces/scripts/${table_nm}.CSV;
set colsep ,
set feedback off
set trimspool on
set linesize 5000
set pagesize 1000
set heading on
set term off
set verify off
set timing off
set echo off
select * from ${table_nm} where PROD_ID = '1618' AND PROD_SER_NUM = 21 ;
spool off;
EXIT;
EOF
echo "end"
done

call a procedure with date parameter in sqlplus oracle using shell script

I want to call a procedure in sqlplus oracle using shell script,
my procedure name is getdate_proc with two parameters, startdate and enddate.
I want to set startdate = sysdate and enddate = sysdate + 5 days
for example :execute getdate_proc(to_date('05/05/2015', 'MM-DD-YYYY'),to_date('05/09/2015','MM-DD-YYYY'))
below is my code:
#!/usr/bin/ksh
sqlplus -s /nolog << EOF
connect scott/tiger
--execute procedure with parameter
execute getdate_proc(to_date(sysdate, 'MM-DD-YYYY'),to_date(sysdate + 5days,'MM-DD-YYYY'))
--set spooling to save in csv
set underline off
SET RECSEP OFF
set verify off
set colsep ','
set linesize 300
set trimspool on
spool /home/user/project/samp.csv
select * from att2;
spool off
set verify off
i solved my problem with this code:
#!/usr/bin/ksh
date1='date'
date1=$(/bin/date --date="$date1" -d "+0 day" +"%F")
date2=$(/bin/date --date="$date1" -d "+4 day" +"%F")
echo $date1
echo $date2
sqlplus -s /nolog << EOF
connect scott/tiger
--execute procedure with parameter
execute attendance(to_date('$date1', 'YYYY-MM-DD'),to_date('$date2','YYYY-MM-DD'))
--set spooling to save in csv
set underline off
SET RECSEP OFF
set verify off
set colsep ','
set linesize 300
set trimspool on
spool /home/user/project/samp.csv
select * from att2;
spool off
set verify off
:) cheers

How to connect Data Base

I want to connect DB Using Unix shell script but i an not able to connect
below mention Code
DB
export ORACLE_HOME="oracle"
value=`/oracle/bin/sqlplus -S user/pwd#SHM4EQ << EOF
SET LINESIZE 300
SET PAGESIZE 300
SET HEADING OFF
SELECT * form dual
EOF`
Try like this...
#!/bin/bash
LogDirectory='/var/tmp/logs'
DataDirectory='/var/tmp/data'
DBUSER='scott'
DBUSERPASSWORD='tiger'
DBSID='oracle'
sqlplus -s ${DBUSER}/${DBUSERPASSWORD}#${DBSID} <<EOF
set linesize 32767
set feedback off
set heading off
select * from dual;
EOF

Resources