Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Retrieve the temporary tables thru perl in Sybase database

by Anonymous Monk
on Sep 25, 2007 at 14:11 UTC ( [id://640944]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
I am trying to retrieve the temporary tables record using dbi:Sybase module
$sth1 = $dbh->prepare("Select * from #tmp1")
but after running the query it says like.. DBD::Sybase::st execute failed:
and #tmp1 table does not exist.
can anyone suggest me how to retrieve the data from temp table.
Thanks in advance
perluser
  • Comment on Retrieve the temporary tables thru perl in Sybase database

Replies are listed 'Best First'.
Re: Retrieve the temporary tables thru perl in Sybase database
by roboticus (Chancellor) on Sep 25, 2007 at 14:46 UTC
    The temporary tables exist with the 'nice' name only for the current session. Make sure you're not closing your connection, and use the same as you used to create the temporary table.

    If you must use a different session and the other session's not closed, you might be able to access it by looking at the tables in ?tempdb?. They should have *long* names with your session ID in the name. If you pass your session ID to your other connection, you may be able to find the temporary table. But I don't know if your other session will be able to read from it.

    ...roboticus

    Update: I should've mentioned that I've not touched a Sybase database in five years, so my recollections may be (a) out of date, (b) totally wrong, or (c) some combination of a & b.

Re: Retrieve the temporary tables thru perl in Sybase database
by mpeppler (Vicar) on Oct 02, 2007 at 07:24 UTC
    roboticus is correct - a #tmp table is only visible from the session (connection) that created it.

    You are either creating more than one connection explicitly, or DBD::Sybase is doing it for you because you attempt to start more than one query at the same time. If the latter you can find out more by setting the $dbh->{syb_no_child_con} attribute which inhibits the creation of child connections to handle multiple active statement handles.

    Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://640944]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2024-04-25 19:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found