Sponsored Content
Top Forums Shell Programming and Scripting How to ignore * (asterisk) in a variable Post 302202781 by shew01 on Thursday 5th of June 2008 03:44:32 PM
Old 06-05-2008
Quote:
The sql is stored in a varchar(32000) on the source table. When I put the double quotes on the echo, I now get a record echo'd out that is 32000 bytes long.
If the column is defined as varchar(32000), I don't understand why you are retrieving what appears to be full width columns. I'm using Oracle instead of DB2, but the principle should be the same.

Code:
create table my_table
	(sql_statement varchar(1000));

insert into my_table values ('select * from table2');

select sql_statement || '#' from my_table;

Here is my output:

Code:
SQL_STATEMENT||'#'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
select * from table2#

1 row selected.

Have you tried trimming the output as you select it from the DB2 database?

Code:
select trim(sql_statement) || '#' from my_table;

The output is the same (i.e., no trailing spaces for the data), unless the long line of dashes is giving you a problem:

Code:
TRIM(SQL_STATEMENT)||'#'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
select * from table2#

1 row selected.

 

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

passing asterisk to a script as variable

I'm writing a script that will ssh to a number of hosts and run commands. I'm a bit stumped at the moment as some of the commands that I need to run contain wildcards (i.e. *), and so far I have not figured out how to escape the * character so the script doesn't expand it. More specifically, here's... (9 Replies)
Discussion started by: GKnight
9 Replies

2. AIX

Replace string with asterisk(*) in variable

I was trying to replace a string ( for eg - @@asterisk@@ to * ) in variable using cat $INFILE | while read LINE do stmt1=`echo $LINE | sed 's/@@asterisk@@/\*/g'` stmt=$stmt' '$stmt1 stmt2=`echo $LINE` STATEMENT=$STATEMENT' '$stmt2 done echo 'Statement with sed -- > '... (5 Replies)
Discussion started by: Vaddadi
5 Replies

3. Shell Programming and Scripting

How to assign * asterisk to variable?

How can I assign asterisk to variable I have try a="\* " but I was not succesful :( any idea ? thanks (5 Replies)
Discussion started by: kvok
5 Replies

4. Shell Programming and Scripting

Need to use asterisk in variable

Hi All, I am having a challange to pass the asterisk in the variable. Basically, I am writing a shell script to check if a marker file exists but when I am assigning the varialbe it cannot use the wildcard asterisk as expected, therefore, my program is always outputs "Marker file is not... (4 Replies)
Discussion started by: express14
4 Replies
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy