Skip to content

Instantly share code, notes, and snippets.

var open = $('#open').is(':checked')
var close = $('#close').is(':checked')
$("#projects").multiselect("getChecked")
create index i4_mvtable on mvtable(c1||c2||c3, c4, c3);
create index i5_mvtable on mvtable(c1, c4, c3);
exec dbms_stats.gather_table_stats (ownname => 'abcDBA01',tabname => 't_table_name',estimate_percent=> 100,cascade => true);
<%
String filename = "/sanvol/app/folder1";
out.println(filename);
java.io.File f = new java.io.File(filename);
out.println(f.isDirectory());
javax.naming.InitialContext ic = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ic.lookup("java:oasDS");
out.println(ds);
- insertion and retrieval of the unique id is done in two steps(two db calls) if you were to implement using java approach. this can be simplied if you were to implement it in stored procedure.
- Maintenance of any structural changes are always easier at oracle/db end when compared to doing it at java end
- code is much cleaner if done at db end rather than doing it at java end
- perfect use case which is in favor of keeping the save logic at the DB end is
Multiple saves in One Single page
Project -> Project
Project -> ProjectBusiness
Project -> businesses
Project -> country
@shaik2many
shaik2many / oracle merge.sql
Last active August 29, 2015 14:04
oracle merge
merge into tims_idr_agent t
using (select 1 from DUAL) s
on (t.id = p_id AND t.audit_cycle = p_audit_cycle)
when matched then
update set t.name = 'Alan1',t.phone = '-2932x',t.email = 'Alan@v1',t.category = 'Domestic1'
when not matched THEN
INSERT (audit_cycle,ID,NAME,phone,email,category)
VALUES(p_audit_cycle,p_id,p_name,p_phone,p_email,p_category);
@shaik2many
shaik2many / java-ascii-strip
Created October 20, 2014 18:10
Strip ASCII
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
public class StringUtil {
private static final Pattern REGEX_PATTERN = Pattern.compile("[^\\p{ASCII}]+");
public static String stripNonAsciiChars(String input, String repalceCharWith) {
return (StringUtils.isBlank(input)) ? null :
REGEX_PATTERN.matcher(input).replaceAll(repalceCharWith);
@shaik2many
shaik2many / java-thread.java
Created November 7, 2014 17:21
java threading
public class TestThread {
public static void main(String[] args) {
String[] workitems = {"Quran", "Coummnity Service", "Teaching", "Business"};
for (String name : workitems) {
new Thread(new DoWork(name)).start();
}
System.out.println("Done....");
}
}