472,958 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

db2_all : escape * ' ( " in ksh

I am trying to escape the special characters while executing the
following sql, but couldn't figure out a way.

db2_all "db2 connect to mydb; db2 select * from table
(SNAPSHOT_CONTAINER ( '' , -1 ) ) as snp where TABLESPACE_NAME =
'MYTSP'; db2 terminate".

How would I get this successully executed?

Thanks.
Nov 12 '05 #1
5 13450
Ian
Prince Kumar wrote:
I am trying to escape the special characters while executing the
following sql, but couldn't figure out a way.

db2_all "db2 connect to mydb; db2 select * from table
(SNAPSHOT_CONTAINER ( '' , -1 ) ) as snp where TABLESPACE_NAME =
'MYTSP'; db2 terminate".

How would I get this successully executed?


Use the unix escape character, '\'.

db2_all "db2 connect to mydb; db2 \"select * from ...\"; db2 terminate"


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
Thanks Ian,

I already tried that. I got the following error.

db2_all "db2 connect to mydb; db2 \"select * from table
(SNAPSHOT_CONTAINER('', -1 )) as snp where TABLESPACE_NAME = 'TSSAM'
\";db2 terminate"

Database Connection Information

Database server = DB2/6000 8.1.5
SQL authorization ID = XXXXX
Local database alias = MYDB

SQL0104N An unexpected token "," was found following
"(SNAPSHOT_CONTAINER(".
Expected tokens may include: "<space>". SQLSTATE=42601
DB20000I The TERMINATE command completed successfully.
cdidev01: db2 connect to mydb completed ok

I tried to escape the "(" , "'" as well. But it did not help.

Thanks,
Prince.

Ian <ia*****@mobileaudio.com> wrote in message news:<41********@corp.newsgroups.com>...
Prince Kumar wrote:
I am trying to escape the special characters while executing the
following sql, but couldn't figure out a way.

db2_all "db2 connect to mydb; db2 select * from table
(SNAPSHOT_CONTAINER ( '' , -1 ) ) as snp where TABLESPACE_NAME =
'MYTSP'; db2 terminate".

How would I get this successully executed?


Use the unix escape character, '\'.

db2_all "db2 connect to mydb; db2 \"select * from ...\"; db2 terminate"


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #3
Ian
Prince Kumar wrote:
Thanks Ian,

I already tried that. I got the following error.

db2_all "db2 connect to mydb; db2 \"select * from table
(SNAPSHOT_CONTAINER('', -1 )) as snp where TABLESPACE_NAME = 'TSSAM'
\";db2 terminate"


This exact syntax works just fine for me. Are you using a weird shell,
or do you have anything strange in your .profile, db2profile or
userprofile?


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #4
Hi Ian,

I am using ksh on AIX 5.2. I don't see any weird stuff in the .profile
or db2profile. If I do not have the "(" or any such spl characters it
works fine.

db2_all "db2 select agent_id from table(snapshot_lock(' ',-1) ) as
snap"

ksh: 0403-057 Syntax error at line 1 : `(' is not expected.

ksh: 0403-057 Syntax error at line 1 : `(' is not expected.

ksh: 0403-057 Syntax error at line 1 : `(' is not expected.

ksh: 0403-057 Syntax error at line 1 : `(' is not expected.

$ db2_all "db2 select 'no-conn' from sysibm.sysdummy1"

SQL1024N A database connection does not exist. SQLSTATE=08003
cdidev01: db2 select agent_id ... completed rc=4

SQL1024N A database connection does not exist. SQLSTATE=08003
cdidev01: db2 select agent_id ... completed rc=4

Note: I did not connect to the db. I just wanted to see whether the
syntax works or not

.................................................. ...........................
looks like
Ian <ia*****@mobileaudio.com> wrote in message news:<41**********@corp.newsgroups.com>...
Prince Kumar wrote:
Thanks Ian,

I already tried that. I got the following error.

db2_all "db2 connect to mydb; db2 \"select * from table
(SNAPSHOT_CONTAINER('', -1 )) as snp where TABLESPACE_NAME = 'TSSAM'
\";db2 terminate"


This exact syntax works just fine for me. Are you using a weird shell,
or do you have anything strange in your .profile, db2profile or
userprofile?


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #5
Just an update.

db2_all 'db2 connect to mydb; db2 "select * from
table(snapshot_lockwait(chr(32),-1)) as snap "; db2 terminate'

The above works fine. But when I try to replace the chr(32) (ie the
space) with \' \', (ie quote-space-quote) I get the following error

ksh: 0403-057 Syntax error: `)' is not expected
gs**@yahoo.com (Prince Kumar) wrote in message news:<62**************************@posting.google. com>...
I am trying to escape the special characters while executing the
following sql, but couldn't figure out a way.

db2_all "db2 connect to mydb; db2 select * from table
(SNAPSHOT_CONTAINER ( '' , -1 ) ) as snp where TABLESPACE_NAME =
'MYTSP'; db2 terminate".

How would I get this successully executed?

Thanks.

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alden Streeter | last post by:
Here is the HTML that is being output by my asp page: <a href='Files/category/computers/bigimages/computers-sub-monitors.jpg' target='_blank' onMouseOver="window.status='Click for a larger image...
1
by: db2sysc | last post by:
All: When I execute a utility command using db2_all, Can I get seperate return codes per node where the command got executed? in other words, how to get the returncode when we execute db2_all...
3
by: JS | last post by:
windows 2k with v 8 fix 5, eee set up when I issue db2_all "db2 get db cfg for <dbname>", I get for each node: <HOSTANME> : DB2 GET DB CFG FOR <DBNAME> completed RC=0 rah: <HOSTNAME> but there is...
0
by: Will Griffiths | last post by:
Hi, I am running DB2 v8.1 ESE on Windows 2000 and have a single instance on my machine with 3 nodes. When I attempt to run *any* command using db2_all I get the following output (my machine...
6
by: Fan Ruo Xin | last post by:
db2_all "db2 update db cfg for sample using tsm_mgmtclass \'\'"; ksh: syntax error at line 1 : `{' unmatched ksh: syntax error at line 1 : `{' unmatched ksh: syntax error at line 1 : `{'...
3
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that...
0
by: YiFai | last post by:
Hello, I'm currently writing a directx program with C++, but it takes a while to load the files necessary for the directx. When the directx window loads, it can quit the program with the...
3
by: chettiar | last post by:
I am new to shell scripting. I need to use the db2_all command in a shell script can someone help. I need to use the following command in the shell script: db2_all <<-0< db2 conncet to...
131
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.