How to use Oracle XMLTable syntax

I have got a requirement to query against a XMLTYPE content and fetch the records from it.

XMLTable maps the result of an XQuery evaluation into relational rows and columns. So I am going to use this here.

Assume that we have a table called user_events which has two columns event_data and event_date. event_data is a XMLTYPE column. Now I want to query the user_events table and find out the list of users who have used the system for Jan month.

Here is the syntax.


select distinct userName from user_events e,
XMLTABLE ('user_events'
        PASSING e.event_data
        COLUMNS userName  VARCHAR2(50) PATH '/events/user/userName', 
                userId VARCHAR2(10) PATH '/events/user/userId')
where event_date >= '01-JAN-18' AND event_date <= '31-JAN-18'
order by userName asc; 


Advertisements

docker installation in ubuntu

The below steps are for installing the specific version of docker-ce in ubuntu


1. Run the below command to download the package.

wget https://apt.dockerproject.org/repo/pool/testing/d/docker-engine/docker-engine_17.05.0~ce~rc3-0~ubuntu-trusty_amd64.deb

2. Run the below command to install the same.
sudo dpkg -i docker-engine_17.05.0~ce~rc3-0~ubuntu-trusty_amd64.deb


The below steps are for installing the docker engine in ubuntu


1. Run the below command to find out the available version
sudo apt-cache showpkg docker-engine

2. Then select the specific version and run below to install the docker-engine. The below one is used to install 1.13.1 version of docker-engine. 
sudo apt-get install docker-engine=1.13.1-0~ubuntu-trusty