Re: SQL and RPG
- From: ga <noemail@xxxxxxxxxxxxxx>
- Date: Thu, 15 Mar 2007 09:29:46 -0500
Okay, I resolved it by removing the ";" (semi-colon) at the end of the
SQL statement. Why would this make a difference?? I'm confused as to
why it would look at that. I thought that I needed a semicolon to
demarcate the end of the sql statement??
If you've followed this thread, the SQL statement is being called
within an RPG program via
C/EXEC SQL
C+ ExECUTE IMMEDIATE :STATEMENT
C/END-EXEC
Just seems weird removing the semi-colon makes it work. Now my SQL
state is 02000 and it is updating the files correctly. WEIRD. Of
course I confess I know little about this whole thing.
Thanks to all of you for your help!! Again, if anyone can explain why
I don't need the semicolon token, I'd like to know.
thanks,
ga
ga <noemail@xxxxxxxxxxxxxx> wrote:
Question,
Okay I figured out the quotes thanks to your help. This is what the
statement now looks like:
Update IMTEMP set ITMI = 'ABLE', ITP# = 'GEORGE' where ITMI = 'MAHLE'
AND ITP# = '28621NSTD';
Problem is, I am still getting a 42601 SQLSTATE code and this is not
updating the file. Do I have to be more specific or something with
the file/member??
Right now all my files have just one member so I am just saying UPDATE
IMTEMP. My files are defined in DDS but I didn't think that made any
difference.
What can I do to figure out why it's not updating the fields in my
file? I have checked to make sure the fields I want to replace are as
shown. The only think I don't have is blanks padded on the right.
For instance, ITMI in this example is 6 characters and ITP# is 18
characters.
I feel like I am really close with this but am too stupid to figure it
out.
Thanks in advance for any suggestions,
ga
"Hauser@xxxxxxxxxxxxxxx" <Hauser@xxxxxxxxxxxxxxx> wrote:
Hi,
If your fields are defined as character you have to put single quotes
around. A single quote in a string must always be represented by two
consequent single quotes.
For Example:
Statement = 'Update MyTable Set ' + NameField1 + ' = ''' + NewValue
+ '''';
Birgitta
ga
nospam@xxxxxxxxxxxxxxxx
ga
nospam@xxxxxxxxxxxxxxxx
.
- Follow-Ups:
- Re: SQL and RPG
- From: Denny
- Re: SQL and RPG
- References:
- SQL and RPG
- From: ga
- Re: SQL and RPG
- From: Graybeard
- Re: SQL and RPG
- From: ga
- Re: SQL and RPG
- From: Denny
- Re: SQL and RPG
- From: ga
- Re: SQL and RPG
- From: Hauser@xxxxxxxxxxxxxxx
- Re: SQL and RPG
- From: ga
- SQL and RPG
- Prev by Date: Re: SQL and RPG
- Next by Date: Re: SQL and RPG
- Previous by thread: Re: SQL and RPG
- Next by thread: Re: SQL and RPG
- Index(es):
Relevant Pages
|