Consultor Eletrônico



Kbase P79375: Receiving compile error creating get_sal2 Stored Procedure Example from the Progress SQL-92 Guide a
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/06/2004
Status: Unverified

SYMPTOM(s):

Receiving compile error creating get_sal2 Stored Procedure Example from the Progress SQL-92 Guide and Reference book.

=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-20141
[JDBC Progress Driver]:error in compiling the stored procedure

CAUSE:

This line of code is missing in the example.
IMPORT
import java.math.*;

FIX:

Insert
"IMPORT
import java.math.*;"
prior to the BEGIN statement.

Refere to the following Example:

CREATE PROCEDURE get_sal2 ()
RESULT (
empname CHAR(20),
empsal NUMERIC
)
IMPORT
import java.math.*;
BEGIN
StringBuffer ename = new StringBuffer (20) ;
BigDecimal esal = new BigDecimal (2) ;
SQLCursor empcursor = new SQLCursor (
"SELECT name, sal FROM emp " ) ;
empcursor.open () ;
do
{
empcursor.fetch ();
if (empcursor.found ())
{
ename = (StringBuffer) empcursor.getValue (1, CHAR);
esal = (BigDecimal) empcursor.getValue (2, NUMERIC);
// NUMERIC and DECIMAL are synonyms
SQLResultSet.set (1, ename);
SQLResultSet.set (2, esal);
SQLResultSet.insert ();
}
} while (empcursor.found ()) ;
empcursor.close () ;
END