Friday, 3 August 2018

How to get rid off blank line in csv file using oracle sql or sql plus

SET NEWPGE NONE

The above command add in the sql script so that the blank line will get rid of from the  csv output file

Tuesday, 31 July 2018

Data Anonymisation

Data anonymization:
It  is a type of information sanitization whose intent is privacy protection. It is the process of either encrypting or removing personally identifiable information from data sets, so that the people whom the data describe remain anonymous.

Friday, 27 July 2018

Monthly data Extraction Logic using Oracle SQL

The following logic is used to get data from Database for monthly data extraction

For example if you want employee attendance data from DB for monthly then logic will be like shown in below

Select  Emp_attendance from Employee where Emp_attendance between add_months(trunc(sysdate,'mm'),-1) and last_day(add_months(trunc(sysdate,'mm'),-1)) ;

You can cross check whether the logic is getting correct dates or not by firing the below queries in sql developer or any tool you used to execute the queris

The below query will give you the first day date of  last month:
select add_months(trunc(sysdate,'mm'),-1) from dual;

The below query will give you the last day date of  last month:
select last_day(add_months(trunc(sysdate,'mm'),-1)) from DUAL;

Thursday, 5 July 2018

Java program to check the given two strings in an Array are anagrams or not

package learning;

import java.util.Arrays;

public class Anagram {

    public static void main(String[] args) {

        String[] s = new String[]{"raw", "aar"};
   
         char[] s0 = s[0].toLowerCase().toCharArray();
       
         char[] s1 = s[1].toLowerCase().toCharArray();

         Arrays.sort(s0);

         Arrays.sort(s1);
        
         if(Arrays.equals(s0, s1)) {
             System.out.println("The given two words in the array are anagrams");
       
        }
         else {
             System.out.println("The given two words are not anagrams");
         }

    }

}

Wednesday, 4 July 2018

Finding the possibility of Adding two numbers in an given array and finding the number which we give at runtime in java

package learning;

import java.util.Scanner;

public class FindingNoOfPossibilitiesOfAddingTwoNumbersInAnArray {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int s[] = { 1, 2, 3, 4, 5 };
        int a = s.length;
        System.out.println("Enter your number");

        int b = sc.nextInt();

        for (int i = 0; i < a; i++) {

            if (s[i] < a) {

                for (int x = a; x > i; x--) {
                    if (s[i] + s[x - 1] == b) {
                        System.out.println("s[i] is :"+s[i]);
                        System.out.println("s[x-1] is :"+s[x-1]);
                        System.out.println("The possible sum of two numbers is "+(s[i] + s[x - 1]));
                    }
                }
            }

        }

    }

}

Thursday, 31 May 2018

Websphere Basics

Questions & Answers
1. What is master repository?

A. Deployment manager contains the MASTER configuration and application files.
   All updates to the configuration files should go through the deployment manager.

2. What about IHS?

A. IHS (IBM HTTP Server) is one of the web servers.
   It serves the static content only and it takes up only http requests.

3. What about plug-in?

A. Plug-in is one of the modules it is interface between application server and web server,
   the plug-in process receives the request from the client first.
   If the request is for dynamic content,
   the plug-in diverts the request to the websphere application server.
   If the request is for static content,
   the plug-in forwards it to the Http server.

4. What is SSL?

A. ssl(secure socket layer) is a protocol for providing encrypted data communications between two processes.

5. What is the difference between web server and application server?

A. Application Server: takes care of Security, Transaction, Multithreading, Resource pooling,
   load balancing, clustering, performance, highly availability, scalability, etc.
   Exposes business logic to client applications through various protocols, possibly including HTTP.
   Supports deployment of .war and .ear files Application server = web server + EJB container.


6. Diff b/w weblogic and websphere?

A. Both BEA Weblogic and IBM’s WebSphere provide J2EE based application servers which are competitors.
   WebSphere leverages more on connectivity issues with MQ and legacy systems with strong dominance in J2EE.

Sunday, 26 November 2017

How to select a substring string between two special characters in a String using Oracle sql

SELECT SUBSTRING('abc(praveen)def()tutorial',INSTR('abc(praveen)def()tutorial','(',-1,1)-1,INSTR('abc(praveen)def()tutorial',')',-1,1)-1-INSTR('abc(praveen)def()tutorial','(',-1,1)-1) from DUAL;

The above query output is null

SELECT SUBSTRING('abc(praveen)def()tutorial',INSTR('abc(praveen)def()tutorial','(',-1,2)-1,INSTR('abc(praveen)def()tutorial',')',-1,2)-1-INSTR('abc(praveen)def()tutorial','(',-1,2)-1) from DUAL;

 The above query output is praveen