這是一個向數據庫插入的存儲過程,所有的參數都是輸出的,在Java裡可以這樣調用這個存儲過程,程序如下:
前面數據庫的連接我就不寫了
public boolean InsertOrtho(Ortho ortho, String childID)
{
boolean success = true;
try
{
CallableStatement stmt = con.prepareCall("{call InsertOrtho(?, ?, ?, ?, ?, ?, ?, ?)}");
stmt.registerOutParameter(1, Java.sql.Types.VARCHAR);
stmt.registerOutParameter(2, Java.sql.Types.TIMESTAMP);
stmt.registerOutParameter(3, Java.sql.Types.VARCHAR);
stmt.registerOutParameter(4, Java.sql.Types.INTEGER);
stmt.registerOutParameter(5, Java.sql.Types.VARCHAR);
stmt.registerOutParameter(6, Java.sql.Types.VARCHAR);
stmt.registerOutParameter(7, Java.sql.Types.VARCHAR);
stmt.registerOutParameter(8, Java.sql.Types.VARCHAR);
stmt.setString(1, childID);
stmt.setObject(2, ortho.GetDate());
stmt.setString(3, ortho.GetTherapistID());
stmt.setInt(4, ortho.GetClinicID());
stmt.setString(5,