11 votes
Accepted

Simple Oracle connection using JDBC

Minor detail: I prefer putting a closing parenthesis on its own line when the content between parentheses spans more than one line. (Basically, it looks like one-true-brace style with parentheses ...
jpmc26's user avatar
  • 1,233
9 votes
Accepted

Build WHERE clause for search conditions

Sanitizer is a dangerous misnommer IMO. A better name could be NameQuoter, since that's what it does: it uses the RDBMS-specific ...
Mathieu Guindon's user avatar
6 votes

Simple Oracle connection using JDBC

In addition, you should always close your ResultSet and your Statement explicitly. (Or: also use these in a try-with-resources block, and yes, both are AutoCloseable.) The background is, that these ...
mtj's user avatar
  • 4,812
5 votes
Accepted

Oracle SQL multiple count query

Consider using conditional aggregations to avoid the multiple subqueries: ...
Parfait's user avatar
  • 960
5 votes

Simple Oracle connection using JDBC

There is one important thing you should always do if working with a database: You should always close the connection. Therefore I would suggest adding a finally ...
Heslacher's user avatar
  • 50.4k
5 votes

Build WHERE clause for search conditions

Just one thing... Use db-provider's sanitizer There is already a sanitizer that the DbCommandBuilder provides. You can use it like this: ...
t3chb0t's user avatar
  • 44.3k
4 votes

Simple Oracle connection using JDBC

primitive obsession Your method has a long parameter list and all parameters are of same primitive type. (strictly speaking a String is not a primitive, but I ...
Timothy Truckle's user avatar
4 votes
Accepted

File names to database table

folder = r'\\my\network\folder' subfolder_list = [r'\DRAWINGS', r'\DOCUMENTS', r'\VIDEOS'] Don't write the type into the variable name. The type should be able to ...
Raimund Krämer's user avatar
4 votes
Accepted

Generating and storing a unique salt in Oracle database using Java

Please use best practices in general when dealing with password hashing. If you have to verify the database for your generated salt to be unique, you're using a bad salt generator. Make sure to focus ...
dfhwze's user avatar
  • 13.9k
3 votes

Script for updating an Oracle database

Happy things Thanks for use strict. That is smart. I'm also a fan of the 3-argument form of open. That can avoid a few subtle ...
chicks's user avatar
  • 2,875
3 votes

Script for updating an Oracle database

Some basic refactoring, and using ? placeholders in sql queries, ...
mpapec's user avatar
  • 1,176
3 votes
Accepted

Extract data from a DBMS, create a CSV dump and transfer it to an FTP server

Class members Don't use class members if local variables are enough. For example here: ...
janos's user avatar
  • 111k
3 votes
Accepted

Oracle trigger to keep a copy of deleted records in another table

I am using this trigger to keep a copy of the deleted record from table Orders_Details in table Orders_Details_Deleted. No, you're not. The code copies all rows from ...
user272735's user avatar
3 votes
Accepted

Select non-task workorders, but include the costs of the tasks

I know you say that I plan to use the view for multiple reports. So I've included all 265 columns in the view via select * but given the truly absurd column count in that table, I would consider a ...
Reinderien's user avatar
2 votes
Accepted

Check user changed his password recently or not in specific period

Your query doesn't returns a result when there's no id matching 'some_id'. Well, there's a trick to force a row, use an ...
dnoeth's user avatar
  • 1,172
2 votes

Create multi-dim array from cursor

You are asking if you can speed up the assignment into the array? I don't think you will be able to get a notable speed improvement on this part no. This should be completely negligible compared to ...
Milney's user avatar
  • 230
2 votes

Compare Oracle Table with SQL Server Table and Update/Insert

This code queries the SQL server 15K times (for each and every employee in the Oracle view). Suggest generating the SQL query based on the Oracle view data set and retrieve the data from SQL in one go ...
Christie's user avatar
  • 121
2 votes
Accepted

Exception handling and releasing of OracleDB connection

There really isn't too much to say about your posted code. Answering your specific question: Yes, the connection will always be released as either your then or your catch method will always run. ...
Gerrit0's user avatar
  • 3,456
2 votes
Accepted

Update pass-through query from a form (an alternative to stored procedures)

The first thing I would suggest is to avoid as much as possible depending on the DoCmd object. The DoCmd object is essentially ...
this's user avatar
  • 2,029
2 votes

Employee Compensations Query

This really should be put into a table, if possible. If such a table already exists, you can take the SELECT for your existing view and simply wrap an ...
coyote's user avatar
  • 41
2 votes

Refactoring the legacy code which is using '§' char in the code

I don't see you using std::, surely you didn't put using namespace std somewhere in your code right? I find your parameter ...
yuri's user avatar
  • 4,458
2 votes
Accepted

Calling an Oracle Stored Procedure with C# Code

I could see using it for the connection, command and reader since they implement IDisposable and the documentation for them does say to always call Dispose(). For the parameters it seems not only ...
Eric H's user avatar
  • 168
2 votes

Query for customer quotes by date range

I think the query is optimal enough. The truth is query can retrieve a result only by accessing 2 years data, so given WHERE condition is must. And the query access ...
kangbu's user avatar
  • 121
2 votes

String manipulation over 2 tables in database to application

Even if I don't know the actual content, joining tables on client-side is basically a bad idea because you have to load the whole content to the client. As BCdotWEB mentioned in the comment, the ...
JanDotNet's user avatar
  • 8,538
2 votes
Accepted

Seek to get acceptable performance of SQL request (SOLVED)

The query plan seems to be too complicated because all_constraint is a view and not table. So it's difficult to derive what it's doing. But from common sense it ...
ichalov's user avatar
  • 36
2 votes

Updating a huge hashmap from a resultset

there was an issue with the code, I was obligated to add the SQLException to the method, since the code was not compiling otherwise. Before ...
Doi9t's user avatar
  • 3,316
2 votes

Clubbing three queries that return mutually exclusive records

You can use aggregation like this: ...
RoToRa's user avatar
  • 11k
2 votes
Accepted

capturing counts of open items between dates

In looking at your query, I think there may be a few things you can do to improve your performance. The first is that you can aggregate your ticket_table ahead of time based on the request interval. ...
Del's user avatar
  • 138
2 votes

Is this PL/SQL Stored proc optimal?

As mentioned, consider MERGE to handle the conditional INSERT and UPDATE actions. Doing so, ...
Parfait's user avatar
  • 960
1 vote
Accepted

SQL Statement with a Select Statement Inside a Where Clause

Here is what I ended up with: ...
ADH's user avatar
  • 336

Only top scored, non community-wiki answers of a minimum length are eligible