Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Database programming standards

Re: Database programming standards

From: Fernando <fernandoluis_at_mac.com>
Date: Thu, 3 Jun 2004 08:54:00 -0700
Message-Id: <3B063EDE-B576-11D8-8C74-000A95A6AB02@mac.com>


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



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US