gudii9
asked on
query syntax
I was going through following link.
http://www.roseindia.net/tutorial/java/poi/insertExcelFileData.html
I have not understtod below query syntax
int k=stat.executeUpdate("inse rt into login(username,password) value('"+username+"','"+pa ssword+"') ");
>>login(username,password)
is login is the name of the table with columns names username,password in the paranthesis?
I need to build select query similar way.
Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
http://www.roseindia.net/tutorial/java/poi/insertExcelFileData.html
I have not understtod below query syntax
int k=stat.executeUpdate("inse
>>login(username,password)
is login is the name of the table with columns names username,password in the paranthesis?
I need to build select query similar way.
Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>Do I need to give any commit statement in the java code explicitly.
It is good coding practice to physically commit or rollback and not rely on the 'default' action.
>> I got as 1
I don't know what this means. If it is a return code, does a 1 mean successful? Remember I'm not a Java guy.
It is good coding practice to physically commit or rollback and not rely on the 'default' action.
>> I got as 1
I don't know what this means. If it is a return code, does a 1 mean successful? Remember I'm not a Java guy.
ASKER
I was checking below command
select count(*) into <variable_1> from dual where exists (select null from XYX_Table where col1=<variable_2> and col2=<variable_3>);
I am getting 1 even when record is there or not from java program.
And getting 0 from toad always. Please advise
select count(*) into <variable_1> from dual where exists (select null from XYX_Table where col1=<variable_2> and col2=<variable_3>);
I am getting 1 even when record is there or not from java program.
And getting 0 from toad always. Please advise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
follow-up question posted here for that 2nd question:
https://www.experts-exchange.com/questions/27845679/sql-query.html
https://www.experts-exchange.com/questions/27845679/sql-query.html
the "1" (or "0") is normally the number of rows affected.
ASKER
>>whenever you use the count() only the field in the select clause, it will always return a single row.
can you please elaborate on this. I am not clear on this
I have gone through the link
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:19398056075583
I have not clearly understood about bind variables and their significance with prepared statements
>>>
Followup June 8, 2004 - 3pm Central time zone:
I was pointing out that in this sequence of code:
39 PreparedStatement pstat =
40 conn.prepareStatement
41 ("Select this is not really SQL now is it?" );
42
43 pstat.setString( 1, ename_like );
44 ResultSet rset = pstat.executeQuery();
45
the statement is not parsed by the server, in fact not sent to the server, until line 44 -- so we
do in fact have access to the bind variable values at parse time.
Please advise
can you please elaborate on this. I am not clear on this
I have gone through the link
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:19398056075583
I have not clearly understood about bind variables and their significance with prepared statements
>>>
Followup June 8, 2004 - 3pm Central time zone:
I was pointing out that in this sequence of code:
39 PreparedStatement pstat =
40 conn.prepareStatement
41 ("Select this is not really SQL now is it?" );
42
43 pstat.setString( 1, ename_like );
44 ResultSet rset = pstat.executeQuery();
45
the statement is not parsed by the server, in fact not sent to the server, until line 44 -- so we
do in fact have access to the bind variable values at parse time.
Please advise
>>I have not clearly understood about bind variables and their significance with prepared statements
Using bind variables reduces the risk of SQL Injection and Hard parsing. Don't try to understand the entire thread since it is talking about bind variable peeking. That isn't what I was eanting you to take from it. Just the Bind variables themselves.
Using bind variables reduces the risk of SQL Injection and Hard parsing. Don't try to understand the entire thread since it is talking about bind variable peeking. That isn't what I was eanting you to take from it. Just the Bind variables themselves.
ASKER
int k=stat.executeUpdate("inse
Do I need to give any commit statement in the java code explicitly. Please advise