Up Prev Next
From: Robert Banniza <hunt127588 at home dot com>
Subject: Fwd: RE: Updating only certain records in a query...
Date: Oct 27 1999 12:03PM
I did forget to mention that the reason I can't just do the following:
"update my_table set comment_type='hi mom' where comment_type is null"
is b/c some comment_types DO have a value. Therefore, if I come to a
comment_type with a value, I want to populate a variable and use that variable
to update the subsequent nulls until I come to another record with a comment
type of null where the variable will be re-populated with the new comment type.
Table looks like this:
And I want to do this:
Thanks for any help.
---------- Forwarded Message ----------
Subject: RE: Updating only certain records in a query...
Date: Tue, 26 Oct 1999 22:49:39 -0600
From: Rob Fenstermacher
maybe I'm not understanding the question, but how about something like
$ref = $d->ct_sql("select id from my_table where comment_type is null",\&my_routine);
then update each row separately...
$d->ct_execute("update my_table set comment_type='hi mom' where comment_type is null");
if you want to set them all the same....
but, it is more likely that I am misunderstanding your question.
Have a good one
Conversion Specialists, Inc
From: Robert Banniza[SMTP:firstname.lastname@example.org]
Reply To: SYBPERL-L@listproc.net
Sent: Tuesday, October 26, 1999 10:38 PM
To: SybPerl Discussion List
Subject: Updating only certain records in a query...
I'm trying to write some Sybperl using CTlib that uses $ref =
$d->ct_sql("select id, comment_type from my_table", \&my_routine );
As I grab each row of data, I'm using an if statement as a conditional to
check whether to update that particular comment_type in that record. How
would I go about doing this?? This query is more of a table scan to check
for null values in comment_type. If comment_type eq null, I want to insert a
value in comment_type. Could someone show me how to do this? I have tried
many different ways but still haven't figured out the right solution.
P.S. I have also looked at the solutions in /sybperl*/eg/ and couldn't find