Skip to content

Tag: oracle

Oracle XMLTYPE extract root prolog value

I have sample Query with XML like below: Output: I am trying to fetch the values below within the query or a new query: Is there any way to do that? Any help / direction appreciated. Answer You just have to complete your first XMLTABLE query (h) in this way:

Oracle complex query with hierarchy

Following is my Sample data1 Expected Output1 Here column “CP” and “NNP” are hierarchical (i.e.) we will start with query like below, for a particular NP and then get the corresponding MC and DS values using the below logic first look at value A from column CP and then see if column NN…

One value for a group of columns in sql

I have the columns like this, all columns coming from three different tables. i want the columns like Can you help me with this? Thanks Answer i am just enhancing Tim answer by adding lag() window function DEMO

Getting an element and the next from a table

I have a table with ids, cities and some sequence number, say: I want to get the city that comes after Rome for the same id, in this case, I can order them by doing something like: I get: and, I want to get How do I proceed? Answer Hmmm . . . I might suggest window functions:

Common Data Type in Oracle for reusability

I have data type with fixed column data type and size. For example, If you see above I have CREATE_USER char(36) in almost all tables. I want to make it replaceable. So that in future I can change the type/size. For example, I call it CREATE_USER myDataType, so that in future I need to replace it only one pla…