Sybase 12.4.2 Server User Manual


 
Calling external libraries from procedures
268
Using SELECT statements in batches
You can include one or more SELECT statements in a batch. Multiple SELECT
statements are allowed by Interactive SQL only if they return the same number
of columns and each column has the same data type.
The following is a valid batch:
IF EXISTS(SELECT *
FROM systable
WHERE table_name=’employee’ )
THEN
SELECTemp_lname AS LastName,
emp_fname AS FirstName
FROM employee;
SELECT lname, fname
FROM customer;
SELECT last_name, first_name
FROM contact;
END IF
The alias for the result set is required only in the first SELECT statement, as
the server uses the first SELECT statement in the batch to describe the result
set.
A RESUME statement is required following each query to retrieve the next
result set.
The following is not a valid batch, as the two queries return different result sets:
IF EXISTS( SELECT * FROM systable
WHERE table_name=’employee’ )
THEN
SELECTemp_lname AS LastName,
emp_fname AS FirstName
FROM employee;
SELECT id, lname, fname
FROM customer;
END IF
Calling external libraries from procedures
You can call a function in an external Dynamic Link Library (DLL) from a
stored procedure or user-defined functions under an operating system that
supports DLLs. You cannot use external functions on UNIX.