Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Database programming standards
It's trivial:
PreparedStatement pstmt = conn.prepareStatement ("update EMP set ENAME = ? where ROWID = ?");
pstmt.setString (1, ename.toLowerCase ());
pstmt.setString (2, rowid); // Pass ROWID to the update statement
pstmt.executeUpdate (); // Do the update
and you can also use this for output from stored procedures:
String str = new String("{call begin ? := function_name_here('something here');end}");
CallableStatement cs = db.prepareCall(str); cs.registerOutParameter(1, Types.INTEGER);
and then you can do a
cs.execute();
and
int value = cs.getInt(1);
It's really very, very easy to use. Of course, it helps if people read the manuals.
On Jun 3, 2004, at 8:37 AM, Duret, Kathy wrote:
>
> We have the same problem here, they don't want to write sql. They
> claim
> there is no way to use bind variables in Java (we are using Jbosse). I
> haven't had time to look into it. I would assume there is. Can
> someone
> point me to a link or forum?
>
> Thanks,
>
> Kathy
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu Jun 03 2004 - 10:50:56 CDT
![]() |
![]() |