Product Documentation

FairCom Java & .NET Stored Procedures

Previous Topic

Next Topic

DhSQLResultSet.set

Sets the field in the currently-active row of a procedure’s result set to the specified value (a literal, procedure variable, or procedure input parameter).

Format

public void set(int field, Object val)

Returns

None

Parameters

field

An integer that specifies which field of the result-set row to set to the value specified by val (1 denotes the first field in the row, 2 denotes the second, and so on).

val

A literal or the name of a variable or input parameter that contains the value to be assigned to the field.

Throws

DhSQLException

Example


CREATE PROCEDURE get_sal2 ()

RESULT (

empname CHAR(20),

empsal NUMERIC,

)

BEGIN

StringBuffer ename = new StringBuffer (20) ;

BigDecimal esal = new BigDecimal () ;

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);


SQLResultSet.set (1, ename);

SQLResultSet.set (2, esal);

SQLResultSet.insert ();

}

} while (empcursor.found ()) ;

empcursor.close () ;

END

Note: The resultset parameter empname in the procedure above should be of type CHAR in ANSI versions of FairCom DB SQL.

TOCIndex