oracle stored procedure update with parameters

CREATE OR REPLACE PROCEDURE update_log_proc(plids IN VARCHAR2,pparas IN NCLOB,msg IN NCLOB) AS
BEGIN
UPDATE g3_log_info SET paras=pparas,xml_data=msg WHERE lids=plids;
END;


Database execution:
execute update_log_proc('0000000000237876','clerk','msg')



java code call:

/**
     * Call the stored procedure to update the log data
     * @param lids primary key
     * @param para interface parameter
     * @param msg return information
      */ 
    public  static  void callpProcedure(String lids,String para,String msg) {
        Connection connection = null;
        CallableStatement cs = null;
        try {
            connection = GsUtil.getConnection();
            cs = connection.prepareCall(" call update_log_proc(?,?,?) ");
            cs.setString(1, lids);
            cs.setString ( 2 , para);
            cs.setString(3, msg);
            cs.execute();
        } catch (SQLException e) {
            e.printStackTrace ();
        } finally {
            try {
                if (cs != null) {
                    cs.close();
                }
                if (connection != null) {
                    connection.close();
                }
            } catch (SQLException e) {
                e.printStackTrace ();
            }
        }
    }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325946252&siteId=291194637
Recommended