Skip to main content

Content Extracting From 'CLOB' type Columns in SQL Querries

Extracting XML node value from CLOB  column in data base.

Syntax

ExtractValue(xml_fragment, xpath_expression)

Query Syntax

Select Extractvalue(XMLtype('<column name>'),'<XML node path>')
From <table list>
Where <conditions>

Example

Select Extractvalue(Xmltype(emp_xml), '/employees/empployee/emp_number')
From employee 
where  Status='A';

Updating a XML node value from CLOB  column in data base.

Syntax


UpdateXML(xml_target, xpath_expr, new_xml)

Query Syntax

Update table_name Set column_name=Updatexml(Xmltype('<column name>'),'<XML node path>','<Replacing XMLvalue'>).getclobval
From <table list>
Where <conditions>;

Example

Initial value /employees/empployee/emp_name/text() = Bhargava

Update employe Set emp_name = Updatexml(Xmltype(emp_xml), '/employees/empployee/emp_name/text()','Bhargava Surimenu')
where  emp_no=1207;

Comments

Popular posts from this blog

Spring Reactive Stack

Basic Sortings (Bubble, Selection and Insertion Sorts)

public class BasicSortings { public static void main(String[] args) { int temp; int iterationCount = 0; int array[] = { 2, 33, 29, 30, 21, 98}; //Bubble sort or Simple sort for (int i = 0; i < array.length - 1; i++) { for (int j = i + 1; j < array.length; j++) { if (array[i] > array[j]) { temp = array[i]; array[i] = array[j]; array[j] = temp; } iterationCount++; } } System.out.println("Bubble Sort Big 0(n) --> " + iterationCount); for (int s = 0; s < array.length; s++) { System.out.print(array[s] + "\t"); } System.out.println("\n"); System.out.println("\n"); //Selection Sort iterationCount =0; int sortPointer=0; for (int i = sortPointer; i < array.length; i++) { for(int j=i+1;j< array.length;j++) { if(array[i] > array[j]) { temp = array[i]; array[i] = array[j]; array[j] = temp;

Compress a String

package com.sbs.java8.praticse; public class StringCompression { public StringCompression() { // TODO Auto-generated constructor stub } public static void main(String[] args) { System.out.println(compressString("aaaabbbbbccccAAAAccccccccdefg")); } public static String compressString(String str) { //String str = "aaaabbbbbcccc"; char[] charArray = str.toCharArray(); String compressedString = ""; int i = 0; while (i < charArray.length) { int counter = 1; int j = i + 1; while (j < charArray.length && charArray[i] == charArray[j]) { counter++; j++; i++; } compressedString = compressedString + charArray[i] + counter; i++; } //System.out.println(compressedString); String output =(compressedString.length() > charArray.length)? str: compressedString; return output; } }