469,336 Members | 5,570 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

DB2 Programing help

Hi,

I need to submit some SQL statements through VB code via ODBC. My
question is can I submit something like:

DECLARE vOne VARCHAR(40);

SET vOne = ' World'

select 'Hello' || vOne
FROM SYSIBM.SYSDUMM1

Currently, when I do this I get an error. I even tried enclosing my
statements with a BEGIN and END but did not work. I know I can embed the
above statements into a stored procedure, but can I make this return one
row without embedding this into a Store Proc?

Thanks,
Feb 6 '06 #1
1 1291
Jack Miller wrote:
Hi,

I need to submit some SQL statements through VB code via ODBC. My
question is can I submit something like:

DECLARE vOne VARCHAR(40);

SET vOne = ' World'

select 'Hello' || vOne
FROM SYSIBM.SYSDUMM1

Currently, when I do this I get an error. I even tried enclosing my
statements with a BEGIN and END but did not work. I know I can embed the
above statements into a stored procedure, but can I make this return one
row without embedding this into a Store Proc?

Thanks,

The first two statements are part of SQL Procedures.
Since you are coding VB you shoudl use teh VB equivalent of local
variables, assignment and then use parameter-markers ('?') to bind the
VB variable to the select statement.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
DB2 UDB for Linux, Unix, Windows
IBM Toronto Lab
Feb 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.