Posted by: piman007 | 08-05-2007

INSERT & RETURNING

        ConnDB objConnDB = new ConnDB();
        Connection conn = null;
        try {
            conn = objConnDB.getConnection();
            String query = "BEGIN insert into df101(branch_owner) values(‘200’) returning id into :i; END;  ";
            OracleCallableStatement cs = (OracleCallableStatement)
            conn.prepareCall(query);
            cs.registerOutParameter(1, oracle.jdbc.OracleTypes.VARCHAR);
            cs.execute();
            System.out.println(cs.getString(1));                   
           
        } catch (Exception ex) {
            ex.printStackTrace();
        }

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

หมวดหมู่

%d bloggers like this: