The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Oracle Select IN statement benefactr UNIX and Linux Applications 1 03-26-2009 04:15 PM
select a particular field Satyak Shell Programming and Scripting 4 10-09-2008 05:38 AM
select last field from a file kykyboss Shell Programming and Scripting 3 11-14-2006 10:15 AM
Error : Field $() is not correct abbey Shell Programming and Scripting 3 06-20-2006 04:01 AM
Pipe SQL select statement results to script houtakker UNIX for Dummies Questions & Answers 6 10-31-2003 01:20 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-21-2009
ryanW ryanW is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 34
::select statement return value with correct field size::

Hi Everyone,

I am facing a problem regarding the select from sybase, the return with the incorrect size.

For example, field is NAME(20).

After i selected from sybase, the result is nicky.
after i assign it to another declaration variable, it will be in actual name "nicky" , what i need the result is "nicky " with the space.

Anyone, who can help me? where to set it.. then i can get the return value with correct size which is including the space.

here is my sample of coding which

FIRST::::
typeSQL()
{

CONNECT="$SYBASE/XXX-22_8/bin/isql -S$HOSTNAME -U$USERNAME -P$PASSWORD -w400 -b -s|"

data_type_SQL=$($CONNECT cat <<-__EOF__
SET NOCOUNT ON
select LOC_TYPE, WAREHOUSE, LOCATION_ID from LOCATION where
LOCATION_ID="$loc_ID"
go
__EOF__)
}

size of each filed
LOC_TYPE(1)
WAREHOUSE(4)
LOCATION_ID(6)


After return value with incorrect size which are follow the size of each table name

data_type_SQL result is --> |G |NRT |NRTW |

SECOND::
loc_TYPE=$(echo $data_type_SQL | cut -d\| -f2| sed -e 's/|//g')
ware_HOUSE=$(echo $data_type_SQL | cut -d\| -f3| sed -e 's/|//g')
local_ID=$(echo $data_type_SQL | cut -d\| -f4| sed -e 's/|//g')

result after assigned with incorrect size

loc_TYPE="NRTW "
ware_HOUSE="G "
local_ID="NRT "


Can someone help me to check it? I just hope after assign to each field with correct size, including "SPACING"

thank you
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0