0
    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.

1
  • sorry, I can't make head or tail of what you're trying to ask. Perhaps you could tell us what error message you're getting? "Does not work" is not helpful. Commented Apr 12, 2011 at 13:06

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

No..Anyways using DBI is a better suggestion..Thanks
0

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 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.