04-21-2009
::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
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I'm new to shell scripting. Trying to extract substring using awk script as shown below :
Flag=$1
Length=`echo ${#Flag}`
NewLen=$Length-2
NewFlag=`echo $Flag|awk '{print substr($Flag,0,$NewLen)}'`
echo "New string is : $NewFlag"
exit
When I execute this script the following... (3 Replies)
Discussion started by: abbey
3 Replies
2. UNIX and Linux Applications
If I recall, when I used informix I could do a sql statement like:
SELECT Value from Table WHERE ID in (100,200,300);
How do I do this in Oracle? I believe I am using Oracle 10 if that matters.
Thanks. (1 Reply)
Discussion started by: benefactr
1 Replies
3. Shell Programming and Scripting
I am trying to assign an select statement into a variable. Can someone hel me with this.
example :
a='select * from dual'
echo $a should give me select * from dual
But this is not working. I trying with \ before * and quotes too. (1 Reply)
Discussion started by: rdhanek
1 Replies
4. Shell Programming and Scripting
Hi All,
I have this script below that checks rpm code version to Linux and Solaris servers.
The script is run using arguement ($1) which is server_list.txt. It runs as:
$ ./scriptname server_list.txt
#!/bin/bash
QUERY="/opt/rpm/bin/rpm -qa --queryformat '%{installtime}... (0 Replies)
Discussion started by: linuxgeek
0 Replies
5. Shell Programming and Scripting
i want to select a variable created and use it in a if statement, but not getting the desired results
LINE='device for 0101a01: lpd://172.25.41.111:515'
prt=`echo $LINE | awk '{print $3 }' | cut -c 1-7`
echo $prt
My if statement to select just what i want..
IFS=$":"
while read prt... (11 Replies)
Discussion started by: ggoliath
11 Replies
6. UNIX for Dummies Questions & Answers
I use command-line mode of GRUB to load kernel,
but I can not know how to chose the partition and kernel argument,
as followed :
please tell me how to do deal with ,
thanks! (0 Replies)
Discussion started by: cqlouis
0 Replies
7. Shell Programming and Scripting
Hi I am using a awk command but not getting required o/p.
input file
a.txt
2 ak
3 cb
4 de
5 gh
6 ij
awk program
BEGIN { x=0 }
{if ($1>3) {x=x+1}{print $0} }
END { print "I found " x " line have value more than 3" }
output
2 ak
3 cb
4 de
5 gh
6 ij (3 Replies)
Discussion started by: aaysa123
3 Replies
8. UNIX for Dummies Questions & Answers
Hello everyone,
A simple question which may have a suggested solution:
I am using, and loving, the select command in a ksh93 script on AIX 6.1 to present users with menus.
I have been successful in controlling all of key input by the users, I still have an issue with the RETURN key. When the... (4 Replies)
Discussion started by: gio001
4 Replies
9. Shell Programming and Scripting
Hi
I have run out of ideas as to why this select doesn't work in a script I am writing.
The script sources a file of common functions and I am trying to use a select statement within one of the functions -
PS3="Try? "
select X in CONT EXIT; do
if ]
... (4 Replies)
Discussion started by: steadyonabix
4 Replies
10. Shell Programming and Scripting
On server1 the "id" command works fine and returns "myuser" user as was expected. Below are the details of the good server.
$ id -nu 501
myuser
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
$ uname -a
Linux server1 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4... (10 Replies)
Discussion started by: mohtashims
10 Replies
LEARN ABOUT REDHAT
qvboxlayout
QVBoxLayout(3qt) QVBoxLayout(3qt)
NAME
QVBoxLayout - Lines up widgets vertically
SYNOPSIS
#include <qlayout.h>
Inherits QBoxLayout.
Public Members
QVBoxLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
QVBoxLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
QVBoxLayout ( int spacing = -1, const char * name = 0 )
~QVBoxLayout ()
DESCRIPTION
The QVBoxLayout class lines up widgets vertically.
This class is used to construct vertical box layout objects. See QBoxLayout for more details.
The simplest use of the class is like this:
QBoxLayout * l = new QVBoxLayout( widget );
l->addWidget( aWidget );
l->addWidget( anotherWidget );
<center>
[Image Omitted]
</center>
See also QHBoxLayout, QGridLayout, the Layout overview, Widget Appearance and Style, and Layout Management.
MEMBER FUNCTION DOCUMENTATION
QVBoxLayout::QVBoxLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
Constructs a new top-level vertical box called name, with parent parent.
The margin is the number of pixels between the edge of the widget and its managed children. The spacing is the default number of pixels
between neighboring children. If spacing is -1 the value of margin is used for spacing.
QVBoxLayout::QVBoxLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
Constructs a new vertical box called name name and adds it to parentLayout.
The spacing is the default number of pixels between neighboring children. If spacing is -1, this QVBoxLayout will inherit its parent's
spacing().
QVBoxLayout::QVBoxLayout ( int spacing = -1, const char * name = 0 )
Constructs a new vertical box called name name. You must add it to another layout.
The spacing is the default number of pixels between neighboring children. If spacing is -1, this QVBoxLayout will inherit its parent's
spacing().
QVBoxLayout::~QVBoxLayout ()
Destroys this box layout.
The layout's widgets aren't destroyed.
SEE ALSO
http://doc.trolltech.com/qvboxlayout.html http://www.trolltech.com/faq/tech.html
COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license
statement.
AUTHOR
Generated automatically from the source code.
BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you.
Thank you.
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a
web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially
supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page
(qvboxlayout.3qt) and the Qt version (3.1.1).
Trolltech AS 9 December 2002 QVBoxLayout(3qt)