Product Documentation

FairCom Java Stored Procedures

Previous Topic

Next Topic

Manage

Manage() provides data management functionality for your application and/or process.

Below is the code for Manage():

DROP PROCEDURE Add_CustomerMaster_Record;

DROP PROCEDURE Delete_Records;

CREATE PROCEDURE Add_CustomerMaster_Record (

IN cm_custnumb CHAR(4),

IN cm_custzipc CHAR(9),

IN cm_custstat CHAR(2),

IN cm_custrtng CHAR(1),

IN cm_custname VARCHAR(47),

IN cm_custaddr VARCHAR(47),

IN cm_custcity VARCHAR(47)

)

BEGIN

SQLIStatement st = new SQLIStatement (

"INSERT INTO custmast VALUES (?,?,?,?,?,?,?)"

);

st.setParam (1, cm_custnumb);

st.setParam (2, cm_custzipc);

st.setParam (3, cm_custstat);

st.setParam (4, cm_custrtng);

st.setParam (5, cm_custname);

st.setParam (6, cm_custaddr);

st.setParam (7, cm_custcity);

st.execute();

END

CREATE PROCEDURE Delete_Records (

IN tablename CHAR(256)

)

BEGIN

SQLIStatement st = new SQLIStatement (

"DELETE FROM " + tablename

);

st.execute();

END

-- Manage

ECHO MANAGE;

ECHO Delete records...;

CALL Delete_Records('custmast');

ECHO Add records...;

CALL Add_CustomerMaster_Record('1000', '92867', 'CA', '1', 'Bryan Williams', '2999 Regency', 'Orange');

CALL Add_CustomerMaster_Record('1001', '61434', 'CT', '1', 'Michael Jordan', '13 Main', 'Harford');

CALL Add_CustomerMaster_Record('1002', '73677', 'GA', '1', 'Joshua Brown', '4356 Cambridge', 'Atlanta');

CALL Add_CustomerMaster_Record('1003', '10034', 'MO', '1', 'Keyon Dooling', '19771 Park Avenue', 'Columbia');

COMMIT WORK;

UPDATE custmast SET cm_custname = 'KEYON DOOLING' WHERE cm_custnumb = '1003';

ECHO Issue a COMMIT WORK to commit changes and release locks

TOCIndex