update & delete query !
can u tell me update & delete query that i can use to connect jdatastore...
i use this query statements...but i got error
for delete:
appendPStmt = conn.prepareStatement("DELETE FROM \"info\" WHERE \"info\".\"name=\""+name);
appendPStmt.executeUpdate();
for update:
appendPStmt = conn.prepareStatement( "UPDATE \"info\" SET \"info\".\"password=\""+npwd+" WHERE \"info\".\"name=\""+name);
appendPStmt.executeUpdate();
[469 byte] By [
Ivya] at [2007-11-27 2:35:41]

# 1
Please don't doublepost and proceed here http://forum.java.sun.com/thread.jspa?threadID=5166138
# 2
sorry for my double post!coz my connection is not too good..when i post once...i see only white page...so i think it is not send...so....i post again.......sorry!thz for ur help !
Ivya at 2007-7-12 2:54:15 >

# 3
appendPStmt = conn.prepareStatement("DELETE FROM info WHERE info.name="+name);
appendPStmt = conn.prepareStatement( "UPDATE info SET info.password="+npwd+" WHERE info.name="+name);
plz, post the error message you got because we can't guess it !
# 4
Check the other thread ..
# 5
Try:
int result = 0;
String deleteSQL = "DELETE FROM info WHERE info.name= ?";
appendPStmt = conn.prepareStatement(deleteSQL);
appendPStmt.setString( 1, name );
result = appendPStmt.executeUpdate();
for update:
String updateSQL = "UPDATE info SET info.password= ? WHERE info.name= ?);
appendPStmt = conn.prepareStatement(updateSQL);
appendPStmt.setString( 1, npwd );
appendPStmt.setString( 2, name );
result = appendPStmt.executeUpdate();
# 6
In terms of the replies suggested above....please be aware that SQL (meaning most databases) support quoted identifiers. Thus the following is in fact valid SQL.select * from "mytable"Whether that is applicable or not in this thread depends on the database.
# 7
The one I am working on does not ... Oracle 9i
# 8
> The one I am working on does not ... Oracle 9iDoes not what? Support quoted identifiers? Yes it does.
# 9
If I run:
select count(*) from 'xtable'
Or if I substitute the double quotes for the single, I get table name does not exist.
Are you saying that the DB admin has control over the config of that - something I never see?
~Bill
correction ... it's "invalid tablename"
# 10
> If I run:
>
> select count(*) from 'xtable'
>
> Or if I substitute the double quotes for the single,
> I get table name does not exist.
>
The actual form is double quotes.
If you have a table name xtable in your database (presuming no quotes) then the following should actually return something.
select count(*) from "XTABLE"
> Are you saying that the DB admin has control
> over the config of that - something I never see?
Not sure what you mean, however I think SQL Server database setup can disallow the use of quoted identifiers. The default is to allow it. I don't believe Oracle allows for that. It could though.
Note again that this is part of ANSI SQL.
# 11
By the way, my position on the use of quoted identifiers is that they shouldn't be allowed in the first place. And if they are in use then they should be removed.I certainly never met an Oracle DBA that recommended nor would even tolerate their usage.
# 12
> > If I run:
> >
> > select count(*) from 'xtable'
> >
> > Or if I substitute the double quotes for the
> single,
> > I get table name does not exist.
> >
>
> The actual form is double quotes.
>
> If you have a table name xtable in your database
> (presuming no quotes) then the following should
> actually return something.
>
> select count(*) from "XTABLE"
NoGo ... I tried that and it does not matter (I can't retry anything now because I am no longer at work BTW) ... However, I tried wrapping it in single quotes (as I displayed), double quotes (as I said and as you displayed) and even three single quotes on each end. The result is always the same - 'Invalid tablename":
>
> > Are you saying that the DB admin has control
> > over the config of that - something I never see?
>
> Not sure what you mean, however I think SQL Server
> database setup can disallow the use of quoted
> identifiers. The default is to allow it. I don't
> believe Oracle allows for that. It could though.
>
What I meant is that, since I can't get the results from it that you mentioned above, I figured that perhaps there is some config the DBA can make to allow or disallow the use of what we're talking about - that's all
> Note again that this is part of ANSI SQL.
# 13
At any rate - OP - did you try what I posted in post #5?
# 14
> > The actual form is double quotes.
> >
> > If you have a table name xtable in your database
> > (presuming no quotes) then the following should
> > actually return something.
> >
> > select count(*) from "XTABLE"
>
> NoGo
Maybe there is a way to turn it off then.
Here is the documentation, search for the following for examples "Nonquoted identifiers are not case sensitive. "
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements9a.htm
# 15
> > > The actual form is double quotes.
> > >
> > > If you have a table name xtable in your database
> > > (presuming no quotes) then the following should
> > > actually return something.
> > >
> > > select count(*) from "XTABLE"
> >
> > NoGo
>
> Maybe there is a way to turn it off then.
>
> Here is the documentation, search for the following
> for examples "Nonquoted identifiers are not case
> sensitive. "
>
> http://download-west.oracle.com/docs/cd/B10501_01/serv
> er.920/a96540/sql_elements9a.htm
Thank you sir! I did not need to use the link - just those two magic words (case sensitive) in your last post was all it took to straighten me out.
I had not even thought to try that before, but as soon as I keyed in the DB table name in upper-case and then placed the double quotes around it, it recognized it. I admit that I should have considered that in light of the quotes, but it did not click until then.
Good thing to know - thank you.
~Bill
# 16
>
> I had not even thought to try that before, but as
> soon as I keyed in the DB table name in upper-case
> and then placed the double quotes around it, it
> recognized it. I admit that I should have considered
> that in light of the quotes, but it did not click
> until then.
>
It gave you that weird error message just because the case was different?
# 17
select count(*) from "tableX"Oracle O00942 - Table or view does not existselect count(*) from "TABLEX"Good to go!
# 18
> select count(*) from "tableX"> Oracle O00942 - Table or view does not existGood - I thought it should look like that.