PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Avis, Ed" <avised at kbcfp dot com>
Subject: Running multiple SQL statements concatenated together
Date: Oct 14 2003 4:08PM

In Sybase command shells such as sqsh, you can run more than one
SQL query or statement at a time:

sqsh> select 5 from foo
sqsh> select 7
sqsh> go
            
 -----------
           5
           5

(2 rows affected)
            
 -----------
           7

(1 row affected)


I would like to do this from Perl programs using DBI - I want to
write a simple command interpreter and it should have roughly the
same behaviour as sqsh in this case.  But when I give the string
to DBI, it seems that only the first query is executed and the
'select 7' gets ignored.

Is there any way to get back a single result set that has rows
from both statements?  (Without resorting to parsing the SQL
or munging it with 'union', etc.)

Anyone know how sqsh does it?

-- 
Ed Avis