From: Loo, P. # P. <Pet...@so...> - 2006-10-04 17:30:12
|
Hello All, =20 I am attempting to use Expect to spawn "sqlldr" then feeding it the data returned from a SELECT statement. Everything appears to work except nothing is getting loaded. The reason I chose to use Expect.pm is to hide the "password" from the Unix command "ps -ef". Below is what I am trying to do. I hope you can help shed some light. =20 my $sqlldr =3D new Expect; =20 $sqlldr->spawn('sqlldr', join('@', $DBUSER, $s_dbName)) || die "Cannot spawn sqlplus: $!\n"; =20 $sqlldr->expect(30, ['control =3D ', sub { my $self =3D shift; $self->send("$cntrlFile\n"); $self->expect(0, '-re', "\n"); } ] ); #$self->log_stdout(0); #$self->log_stdout(1); =20 $sqlldr->expect(30, ['Password:', sub { my $self =3D shift; $self->send("$DBPASS\n"); $self->expect(0, '-re', "\n"); } ] ); =20 while ($row =3D $s_sth->fetchrow_arrayref()) { my $rec =3D join($delimiter, @$row); #$sqlldr->send("$rec\n") || die "ERROR: Cannot send to sqlldr: $!\n"; $sqlldr->expect(0, '', sub { my $self =3D shift; $self->send("$rec\n"); } ); } =20 Thanks. =20 Peter |