If we want to know the number of instances, number of RAC databases and whole total disk space used by oracle (not file system size),1. Any script can be ran from OEM grid control against all instances/databases? or2. we have a repository unix server which has all tnsnames of whole databases, any script we can run from there?
Is it possible to sort records based on hierarchy in such a way that records sorts in sequence and records of same level comes in the last (in sorting order)
To use dynatree (URL] I want the result to be in the xml form.but the result is not what I want.
SELECT XMLELEMENT("div",xmlattributes('tree' AS "id"), (SELECT DBMS_XMLGEN.getXMLType( DBMS_XMLGEN.newContextFromHierarchy(' SELECT LEVEL, case when CONNECT_BY_ISLEAF = 0 then
We are on oracle 10.2.0.4 on solaris 10. My question is on a sql query. Is it possible to rewrite a query to avoid the connect by and prior constructs and use joins? For example i have the following query:
SELECT empno, ename, job, mgr, hiredate FROM emp START WITH empno in (7566,7698) CONNECT BY PRIOR empno = mgr
How can it be rewritten using a two table join (self join)? I am not sure if it can be done and whether it is possible.
EMP_ID EMP_NAME MANAGER_ID 1 KING 2 STEVE 1 3 FRANK 2
What I want is when I query for any EMP_ID, I want to get all his manager first, and the last record is the employee in leaf of the hierarchy in the query.
For example, when I query for EMP_ID=2 ,I want to get this result
EMP_ID EMP_NAME MANAGER_ID 1 KING 2 STEVE 1
and when I query for EMP_ID=3 ,I want to get this result:
EMP_ID EMP_NAME MANAGER_ID 1 KING 2 STEVE 1 3 FRANK 2
I have a table which contains two columns containing the range of some products. These range are alphanumeric and i want to calculate the count of this range by a query. .
test case: CREATE TABLE MARRIAGE_FILE_NAME ( START_SERIAL_NO VARCHAR2(10 BYTE) NOT NULL, END_SERIAL_NO VARCHAR2(10 BYTE) NOT NULL, CATCODE VARCHAR2(10 BYTE) NOT NULL,
I need to modify my query so that it can give me a total(duration) and total(stlmntcharge) per day in april 2013 starting from the 1st till the 30th. At the moment my query looks like below:
SELECT sum(duration),sum(stlmntcharge) FROM voipcdr WHERE (calldate >= TO_DATE('20130401','YYYYMMDD') AND calldate <= TO_DATE('20130430','YYMMDD')) AND (remtrunkid IN (SELECT UNIQUE trunkid FROM trunks WHERE description LIKE '%Telkom%' AND gw_range_id = '61' AND trunkid like '9%'))
or remip in(SELECT UNIQUE startip FROM gateways WHERE rangename LIKE 'vo-za%' OR rangename LIKE 'PC-IS-VOIS%')
I want to get any employee name of deptno 10 but total count of number of employees under dept 10.
DECLARE l_deptno NUMBER:=10; l_count NUMBER; l_ename varchar2(20); BEGIN SELECT count(*) OVER(order by empno) ,ename INTO l_count,l_ename FROM emp WHERE ROWNUM=1 and deptno=l_deptno; dbms_output.put_line(l_count||' '||l_ename); end;
I need the following totals for each student based on the schools that they are enrolled for each month July through June.
Total Days Suspended from each school
Attendance Table Columns - Absent Date, Absent Code, Pupil_Number, School (Absent Codes for suspended = 3)
Total Days Present at each school - Days Enrolled at each school minus Days Suspended minus Absences
Totals Takes the first day that a student is enrolled (counts the days that the school is in session and the student is not marked absent) Student must be enrolled during the time frame for that month.
Total Days Absent - Total days absent minus suspensions
Examples Student enrolls in school 11111 on 7/15/2011 Student withdraws from School 11111 on 11/15/2011 Student enrolls in school 22222 on 11/20/2011
Total Days Present should be totaled for each student for each month that they are in a school.
I need 1 row of data for the above student for each month that contains total days suspended, total days present and total days absent. Pupil Number School Month Totals Days Suspended Total Days Absent Total Days Present
1234 11111 07 0 0 0 1234 11111 08 0 0 4 (school days 4) 1234 11111 09 3 1 16 (schools days 20 - 3-1) 1234 11111 10 0 1 18 (school days 19 - 1) 1234 11111 11 1 1 7 (student enrolled at school A 9 days -1-1) 1234 22222 11 0 1 10 (student enrolled at school B 11 days -1) 1234 22222 12 1 2 17 (school B 20-1-2) 1234 22222 01 0 0 20
Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: [URL] .........
order = the sequence in which they are to be displayed a sub-heading's heading_id refers to the parent heading, likewise an item's sub-heading_id refers to the parent sub-heading.
I assumed there was no need to track child content.
Now, the output format should be something like this, where the sub-headings are not repeated, nor are the items. Sort of like chapters in a book, things in a catalogue, or even topics in a forum.
Where I'm getting hung up is how to query the data so it's quick, efficient, clean and easy to read and maintain. I've only gotten to listing the sub-headings and already the query looks convoluted. So, how should I approach this? Should it be done all in one query, and always checking against the results to know when to print a new heading or sub heading. Or should I run multiple queries and save the results to a variable, and then run sub-queries off that? Is there a better way to do this, am I going about it the hard way or am I in the right direction and just haven't gone far enough with it yet?
Example: I expect the rows with H8889,H9955 & P6666 & P5555 to be sub-category values value for product hierarchy H555888.
If there are rows with H8888987 as Product_hierarchy, we will pull up those rows too for product hierarchy H555888. The extra condition is we drill down only on 7 character mod_prod_number not on 5 character mod_prod_number. We pull out all sub category mod_prod_number for all distinct Product hierarchy.
In the above resultset PART='SUBPART1' does'nt have any child as evident from the connect_by_isleaf (LEAF=1) .Is there any way to create a pseudo record if such values are returned by the query, i.e., if a part has no tree under it a dummy record should be created i.e. in this case an additional record should be returned by this query. i.e., as below. the LEVEL=3 record should be created.
Is it possible to find the locked objects in hierarchical order. Consider the below example
--Connect to scott schema create table block_session(a NUMBER, b VARCHAR2(100)) / insert into block_session select rownum,rownum*10 from dual connect by level<=10 / COMMIT / GRANT ALL ON block_session to HR / update scott.block_session SET a=10 where b=10 [code]......
Is it possible to get all locked table details in hierarchical order?
INSERT INTO NODE_LVL VALUES('TBL_APL','TBL_AFL'); INSERT INTO NODE_LVL VALUES('TBL_APP','TBL_ACS'); INSERT INTO NODE_LVL VALUES('TBL_ADD','TBL_ADW'); INSERT INTO NODE_LVL VALUES('TBL_ADP','TBL_ADV'); INSERT INTO NODE_LVL VALUES('TBL_AOP','TBL_AOV'); [code]......
Table 'TBL_APP' is having 2 parent nodes i.e 'TBL_AOV' and 'TBL_ADV' SELECT * FROM node_lvl WHERE child_node = 'TBL_APP';
At level 5 there is duplicate nodes i.e 'TBL_APP' and 'TBL_ACS' as parent_node and child_node respectively.
SELECT PARENT_NODE, CHILD_NODE, LEVEL FROM NODE_LVL START WITH PARENT_NODE = 'TBL_ACF' CONNECT BY PRIOR CHILD_NODE = PARENT_NODE;
I want to suppress such duplicates. So I added DISTINCT
SELECT DISTINCT PARENT_NODE, CHILD_NODE, LEVEL FROM NODE_LVL START WITH PARENT_NODE = 'TBL_ACF' CONNECT BY PRIOR CHILD_NODE = PARENT_NODE;
BUT requirement is to maintain the same order (of hierarchy) as it was before adding DISTINCT.
I want to build a hierarchy and output it into a sub-report. Since the data in few hierarchy fields exceeds 4000 characters and therefore m getting the ORA-01489 error and the entire report was failing.
So i have used user aggregate function to print the out put. I have also used row_number() to print sequence in query output.
ID Causality -- ------ 3755101 )Blisters (Blister) Causality as per report1: Probable Causality as per report2: Possible Dechallenge : Not Applicable Rechallenge : Not Applicable 2 )Mental status changes (Mental status changes) [code].......
but the expected out put is
ID Causality -- ------ 3755101 )Blisters (Blister) Causality as per report1: Probable Causality as per report2: Possible Dechallenge : Not Applicable Rechallenge : Not Applicable [code]........
but it should be as
1) 2) 3) .. .. .. 10) 11) 12) for the values in the causality field
i have created a tree hierarchy....when the user clicks on any node,that particular form will open....But there is some problem...i click on form A,it opens.,...then i exit that form via a exit button on the toolbar....and then I click on form B on the tree....but first the form A only opens...and then again i exit form A, then form B will open..
i have written the following code in when_tree_node_selected trigger :
if condition then call_form(path,no_hide,do_replace);
I have an requirement to create an function which takes table or hierarchy of tables as input and returns xml output in hierarchy. Below given is the Tables hierarchy.
Requirement: Initially input was table name and using table as the root node output should generate xml of all the records of child tables.But now requirement is to give the flexibility to user to select what hierarchy he needs i.e he may select AAAA, CCC and in the nodes C1,C2,C3 and C4 if he doesn't want C3 then that node should not be shown in output.
I have created Hierarchy table having 3 columns SI.No, ParentNode and ChildNode and entered the above hierarchy relation.
1. What is the best to way (design)to pass input parameter for the function.
2. How to generate hierarchy in xml using DBMS_XMLGEN