Sponsored Content
Full Discussion: Variable Size Problem
Top Forums UNIX for Dummies Questions & Answers Variable Size Problem Post 302136398 by Bob_Loblaw on Monday 17th of September 2007 03:28:50 PM
Old 09-17-2007
Variable Size Problem

Hello Everyone,

I am currently working with a DB2 (ver 8.1) table (Newly Created) and I am running a basic DB2 Select query into a variable. The field and it's size are VARCHAR(20). Since I need to pass the variable through some java I have noticed that when the results come back from the query there are extra spaces. Even if I use the RTRIM or LTRIM I still receive the spaces.

Is there a way to set a variable lenght before the results of a query are passed to it?

I would like to do the following,

Code:
variable1=`db2 -xn "length(rtrim(field1)) from Database"`
if (( variable1 == 16 ))
then
set $variable2 lenght to 16
fi
variable2=`db2 -xn "select LTRIM(RTRIM(field1)) from Database"`

Then I can pass $variable2 through the java.

I know it doesn't make much sense but it's what I need, hopefully.

thanks in advance...........Smilie

Last edited by Bob_Loblaw; 09-17-2007 at 04:36 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Max size of variable

What is the maximum amount of characters that you can have in a varible name in the ksh shell? (1 Reply)
Discussion started by: lesstjm
1 Replies

2. AIX

Variable Testing for size

How do you test a variable size to know if it is empty or not? Thanks (4 Replies)
Discussion started by: jango
4 Replies

3. AIX

dev/rmt 0.1 block size is 0; variable; must be 1024 fixed.

Hi. After the shutdown for SWIFT Alliance Server, tape backup process will be done. Unfortunately, I encountered this error message when I performed the database tape backup. The error was "/dev/rmt 0.1 block size is 0; variable; must be 1024 fixed. Consider reconfiguration through 'chdev'... (2 Replies)
Discussion started by: MariaLuisa
2 Replies

4. UNIX for Dummies Questions & Answers

size of number variable in unix (awk)

Hi All, M writing a shell scripting n making use of awk. I am using a integer variable named size. When printing it's value, it is giving result as 4.34534e+10. Is there any way to declare variable of type LONG in awk or in shell scripting in general ? Regards, Abhishek Gera (3 Replies)
Discussion started by: AbhishekG
3 Replies

5. SCO

File size problem

I'm working on a IBM PC Serveur 325. I have a sequential file with more than 800000 records. The size of that file is 136755200. I wrote a cobol program (RM cobol) to delete records. Now the file has 180000 records and the size still the same 136755200. What I need to do to decrease the size.... (1 Reply)
Discussion started by: royinfo
1 Replies

6. UNIX for Dummies Questions & Answers

File size problem

I'm working on a IBM PC Serveur 325. I have a sequential file with more than 800000 records. The size of that file is 136755200. I wrote a cobol program (RM cobol) to delete records. Now the file has 180000 records and the size still the same 136755200. What I need to do to decrease the size.... (3 Replies)
Discussion started by: royinfo
3 Replies

7. Shell Programming and Scripting

file size problem

Hi everyone can you people please help me in the problem below -bash-3.00$ ls -ltr abc abc.tar -rw-r--r-- 1 1hinaa2 17 Jan 17 14:09 abc -rw-r--r-- 1 1hinaa2 2048 Feb 17 07:03 abc.tar -rw-r--r-- 1 1hinaa2 135 Feb 17 07:03 abc.tar.gz why this strange... (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

8. UNIX for Advanced & Expert Users

size for sum variable limitation on awk

Hello first, truth been told, I'm not even close to be advanced user. I'm posting here because maybe my question is complicated enough to need your expert help I need to use awk (or nawk - I don't have gawk) to validate some files by computing the total sum for a large numeric variable. It... (1 Reply)
Discussion started by: cwitarsa
1 Replies

9. Shell Programming and Scripting

Getting size of a variable

if i do the following: echo "hello, mr. sunshine" > /tmp/text.txt du -s /tmp/text.txt The text.txt file now contains "hello, mr. sunshine". So i did a du -s on the file to see how much space the text i inserted took. now, instead of writing "hello, mr. sunshine" to a text file on the... (5 Replies)
Discussion started by: SkySmart
5 Replies

10. Shell Programming and Scripting

Large Variable content size caveats?

Hi, I wrote a shell script, which let me manage dns records through an api. The raw core-command looks like about this: output="$(curl -X GET https://mgt.myserver.de:8081/api/v1/servers/localhost/zones)"The output contains a list of all zones with all records and is about 800 Kilobytes... (9 Replies)
Discussion started by: stomp
9 Replies
DB2_TABLE_PRIVILEGES(3) 						 1						   DB2_TABLE_PRIVILEGES(3)

db2_table_privileges - Returns a result set listing the tables and associated privileges in a database

SYNOPSIS
resource db2_table_privileges (resource $connection, [string $qualifier], [string $schema], [string $table_name]) DESCRIPTION
Returns a result set listing the tables and associated privileges in a database. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema which contains the tables. This parameter accepts a search pattern containing _ and % as wildcards. o $table_name - The name of the table. This parameter accepts a search pattern containing _ and % as wildcards. RETURN VALUES
Returns a statement resource with a result set containing rows describing the privileges for the tables that match the specified parame- ters. The rows are composed of the following columns: +-------------+---------------------------------------------------+ |Column name | | | | | | | Description | | | | +-------------+---------------------------------------------------+ | TABLE_CAT | | | | | | | The catalog that contains the table. The value is | | | NULL if this table does not have catalogs. | | | | |TABLE_SCHEM | | | | | | | Name of the schema that contains the table. | | | | | TABLE_NAME | | | | | | | Name of the table. | | | | | GRANTOR | | | | | | | Authorization ID of the user who granted the | | | privilege. | | | | | GRANTEE | | | | | | | Authorization ID of the user to whom the privi- | | | lege was granted. | | | | | PRIVILEGE | | | | | | | The privilege that has been granted. This can be | | | one of ALTER, CONTROL, DELETE, INDEX, INSERT, | | | REFERENCES, SELECT, or UPDATE. | | | | |IS_GRANTABLE | | | | | | | A string value of "YES" or "NO" indicating | | | whether the grantee can grant the privilege to | | | other users. | | | | +-------------+---------------------------------------------------+ SEE ALSO
db2_column_privileges(3), db2_columns(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_spe- cial_columns(3), db2_statistics(3), db2_tables(3). PHP Documentation Group DB2_TABLE_PRIVILEGES(3)
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy