Can I create a temporary table in a perl script and access it in stored procedure?

时间:2017-06-09 12:37:17

标签: perl stored-procedures sybase

I have a perl script through which I'm executing a stored procedure (sybase db). In the same perl script I'm reading records from a .csv file. somehow I want to get these records in my stored procedure. Is there anyway I can do this without writing these records onto a new table in db.

I thought of using a temporary table. Can I create a temporary table in a perl script and access it in stored procedure?

1 个答案:

答案 0 :(得分:2)

I'm assuming your stored proc works on multiple rows of data (otherwise you could call the proc once for each row of data) so fwiw ...


Some basics ....

A temp table ('#' prefix) is associated with the login session that creates it.

As long as the login session remains active then the #temp table remains accessible (assuming you don't issue a 'drop table').

When the login session ends the temp table goes away.

The temp table cannot be accessed by another login session.


Your perl script should be able to create, populate and query the temp table as long as the perl script uses the same login session (aka connection) to perform all actions (create table, insert, select) against the temp table.

Your stored proc would also need to be invoked on the same login session if it's to access the temp table.