Home: Perl Programming Help: DBI:
insert in perl function inside cgi module



vladinator
Novice

Dec 14, 2006, 3:36 PM


Views: 5248
insert in perl function inside cgi module

inside Cgi Module I have this perl function:

sub insert_DB()
{

my $dbh1=shift;
my @buffer=@_;

#select values from the external table
my $st = $dbh1->prepare ( qq
(
select to_char(sysdate, 'yyyymmdd-HH24MISS') from dual
));
$st->execute();
my $sys_date = $st->fetchrow();

#print "<br>$sys_date<br><br>";
my $st = $dbh1->prepare( qq
(
insert into zBOT_Configuration
(config_group_id,config_var_id,config_name,config_value)
values
(2,3,1,1);
commit;
));

$st->execute();


for (my $i = 1; $i <=7; $i++) {


my @pairs = split(/=/, $buf[$i]);

#print "$pairs[0]<br>";
#print "$pairs[1]<br>";


}


#print "<br><br><br>";

my $st = $dbh1->prepare ( qq
(
select * from zBOT_Configuration
));

$st->execute();

my @configs = ();
while (my @rows = $st->fetchrow_array()) {


push (@configs,@rows);

}
foreach my $z(@configs) {

#print "$z<br>";
}


}


Now all the selects work fine, but the insert doesnt, when i copy and paste the insert inside sqlplus it works fine

Also I have used insert here before and it worked fine. Now for some odd reason it wont work plz help.


vladinator
Novice

Dec 14, 2006, 6:54 PM


Views: 5246
Re: [vladinator] insert in perl function inside cgi module

i found the problem

it was ;

in the insert statement weird stuff!~