Structure In Tree Query
Sep 8, 2012
Explain the following query to me:
in particular Lpad (' ', Level-1)*3.
select lpad(' ' , (level-1)*3) || emp_last_name employee
from emp
connect by supervisor_emp_id = prior emp_id
start with supervisor_emp_id is null;
View 1 Replies
ADVERTISEMENT
Jun 26, 2012
How to create one complex query. here what I have in my table.
DELIVERABLESPRECURSORS
------------ -----------
4 15
15 332
15 26
26 332
29 4
29 15
224 26
224 274
224 259
259 29
274 15
288 259
288 26
288 274
916 27
917 27
918 27
I need a query which run against this table and bring me the following result.
4 > 15 > 332
15 > 332
15 > 26 > 332
26 > 332
29 > 4 > 15 > 332
..... and so on
In theory, I need query which will track DELIVERABLES'S PRECURSOR and PRECURSOR's of there PRECURSOR'S.
View 16 Replies
View Related
Oct 4, 2012
I have a hierarchy tree i query using connect by. The primary key is the up level to other parts. I need to copy the entire tree structure as a new structure.
This will mean renaming the IDs to new unique ID yet keeping the up levels correct.
i.e.
ID DESC UPLEVEL
1 TOP
2 desc2 1
3 desc3 1
4 desc4 3
5 desc5 4
6 desc6 1so if i coped this i would expect
7 TOP
8 desc2 7
9 desc3 7
10 desc4 9
11 desc5 10
12 desc6 7
View 5 Replies
View Related
Apr 5, 2011
I want to know how to create tree structure in forms6i. This should be created as " Control-block". For example when user expand department it shows all department names in college as sub tree. Note: I have no table for department..Just display manually..
View 1 Replies
View Related
Mar 1, 2013
I have one table test_pc :
EVENT_IDPARENT_EVENT_ID
2001
2002 2001
1001 2002
1002 1001
1004
1003 2005
1006
Scripts are mentioned below :
create table test_pc
(event_id number(10), parent_event_id number(10));
insert into test_pc values(2001,null);
insert into test_pc values(1006,null);
insert into test_pc values(1004,null);
insert into test_pc values(2002,2001);
insert into test_pc values(1001,2002);
insert into test_pc values(1002,1001);
insert into test_pc values(1003,2005);
In order to derive parent child relationship I have ran the following query :
select *
from test_pc
start with parent_event_id is null
connect by nocycle prior event_id = parent_event_id;
It is giving all the records except the last one (i.e. event_id = 1003 and parent_event_id = 2005), because the parent_event_id does not exists in the table.
But my requirement is to show all the record, i.e. if the parent_child relationship is present then show accordingly and also show the rest of the records where the parent_child does not exists even the parent_event_id exists.
View 5 Replies
View Related
Sep 20, 2013
I need to form XML for hirarchy data,
CREATE TABLE TESTING (
EMPID VARCHAR2(1),
ENAME VARCHAR2(10),
CHILD_ID NUMBER,
PARENT_ID NUMBER);
INSERT INTO TESTING VALUES ('A', 'AText', 1001,0);
INSERT INTO TESTING VALUES ('B', 'BText', 1002,1001);
INSERT INTO TESTING VALUES ('C', 'CText', 1003,1002);
insert into testing values ('D', 'DText', 1004,1003);
SELECT LEVEL, EMPID,ENAME,CHILD_ID, PARENT_ID
FROM TESTING
START WITH PARENT_ID = 0
CONNECT BY NOCYCLE PRIOR CHILD_ID = PARENT_ID;
Need select query to return output like below
<ITEM ID="A" TEXT="AText" IM0="folderClosed.gif" CHILD="1">
<ITEM ID="B" TEXT="BText" IM0="folderClosed.gif" CHILD="1">
<ITEM ID="C" TEXT="CText" IM0="folderClosed.gif" CHILD="1">
<ITEM ID="D" TEXT="DText" IM0="folderClosed.gif" CHILD="1">
</ITEM>
</ITEM>
</ITEM>
</ITEM>
View 1 Replies
View Related
Sep 3, 2012
I am struck in a requirement to show the organization structure in a Top Down Organizational structure.
Is there any way we can make the well structured report OR form?
View 4 Replies
View Related
Apr 29, 2013
I am using Oracle database 10g R2.
suppose I have this structure
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
How to write this query?
View 3 Replies
View Related
Feb 7, 2013
--this for txn details
CREATE TABLE txn_det(
txnid NUMBER PRIMARY KEY,
amount NUMBER,
status varchar2(50),
cust_id NUMBER);
----this for customer details
CREATE TABLE cust_det(
cust_id NUMBER PRIMARY KEY,
cust_name VARCHAR2(50),
cust_acc number(15));
--data to insert for customer table
INSERT INTO cust_det VALUES(101,'Miller','12345');
INSERT INTO cust_det VALUES(201,'Scott','45678');
----data to insert for txn table
INSERT INTO txn_det VALUES('tx0045',123.00,'success',101);
INSERT INTO txn_det VALUES('tx0046',4512.50,'success',101);
insert into txn_det values('tx0049',78.12,'success',101);
INSERT INTO txn_det VALUES('tx0055',123.12,'success',201);
Now THE problem IS cust_det TABLE's cust_id coulmn may contain duplicate.So I thought OF adding THE txn_id COLUMN TO THE cust_det table but I know that encourgaes redundancy.
View 30 Replies
View Related
Jul 11, 2012
How to take table structure in oracle? Actually I got it through this command "SELECT dbms_metadata.get_ddl(a.object_type,a.object_name) FROM user_objects a where object_type != 'PACKAGE BODY'"
any other way to get it? I need like table name field name datatype
View 11 Replies
View Related
Sep 4, 2008
The output below is looked mass..
1) the capital letter is the name of column
2) consists 8 data for each column name
Quote: STATISTICS_DATE INSTANCE_NAME GENESIS_PORT
-------------------- ---------------------------------------------------------------- ------------
COUNT TOTAL_TIME MAX_TIME MIN_TIME AVERAGE_TIME
--------- ---------- --------- --------- ------------
03-AUG-08 MatlMgr_UpdateInstance140028
35 6.8685906 .83870006 .06330299 .19624545
View 2 Replies
View Related
Jun 4, 2012
I am working in a reporting project.We have different environments.After migration of data base script from one server to another we always need to crosscheck whether newly added columns have been properly migrated or not.
any database script to address the same thing. Last but not the least we have servers with TNS entries. how we can connect to different server while present in one specific server.
View 5 Replies
View Related
Mar 16, 2011
We are trying eliminate/minimize the downtime for our application. As part of new code deployments sometimes we need to modify DB Structure also. As it is taking time to backup current DB and apply new DDL, the application is down.
Is there a way to eliminate the downtime, if I can leverage Data Guard, Golden Gate or RAC concepts?
View 3 Replies
View Related
Aug 27, 2010
I was trying to get the structure of mview through ALL_MVIEWS, but I was not getting the complete one.ORDER BY clause was missing.
how we can get the complete mview structure.
View 7 Replies
View Related
Mar 13, 2013
create table my_rows
(
my_envvarchar2(100),
anumber(2),
bnumber(2)
)
/
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
insert into my_rows values ('A', 10, 20);
[code]....
The first row means that the value 10 represents 40% in the couple (10,20). Meaning if I have 100 rows with the couple (10,20), 40 rows will be marked with the value 10 and 60 will be marked with the value 20. To do this, I used to create a temporary table with the same structure as the my_rows table with a new column "the_value" and I used to update this new column wth a PL/SQL for loop. But I think it is doable in a signle SQL.
View 9 Replies
View Related
Apr 21, 2010
i would like to view all table statructure of a schema in a file. i need to take print out of it for one analysys.
i did like this
exp user/pwd file=dumpfile.dmp full=y rows=n log=logfilename.log
imp user/pwd file=dumpfile.dmp full=y indexfile=indexfile.sql logfile=logfilename.log
but
its look like this i could not format
REM CREATE TABLE "SYSTEM"."DEF$_AQCALL" ("Q_NAME" VARCHAR2(30), "MSGID"
REM RAW(16), "CORRID" VARCHAR2(128), "PRIORITY" NUMBER, "STATE" NUMBER,
REM "DELAY" TIMESTAMP (6), "EXPIRATION" NUMBER, "TIME_MANAGER_INFO"
REM TIMESTAMP (6), "LOCAL_ORDER_NO" NUMBER, "CHAIN_NO" NUMBER, "CSCN"
REM NUMBER, "DSCN" NUMBER, "ENQ_TIME" TIMESTAMP (6), "ENQ_UID" NUMBER,
[Code] ..........
View 3 Replies
View Related
Aug 17, 2012
duplicate rman on new windows box with different dir structure
View 9 Replies
View Related
Jun 18, 2012
I have a question about Oracle schemas. Oracle schema is the user with its datase objects (table, index, eg) .In two different Oracle schemas, there can be two tables with same names. When the users connect to same Oracle instance they can access these tables with schema.tablename convention.
However, how is that structure handled in physical database storage. Are there two tables created with same name physically? I mean are these two tables with same name stored in different database files?
View 3 Replies
View Related
Apr 30, 2013
I am receiving two large export files from a vendor, so I have no control over the contents. I need to import these into our database. The two export files are very similar, except the one has slightly differenet columns in it. So, export file 1 may have a table:
COLUMN_A
COLUMN_B
COLUMN_C
The second file may have:
COLUMN_A
COLUMN_B
COLUMN_D
At the destination, I have a table that has:
COLUMN_A
COLUMN_B
COLUMN_C
COLUMN_D
Is there a parameter that would let me interchangably import either (or both) files into this destination table? This is my first attempt at data pump - but I know using import this has caused me issues. Not sure if the same limitations exist? Will the missing columns cause it to fail?
View 3 Replies
View Related
Nov 16, 2012
my working is relating with PUMP of oracle.
I would like to use command, for ex:
expdp hr/hr DIRECTORY=dpump_dir1 DUMPFILE=expdat.dmp COMPRESSION=ALL LOGFILE=export.log SCHEMAS=hr
But some tables in Schema HR, I don't want to export data, just only need table structure.
View 2 Replies
View Related
Oct 19, 2010
we have daily partitioned table, and for backup we are using data pump (expdp). we policy to drop partition after backup (archiving).
we have archived dump files for 1year, few days back developer made changes with table structure they added one new column to table.
Now we are unable to restore old partitions is there a way to restore partition if new column added / dropped from currect table.
View 4 Replies
View Related
Nov 9, 2010
know the process of exporting only the table structure of a Database without the actual content of it.
Note:: I don't know how many tables are present in the DB.
View 1 Replies
View Related
Jun 21, 2012
a table structure is modified every now and then because of which the few packages get uncompiled. is there any way to monitor which user has changed table structure.
View 2 Replies
View Related
Nov 3, 2011
create trigger on certain column for table structure.
SQL> desc MXMS_BF_TXN_DTL_T
Name Null? Type
----------------------------------------- -------- ----------------------------
DOC_NO NOT NULL VARCHAR2(200)
SEQ_NO NOT NULL NUMBER(24)
GL_CODE VARCHAR2(200)
TXN_NATURE VARCHAR2(200)
TXN_TYPE_CODE VARCHAR2(200)
[code].....
I need to collect new and old data whenever update statement fire on DOC_NO,POLICY_KEY,CRT_USER column.i have created only audit table for the above as below structure .
Name Null? Type
----------------------------------------- -------- ----------------------------
TIMESTAMP DATE
WHO VARCHAR2(30)
CNAME VARCHAR2(30)
OLD VARCHAR2(2000)
NEW VARCHAR2(2000)
Description:- TIMESTAMP is for when the modification happen.
WHO is for username
CNAME is for column which is modified
OLD is for old value for the modified column
New os for new value for the modified column
View 3 Replies
View Related
Jan 5, 2012
I am working on Index issue and need to validate the structure of the index. Does validation lock the Index ?
Do we need downtime or we can do it in normal working hours.
alter index index_name validate structure;
View 9 Replies
View Related
Apr 24, 2013
I have a requirement to be coded like this:
A function to return pl/sql table(cant use ref cursor) whose columns varies every time it runs i.e,
means
type pl_tab_type is object(col1 varchar2(1000), col2 varchar2(1000))
type pl_tab is table of pl_tab_type
func f return pl_tab
as
...
end;
note : pl_tab_type will vary for each run of function f
i.e.,for example, pl_tab_type can be changed to as follows:
type pl_tab_type is object(col1 varchar2(1000), col2 varchar2(1000),col3 varchar2(1000))
how to return pl/sql table of dynamic type from func,
View 12 Replies
View Related
Apr 8, 2004
I have two cursors like
cursor_A IS select * from table_a where condition_A;
cursor_B IS select * from table_a where condition_B;
record_A is a recorded of cursor_A%ROWTYPE
record_B is a recorded of cursor_B%ROWTYPE
I define a procedure like pro_A(record_in cursor_A%ROWTYPE) can I overload this procedure by defining pro_B(record_in cursor_B%ROWTYPE)?
If I can't, Can I call pro_A by passing record_B as the parameter to it?
View 3 Replies
View Related
Sep 28, 2010
howto to setup an oracle server and "import" my old databases just from the copied directory structure d:\oracle\product\... ("cold backup") to the new install.i was trying to setup an new server by shutting down the db and just copying back my data/control/log/*.ora files which doesnt seem to work.
i could see the old tables structures in the local sqlplus console, but the databases are not reachable over the net.
also the enterprise manager is not able to startup the dbs, it show just an running listener.
View 3 Replies
View Related
Aug 3, 2011
I have a small question is it possible to find the details of a user who modified the structure of a table, including what command he ran to change the structure of the table?
View 2 Replies
View Related
Sep 21, 2011
i want to find the name of user who make changes in the table structure or create any index or constraint or unique key or alter the column? Is there any way to find in Oracle. in which table what change has been done as well?
following Output needed
userid, username, schemaname, schemachangetime, "what_change_has_been_made", IP address or Computername
View 11 Replies
View Related