Reputation: 169
Below is the module in sybase.
sub execute_query{
$connect = "isql -S $SERVER-U $USER -P $PASS -D $DBNAME";
$pid = open2(\*Rder, \*Wrter, "$connect");
Writer->autoflush();
print Write qq!
set transaction isolation level 0
go
Select * from remtrench
go
!;
Wrter->close();
while(<Rder>)
{
Parse data
}
The above code made changes to support oracle below. I was able to connect to oracle.But selecting database query and other query ther than connection doesnt work.Please guide me
sub execute_query{
$connect = "sqlplus $USER/PASS@SERVER
$pid = open2(\*Rder, \*Wrter, "$connect");
Writer->autoflush();
alter session set current_schema = $DBNAME;
Select * from remtrench;
Writer->close();
....
}
The above change of mine does not work for alter session the other query (select).Googled on how to execute multiple queries.But still this doesnt help me. Thanks.
Upvotes: 0
Views: 168
Reputation: 16673
the ALTER SESSION will be valid within that session, but not if you open more sessions for each sql command.
You may simply prefix the database objects in your queries to get around this requirement such as by referencing tables like this:
SELECT * FROM USER.TABLE
Upvotes: 0
Reputation: 69314
Is it the missing closing quotation mark on the second line?
Alternatively, why are you interacting with databases using their command line programs? You should be using something like DBI or DBIx::Class.
Upvotes: 2