Product Documentation

FairCom Java & .NET Stored Procedures

Previous Topic

Next Topic

SQLCursor.setParam

Sets the value of a FairCom DB SQL statement’s input parameter to the specified value (a literal, procedure variable, or procedure input parameter). This method is common to the SQLCursor, SQLIStatement, and SQLPStatement classes.

Format

public void setParam(int f, Object val)

Returns

None

Parameters

f

An integer that specifies which parameter marker in the FairCom DB SQL statement is to receive the value (1 denotes the first parameter marker, 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 parameter marker.

Throws

DhSQLException

Example


CREATE PROCEDURE sps_setParam()

BEGIN

// Assign local variables to be used as SQL input parameter references

Integer ins_fld_ref = new Integer(1);

Integer ins_small_fld = new Integer(3200);

Integer ins_int_fld = new Integer(21474);

Double ins_doub_fld = new Double(1.797E+30);

StringBuffer ins_char_fld = new StringBuffer("Athula");

StringBuffer ins_vchar_fld = new StringBuffer("Scientist");

Float ins_real_fld = new Float(17);


SQLPStatement insert_sfns1 = new SQLPStatement ("INSERT INTO sfns"

+ "(fld_ref,small_fld,int_fld,doub_fld,char_fld,vchar_fld)"

+ "values (?,?,?,?,?,?)" );


insert_sfns1.setParam(1,ins_fld_ref);

insert_sfns1.setParam(2,ins_small_fld);

insert_sfns1.setParam(3,ins_int_fld);

insert_sfns1.setParam(4,ins_doub_fld);

insert_sfns1.setParam(5,ins_char_fld);

insert_sfns1.setParam(6,ins_vchar_fld);

insert_sfns1.execute();

END

TOCIndex