Consultor Eletrônico



Kbase 16521: How to call Progress functions from ESQL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
How to call Progress functions from ESQL?

How to call Progress functions from ESQL
----------------------------------------

In order to call a Progress function in ESQL, they must be
properly used in an SQL statement where an expression returning a
value is legal. This is obvious if the function is being applied to
data from records. For example, the SUBSTRING function can be used
like this:

EXEC SQL DECLARE x CURSOR FOR SELECT
name, SUBSTRING(name,1,7) FROM customer;
...

If you want to call a function with specified arguments you must
still embed the function in query against some table.
Typically, a dummy table with one row is used. For example, to use
the CONNECTED function you say:

EXEC SQL DECLARE x CURSOR FOR
SELECT CONNECTED ("sports") FROM DUMMY_TABLE;
...
EXEC SQL FETCH x into :answer;

In the above example, if you do it against the customer table instead
of a dummy table, you will get a response back for each record of the
customer table. In order to avoid this, you only want to do one fetch
or create a dummy table with one record in it.

Progress Software Technical Support Note # 16521