oracle11gr2

Calculate the percentage of the root owned by its parents

大城市里の小女人 提交于 2019-12-04 09:12:50
问题 In simplified terms, I'm trying to calculate the percentage of the root of a tree owned by its parents, further up the tree. How can I do this in SQL alone? Here's my (sample) schema. Please note that though the hierarchy itself is quite simple there is an additional holding_id , which means that a single parent can "own" different parts of their child. create table hierarchy_test ( id number -- "root" ID , parent_id number -- Parent of ID , holding_id number -- The ID can be split into

Selecting both MIN and MAX From the Table is slower than expected

徘徊边缘 提交于 2019-12-02 22:02:56
I have a table MYTABLE with a date column SDATE which is the primary key of the table and has a unique index on it. When I run this query: SELECT MIN(SDATE) FROM MYTABLE it gives answer instantly. The same happens for: SELECT MAX(SDATE) FROM MYTABLE But, if I query both together: SELECT MIN(SDATE), MAX(SDATE) FROM MYTABLE it takes much more time to execute. I analyzed the plans and found when one of min or max is queried, it uses INDEX FULL SCAN(MIN/MAX) but when both are queried at the same time, it does a FULL TABLE SCAN. why? Test Data: version 11g create table MYTABLE ( SDATE DATE not null

Oracle PLSQL: xmltype.transform vs xmltransform

折月煮酒 提交于 2019-12-02 07:19:01
Since we have moved the database from 11.2.0.2.0 to 11.2.0.4.0 xmltype.transform function had got a specific behaviour. The problem is that before it did not work fine: it replaced all tags with open-close version (e.g. it did replace <br /> with <br></br> ), but I could live with it. Now it behaves the other way round (replaces everything with one tag) and it makes a big problem with <script></script> tag, because this tag must be explicitly closed with a </script> otherwise the browser thinks it is not closed, even if it is closed so <script /> => all web pages are corrupted now. Example:

Oracle PLSQL: xmltype.transform vs xmltransform

江枫思渺然 提交于 2019-12-02 07:11:26
问题 Since we have moved the database from 11.2.0.2.0 to 11.2.0.4.0 xmltype.transform function had got a specific behaviour. The problem is that before it did not work fine: it replaced all tags with open-close version (e.g. it did replace <br /> with <br></br> ), but I could live with it. Now it behaves the other way round (replaces everything with one tag) and it makes a big problem with <script></script> tag, because this tag must be explicitly closed with a </script> otherwise the browser

Eliminate duplicates using Oracle LISTAGG function [duplicate]

半世苍凉 提交于 2019-12-02 04:39:51
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: LISTAGG in oracle to return distinct values I am using Oracle LISTAGG function but within my list of returned names I actually would like to eliminate duplicates and only return distinct values. The query I have is something like this: select a.id, a.change_id, LISTAGG(b.name, ',') WITHIN GROUP (ORDER BY b.name) AS "Product Name", from table_a a, table_b b where a.id = 1 and b.change_id = c.change_id group by a

INSERT not working in cx_oracle when used with execute. How to get it working?

喜你入骨 提交于 2019-12-02 02:57:22
I am new to cx_oracle. I have established a connection and I am able to create and drop a table using execute. Where I am failing is when I try to use "INSERT INTO ..." in execute. It doesn't show any error but it doesn't store any value either (I confirmed this by checking if the entry had taken place using sqlplus from shell). The code I used was: table_name = "T1" column = "D" insert_value = "test value" sqlcode = "INSERT INTO "+table_name+" ("+column+") VALUES ('"+insert_value+"')" cursor.execute(sqlcode) Please help me, any help would be appreciated. Thanks in advance. J Venu Murthy How

Eliminate duplicates using Oracle LISTAGG function [duplicate]

帅比萌擦擦* 提交于 2019-12-02 00:58:45
Possible Duplicate: LISTAGG in oracle to return distinct values I am using Oracle LISTAGG function but within my list of returned names I actually would like to eliminate duplicates and only return distinct values. The query I have is something like this: select a.id, a.change_id, LISTAGG(b.name, ',') WITHIN GROUP (ORDER BY b.name) AS "Product Name", from table_a a, table_b b where a.id = 1 and b.change_id = c.change_id group by a.id, a.change_id At the moment, it is returning (just showing one record): 1 1 NameA, NameA, NameB, NameC, NameD, Name D What I would like returned is: 1 1 NameA,

Oracle 11G EM not working on Windows 7

假装没事ソ 提交于 2019-12-01 20:44:15
I have installed oracle 11G release 2 on my Windows 7 ultimate 64 bit computer but I am unable to run em. When I login it generates an error 'Internal error has occcured check log file for details' Following I have observed: Service ORACLEDBConsoleorcl has not started. When I execute emctl start dnconsole, it gives me an error "A specific service error occured: 2" followed by "more help is available by typing NET HELPMSG " After the installation database configuration assistant gave me a warning of "Error starting database control. Please execute the following commands Set the enviroment

Oracle 11G EM not working on Windows 7

梦想的初衷 提交于 2019-12-01 19:31:01
问题 I have installed oracle 11G release 2 on my Windows 7 ultimate 64 bit computer but I am unable to run em. When I login it generates an error 'Internal error has occcured check log file for details' Following I have observed: Service ORACLEDBConsoleorcl has not started. When I execute emctl start dnconsole, it gives me an error "A specific service error occured: 2" followed by "more help is available by typing NET HELPMSG " After the installation database configuration assistant gave me a

How to install Procedural Option in Oracle 11gr2

为君一笑 提交于 2019-12-01 11:27:30
I've been trying to create PL/SQL packages and running procedures on a local installation of Oracle 11gR2 on my computer, and I kept getting ORA-00900 error. Based on this article , it seems like Procedural Option has not been not installed. This is the output of sqlplus when I logged in: C:\Users\NgCH>sqlplus SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 14 13:11:34 2013 Copyright (c) 1982, 2010, Oracle. All rights reserved. Enter user-name: system@orcl Enter password: Connected to: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production SQL> How can I install it? If I've to reinstall