Home » Infrastructure » Unix » PL/SQL Variable getting trimmed when running from sqlplus on UNIX
icon9.gif  PL/SQL Variable getting trimmed when running from sqlplus on UNIX [message #143765] Sat, 22 October 2005 03:02
purveshvora
Messages: 6
Registered: August 2005
Location: Mumbai
Junior Member
Hi,

I have a procedure

RETVAL=`$ORACLE_HOME/bin/sqlplus -s /nolog <<EOF
set pagesize 0 feedback off verify off heading off echo off
WHENEVER SQLERROR EXIT 1
connect ${DBLOGIN}
set serveroutput on
DECLARE
p_header            vw_files.header%TYPE;
p_footer            vw_files.footer%TYPE;
BEGIN
	p_header		:= 'header of the file 							let us see it is going                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        					';
	p_footer		:= '90000000007                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ';
	P_INS_FILES(p_header,p_footer);
END;   
/
exit;
EOF`


In the above procedure call the variable p_footer & p_header are having very long values of around 2604 characters. They are getting inserted into a table in oracle where the datatype for the header & footer columns is CLOB.

If I run above through Windows SQL plus it works fine and getting inserted properly.

But If I run the same through shell script then there are foll. two scenarios.

1. The above proc works fine if I have data in the variables i.e.
p_header := 'header kdkfd .... upto 2600 chars of data...'
and its inserting properly.

2. But if there are say 2500 white spaces & then in the last I have some data then its trimming to 662/558 characters.
p_header := 'header kdkfd .... upto 2600 WHITE SPACES some_data'

Attaching data file herewith. I am trying to get first and last line of the file as header & footer.

Please help me on this.

Regards,
Purvesh
Previous Topic: Solaris 9 - scsi Support
Next Topic: script to import all dump files from one schemas
Goto Forum:
  


Current Time: Fri Apr 19 15:45:10 CDT 2024