cocl04 has asked for the wisdom of the Perl Monks concerning the following question:
All, I am trying to pass an array of attributes to a sql statement. The array contains a list of comma delimited sql case statements that I want to append to the attributes in the sql statement. My sample data has two case statements to test the process. Of course, I can add one element of the array and it works. How do I add the entire array as on continuous comma delimited string?
# Create Array_ref with list of case statements for array. my $case = $case_query1->fetchall_arrayref(); #I get two case statements. foreach $r (@{$case}) { @case2 = join(", ", @{$r}); print "@case2"; } # Count number of rows selected my $num = $case_query1->rows; #I get two case statements. print "\n\nThis process returns $num of case statements.\n"; #I get one case statements. print "@case2"; # Set up Query for Creating case data my $case_stmt3 = "create table case_st_data1 as (S +ELECT rd, store_number @case2 FROM test_ptw_bottom_10 where week_end_date in ('19-SEP-09','26-sep-09') group by rd, store_number)";
Can someone help me with the array logic to pass the entire array as a comma delimited string? Note: I only added the parts of the code that are relivent. If you have questions let me know. Thanks...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing an Array of Attributes to SQL
by mje (Curate) on Oct 07, 2009 at 14:01 UTC | |
by cocl04 (Sexton) on Oct 07, 2009 at 14:08 UTC | |
by mje (Curate) on Oct 07, 2009 at 14:21 UTC | |
by cocl04 (Sexton) on Oct 07, 2009 at 14:34 UTC | |
by mje (Curate) on Oct 07, 2009 at 14:49 UTC | |
|