Need Hierarchial Query
Hi All,
I have below tables,
Tables
1 Employees Type (Tells About Employees Designation)
2.Employee Details (Tells Employee Details)
3.Employee Relation (Tells Relationship between Employees)
Hierarchy
ARC (SENIOR MANAGER)
SUN (MANAGER)
MOON (TECH LEAD)
LITE (EMPLOYEE)
RAG (TECH LEAD)
BESH (TECH LEAD)
CHESH (EMPLOYEE)
PRASAD (EMPLOYEE)
1 Employees Type Data
Type No||Type Name
1|Employee
2|Tech Lead
3|Manager
4|Senior Manager
2.Employee Details
Emp No||Emp Name|Employee Type
10|ARC|4
20|SUN|3
30|RAG|2
40|PRASAD|1
50|MOON|2
60|LITE|1
70|CHESH|1
80|BESH|2
3. Employee Relation
Relation Number|Emp No|Prnt_Relation Number
1|10|NULL
2|20|1
3|30|1
4|40|1
5|50|2
6|60|2
7|70|3
8|80|3
These are my tables structure,
Now I want Hierarchial Query for below,
Input will be Relation Number,
if I give relation number as input I want to display all immediate childern that are Tech Leads and Employees only (it should ignore if it is having any Managers in the result set)
Ex: -
Input is relation number from Employee Relation Table,
If I give input as *1*
Output Should be,
Relation Number|Employee_id|Employee Name
3|30|Rag
7|70|Besh
8|80|Chesh
If I give input as *2*
Output Should be,
Relation Number|Employee_id|Employee Name
5|50|MOON
6|60|LITE,
If I give input as *4*
Output Should be,
Relation Number|Employee_id|Employee Name
<NO Rows Returned>
Thanks,
Hi,
with emp_type as ( select 1 type_id, 'Employee' emp_type from dual
union
select 2 type_id, 'Tech Lead' emp_type from dual
union
select 3 type_id, 'Manager' emp_type from dual
union
select 4 type_id, 'Senior Manager' emp_type from dual),
emp_details as ( select 10 emp_no, 'ARC' fname, 4 type1 from dual
union
select 20 emp_no, 'SUN' fname, 3 type1 from dual
union
select 30 emp_no, 'RAG' fname, 2 type1 from dual
union
select 40 emp_no, 'PRASAD' fname, 1 type1 from dual
union
select 50 emp_no, 'MOON' fname, 2 type1 from dual
union
select 60 emp_no, 'LITE' fname, 1 type1 from dual
union
select 70 emp_no, 'CHESH' fname, 1 type1 from dual
union
select 80 emp_no, 'BESH' fname, 2 type1 from dual),
Emp_Relation as (
select 1 Relation, 10 emp_no1, null parent_Relation from dual
union
select 2 Relation, 20 emp_no1, 1 parent_Relation from dual
union
select 3 Relation, 30 emp_no1, 1 parent_Relation from dual
union
select 4 Relation, 40 emp_no1, 1 parent_Relation from dual
union
select 5 Relation, 50 emp_no1, 2 parent_Relation from dual
union
select 6 Relation, 60 emp_no1, 2 parent_Relation from dual
union
select 7 Relation, 70 emp_no1, 3 parent_Relation from dual
union
select 8 Relation, 80 emp_no1, 8 parent_Relation from dual)
select type_id, emp_type,
emp_no, fname, relation, parent_relation
from EMP_DETAILS, EMP_TYPE, EMP_RELATION
WHERE TYPE_ID = type1
AND EMP_NO = EMP_NO1
AND LEVEL = 2
CONNECT BY PRIOR RELATION = PARENT_RELATION
START WITH RELATION = :P_RELATION
--START WITH PARENT_RELATION IS NULL -- If want to display the complete heirarchy remove comments for this line and remove "and level = 2" and "START WITH RELATION = :P_RELATION"For p_relation = 1
TYPE_ID EMP_TYPE EMP_NO FNAME RELATION PARENT_RELATION
3 Manager 20 SUN 2 1
2 Tech Lead 30 RAG 3 1
1 Employee 40 PRASAD 4 1
3 rows selected.Not sure how do you get the following and it's not clear on what basis.
If I give input as *1*
Output Should be,
Relation Number|Employee_id|Employee Name
3|30|Rag
7|70|Besh
8|80|CheshFor p_relation = 2
TYPE_ID EMP_TYPE EMP_NO FNAME RELATION PARENT_RELATION
2 Tech Lead 50 MOON 5 2
1 Employee 60 LITE 6 2
2 rows selected.For p_relation = 3
TYPE_ID EMP_TYPE EMP_NO FNAME RELATION PARENT_RELATION
1 Employee 70 CHESH 7 3
1 row selected.For p_relation = 4
no rows selected.Hope this helps
Best Regards
Arif Khadas
Edited by: Arif Khadas on Jun 29, 2010 12:47 PM
Similar Messages
-
Hi All,
I need supervisor assignment hierarchy query(HRMS), for generating report.
can someone help me on this??
Any help is greately appreciated.
Regards
GopiHello everyone
When i am trying to execute following query, i am getting an error like
ORA-01473
Cannot Have Sub Queries in Connect By Clause
It display the hierarchy starting from our board of directors in a descending manner
SELECT LPAD ('->', 8 * (LEVEL - 1))
|| (SELECT DISTINCT full_name
FROM per_all_people_f
WHERE person_id = paf.person_id
AND PERSON_TYPE_ID '1123' -- 1123 = 'Ex-Employee'
AND SYSDATE BETWEEN effective_start_date
AND effective_end_date)
TREE
FROM per_all_assignments_f paf
WHERE SYSDATE BETWEEN paf.effective_start_date
AND paf.effective_end_date
AND paf.primary_flag = 'Y'
and paf.person_id in
(select pf.person_id from per_all_people_f pf where pf.PERSON_TYPE_ID '1123' and paf.person_id = pf.person_id
AND SYSDATE BETWEEN pf.effective_start_date
AND pf.effective_end_date
START WITH paf.person_id = (select person_id from per_all_people_f where last_name ='Board of') -- Board of Directors
CONNECT BY PRIOR paf.person_id = paf.supervisor_id
AND paf.primary_flag = 'Y'
AND paf.person_id in (select person_id from per_all_people_f pf where paf.person_id = pf.person_id and pf.PERSON_TYPE_ID'1123')
AND SYSDATE BETWEEN paf.effective_start_date
AND paf.effective_end_date
Could anyone help me on this??
Regards
Gopi -
Hello All,
I have searched OTN and AskTom and saw many articles on hierarchial query but I just cannot seem to figure out how to apply it to my situation. Based on what I have read I do not believe CUBE or ROLLUP is the answer for this (maybe wrong..).
This data is only a small part of a much larger query used for auditing purposes, so i would need to incorporate the solution for this into the larger query.
Part of my problem is how to actual present this data in a format that would make sense to the end user, when included in a tabular (Excel) report.
I am trying to devise a way to verify that monthly payment is received for each product. In this case, some of the products are "created" under another product and then billed under a 3rd product.
To explain the table
Prod_1 - list all products
Prod_2 - lists only those products that are the parent of an item in the Prod_1 column.
Prod_3 - shows there is a relationship between an item in Prod_1 that is not in Prod_2.
There may be items in Prod_1 that have no relationship to Prod_2 or Prod_3 are those are just billed or *not getting billed BAD*
There are other cases where there is a item in Prod_2 that is the parent of one or more items in Prod_1 but not related to Prod_3 and those are billed.
There are other cases where there is a item in Prod_2 that is the parent of one or more items in Prod_1 but not related to Prod_3 and *not getting billed BAD*
For example:
+1-abcd-efgh, 3-qrst-uvwx and 5-ghij-klmn+ under Prod_1 is created under Prod_2 +1234-2f-maker-taker+ but billed under Prod_3 +87-test-789101+ at $139.11 MONTH_CHARGE.
CREATE TABLE PRODT ( design_id VARCHAR2(50), Prod_1 VARCHAR2(50), Prod_2 VARCHAR2(50), Prod_3 VARCHAR2(50), Month_Charge NUMBER );
INSERT INTO PRODT VALUES ( '8568','1-abcd-efgh', '1234-2f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '8569','2-ijkl-mnop', '5678-3f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '8570','3-qrst-uvwx', '1234-2f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '8571','4-yzab-cdef', '5678-3f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '8572','5-ghij-klmn', '1234-2f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '9421','1234-2f-maker-taker','','87-test-789101', 0 );
INSERT INTO PRODT VALUES ( '9588','5678-3f-maker-taker','','88-test-123456', 0 );
INSERT INTO PRODT VALUES ( '2531','87-test-789101', '', '1234-2f-maker-taker',139.11 );
INSERT INTO PRODT VALUES ( '2532','88-test-123456', '','5678-3f-maker-taker', 159.45 );
INSERT INTO PRODT VALUES ( '4531','76-test-101568', '', '',145.00 );
INSERT INTO PRODT VALUES ( '3528','6-abcd-efgh', '2234-1f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '3529','7-ijkl-mnop', '2234-1f-maker-taker','', 0 );
INSERT INTO PRODT VALUES ( '6261','2234-1f-maker-taker','','', 0 );
COMMIT; Desired Result:
Honestly - I am not sure of the best way to present it - definetly open for suggestions!
The table shows there is a relationship by Product Number, but the table does not make it clear that as in the example above that
all of the underlying products are being billed under +87-test-789101+ at $139.11 per month.
I must still show all of the Prod columns - so for my understanding Cube or Rollup is not a good fit(?).
That is what I am trying to accomplish - in other words I am getting paid for everything or not?
In my mind I see it something like this perhaps:
DESIGN_ID PROD_1 PROD_2 PROD_3 MONTH_CHARGE BILL_INDICATOR
8569 2-ijkl-mnop 5678-3f-maker-taker NULL 0 ? (Not sure how to indicate
8571 4-yzab-cdef 5678-3f-maker-taker NULL 0 what should be displayed
9588 5678-3f-maker-taker NULL 88-test-123456 0 in this new column to make
2532 88-test-123456 NULL 5678-3f-maker-taker 159.45 the Audit process simple *Help Needed*)Thanks for looking!
G
Edited by: GMoney on Aug 22, 2012 12:54 PM
Edited by: GMoney on Aug 22, 2012 12:57 PMFrank,
I was hoping you would cross paths with this post.
I am building on a TOP N query you helped me with in another post.
As I mentioned in my an initial post, I have products that may be in a hierarchical order (or stand alone) could be billed as primary or with secondary or tertiary products that are billed under the primary. Meaning the primary would have a dollar figure associated, and may or may not have secondary or tertiary products related to it.
To explain the table
Prod_1 - list all products
Prod_2 - lists only those products that are the parent of an item in the Prod_1 column.
Prod_3 - shows there is a relationship between an item in Prod_1 that is not in Prod_2.
There may be items in Prod_1 that have no relationship to Prod_2 or Prod_3 are those are just billed or not getting billed BAD
There are other cases where there is a item in Prod_2 that is the parent of one or more items in Prod_1 but not related to Prod_3 and those are billed.
There are other cases where there is a item in Prod_2 that is the parent of one or more items in Prod_1 but not related to Prod_3 and not getting billed BAD
My business requirement is to present all of the results from the initial query as well as adding in the dollar figures from an addition query against another financial table. I need to be able to make it perfectly clear to an end user auditor that each and every product is being billed, and clearly identify the secondary or tertiary items if there are any that fall under that primary product.
My real hung up here is the presentation of the data. I can easily see the correlation between them but it is not likely an end user would.
DESIGN_ID PROD_1 PROD_2 PROD_3 MONTH_CHARGE BILL_INDICATOR
8569 2-ijkl-mnop 5678-3f-maker-taker NULL 0 ? (Not sure how to indicate
8571 4-yzab-cdef 5678-3f-maker-taker NULL 0 what should be displayed
9588 5678-3f-maker-taker NULL 88-test-123456 0 in this new column to make
2532 88-test-123456 NULL 5678-3f-maker-taker 159.45 ; the Audit process simple *Help Needed*) Thanks for looking,
Greg -
Hi All..
I have a hierarchy query with description as below
SQL> desc manager_entity;
Name Null? Type
MANAGER_ENTITY_ID NOT NULL NUMBER
MANAGER_ENTITY_TYPE_ID NOT NULL NUMBER
MANAGER_ENTITY_PARENT_ID NUMBER
CREATE_USER NOT NULL VARCHAR2(50)
CREATE_DATETIME NOT NULL DATE
LAST_UPDATE_USER NOT NULL VARCHAR2(50)
LAST_UPDATE_DATETIME NOT NULL DATE
MANAGER_ENTITY_LINK_ID NOT NULL NUMBERI got the correct relation between the parent and child using the below query
select me.manager_entity_id
, me.manager_entity_type_id
, me.manager_entity_parent_id
, me.manager_entity_link_id
, level
from manager_entity me
start with me.manager_entity_id=:p_id
connect by prior me.manager_entity_id=me.manager_entity_parent_idWhen I try to join this table with other 3 tables I’m unable to retrieve data. Description of the other 3 tables
SQL> desc manager_product;
Name Null? Type
MANAGER_PRODUCT_ID NOT NULL NUMBER
MANAGER_PRODUCT_NAME NOT NULL VARCHAR2(50)
MANAGER_ROOF_ID NOT NULL NUMBER
ACT_STRATEGY VARCHAR2(50)
ACT_SUB_STRATEGY VARCHAR2(50)
ACT_DATE_ENTERED DATE
ACT_INCEPTION_DATE DATE
ACT_PEER_GROUP VARCHAR2(50)
BACK_OFFICE_RISK_ID NUMBER
AREA_ID NUMBER
ACT_CREATE_DATE DATE
PROCESS_STOP_DATE DATE
TARGET_COMPLETION_DATE DATE
REVISIT_DATE DATE
CREATE_USER VARCHAR2(50)
CREATE_DATETIME DATE
LAST_UPDATE_USER VARCHAR2(50)
LAST_UPDATE_DATETIME DATE
SQL> desc manager_roof;
Name Null? Type
MANAGER_ROOF_ID NOT NULL NUMBER
MANAGER_ROOF_NAME NOT NULL VARCHAR2(50)
ROOF_COMPANY_ID NOT NULL NUMBER
CREATE_USER VARCHAR2(50)
CREATE_DATETIME DATE
LAST_UPDATE_USER VARCHAR2(50)
LAST_UPDATE_DATETIME DATE
SQL> desc investment_vehicle;
Name Null? Type
INVESTMENT_VEHICLE_ID NOT NULL NUMBER
INVESTMENT_VEHICLE_NAME NOT NULL VARCHAR2(255)
INVESTMENT_VEHICLE_ARRT_NAME VARCHAR2(255)
INVESTIER_SYSID NUMBER
INVESTIER_ID VARCHAR2(100)
MANAGER_PRODUCT_ID NUMBER
TRADING_STRUCTURE_TYPE_ID NUMBER
LEGAL_DESIGNATION_ID NUMBER
ADDITIONAL_INVEST_FORM_TYPE_ID NUMBER
INVESTMENT_VEH_CLASS_TYPE_ID NUMBER
ERISA_PLAN_ASSET_CATEGORY_ID NUMBER
SIDE_LETTER_FLAG CHAR(1)
INCEPTION_DATE DATE
ALLOW_ERISA_FLAG CHAR(1)
ALLOW_PLAN_ASSET_FLAG CHAR(1)
ALLOW_US_TAXABLE_INVESTOR_FLAG CHAR(1)
ALLOW_OFFSHORE_INVESTOR_FLAG CHAR(1)
SUB_DOC_DEADLINE NUMBER
WIRE_DEADLINE NUMBER
DOMICILE_COUNTRY_ID NUMBER
CREATE_USER VARCHAR2(50)
CREATE_DATETIME DATE
LAST_UPDATE_USER VARCHAR2(50)
LAST_UPDATE_DATETIME DATE
PERTRAC_DATA_VENDOR_ID VARCHAR2(255)
PERTRAC_DATA_VENDOR_NAME VARCHAR2(255)
FTS_NAME VARCHAR2(255)
MATLAB_MANAGER_NAME VARCHAR2(255)
ACT_CO_FUND_NAME VARCHAR2(255)
ACT_INVESTMENT_VEHICLE_NAME VARCHAR2(255)
SIDE_POCKET_PCT NUMBER
MAX_ILLIQUID_PCT NUMBER
CONTRIBUTION_OPENING_ID NUMBER
MANAGEMENT_FEE_PCT NUMBER
INCENTIVE_FEE_PCT NUMBER
SIDE_POCKET_NOTE VARCHAR2(4000)
FTS_ID NUMBERI was trying to join the other 3 tables with the main query as below..
select me.manager_entity_id
, me.manager_entity_type_id
, me.manager_entity_parent_id
, me.manager_entity_link_id
, level
from manager_entity me
, manager_roof mr
, manager_product mp
, investment_vehicle iv
where me.manager_entity_link_id= mr.manager_roof_id
and mr.manager_roof_id= mp.manager_roof_id
and mp.manager_product_id= iv.manager_product_id
start with me.manager_entity_id=:p_id
connect by prior me.manager_entity_id=me.manager_entity_parent_idHere manager_entity_link_id of manager_entity table represents(or has) the primary key of all the other 3 table..like
Enter value for p_id: 1
old 7: start with me.manager_entity_id=&p_id
new 7: start with me.manager_entity_id=1
MANAGER_ENTITY_ID MANAGER_ENTITY_TYPE_ID MANAGER_ENTITY_PARENT_ID
MANAGER_ENTITY_LINK_ID LEVEL
1 1008
14793 1
263 1009 1
19695 2
803 1010 263
7031783 3
MANAGER_ENTITY_ID MANAGER_ENTITY_TYPE_ID MANAGER_ENTITY_PARENT_ID
MANAGER_ENTITY_LINK_ID LEVEL
804 1010 263
7031782 3
805 1010 263
7031781 3The above is the output for the hierarchy query
Here the MANAGER_ENTITY_LINK_ID has values (14793, 19695, 7031783 , 7031782 , 7031781)
Where 14793 is the manager_roof_id in manager_roof_table
19695 is the manager_product_id in the manager_product table
7031783 , 7031782 , 7031781 are the investment_vehicle_id’s in the investment_vehicle table…
In the output I need to retrieve manager_roof_name, manager_product_name, investment_vehicle_name..
Thanks in advance
HTH
Edited by: user10280715 on Dec 3, 2008 11:55 AMThe reason result show as no rows selected is your first insert. If fails since column list has 3 columns while values list has 4 values. You probably missed "ORA-00913: too many values" error:
SQL> drop table manager_entity
2 /
Table dropped.
SQL> create table manager_entity(manager_entity_id number,manager_entity_type_id number,manager_entity_parent_id number,manager_entity_link_id number)
2 /
Table created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_link_id)
2 values(1,1008,null,14793)
3 /
insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_link_id)
ERROR at line 1:
ORA-00913: too many values
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(263, 1009, 1, 19695)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(803, 1010, 263, 7031783)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(804, 1010, 263, 7031782)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(805, 1010, 263, 7031781)
3 /
1 row created.
SQL> drop table manager_roof
2 /
Table dropped.
SQL> create table manager_roof(manager_roof_id number,manager_roof_name varchar2(20))
2 /
Table created.
SQL> insert into manager_roof(manager_roof_id,manager_roof_name)
2 values(14793,'roof')
3 /
1 row created.
SQL> drop table manager_product
2 /
Table dropped.
SQL> create table manager_product(manager_product_id number,manager_product_name varchar2(20),manager_roof_id number)
2 /
Table created.
SQL> Insert into manager_product(manager_product_id,manager_product_name,manager_roof_id)
2 Values(19695,'product1', 14793)
3 /
1 row created.
SQL> drop table investment_vehicle
2 /
Table dropped.
SQL> create table investment_vehicle(investment_vehicle_id number,manager_product_id number,investment_vehicle_name varchar2(20))
2 /
Table created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031781,19695,'inv1')
3 /
1 row created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031782,19695,'inv3')
3 /
1 row created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031783,19695,'inv3')
3 /
1 row created.
SQL> COMMIT
2 /
Commit complete.
SQL>
SQL> select me.manager_entity_id
2 , me.manager_entity_type_id
3 , me.manager_entity_parent_id
4 , me.manager_entity_link_id
5 , level
6 from manager_entity me
7 start with me.manager_entity_id=&p_id
8 connect by prior me.manager_entity_id=me.manager_entity_parent_id
9
SQL> /
Enter value for p_id: 1
old 7: start with me.manager_entity_id=&p_id
new 7: start with me.manager_entity_id=1
no rows selectedAs soon as you fix the error:
SQL> drop table manager_entity
2 /
Table dropped.
SQL> create table manager_entity(manager_entity_id number,manager_entity_type_id number,manager_entity_parent_id number,manager_entity_link_id number)
2 /
Table created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(1,1008,null,14793)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(263, 1009, 1, 19695)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(803, 1010, 263, 7031783)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(804, 1010, 263, 7031782)
3 /
1 row created.
SQL> insert into manager_entity(manager_entity_id,manager_entity_type_id,manager_entity_parent_id,manager_entity_link_id)
2 values(805, 1010, 263, 7031781)
3 /
1 row created.
SQL> drop table manager_roof
2 /
Table dropped.
SQL> create table manager_roof(manager_roof_id number,manager_roof_name varchar2(20))
2 /
Table created.
SQL> insert into manager_roof(manager_roof_id,manager_roof_name)
2 values(14793,'roof')
3 /
1 row created.
SQL> drop table manager_product
2 /
Table dropped.
SQL> create table manager_product(manager_product_id number,manager_product_name varchar2(20),manager_roof_id number)
2 /
Table created.
SQL> Insert into manager_product(manager_product_id,manager_product_name,manager_roof_id)
2 Values(19695,'product1', 14793)
3 /
1 row created.
SQL> drop table investment_vehicle
2 /
Table dropped.
SQL> create table investment_vehicle(investment_vehicle_id number,manager_product_id number,investment_vehicle_name varchar2(20))
2 /
Table created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031781,19695,'inv1')
3 /
1 row created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031782,19695,'inv3')
3 /
1 row created.
SQL> Insert into investment_vehicle(investment_vehicle_id,manager_product_id,investment_vehicle_name)
2 Values(7031783,19695,'inv3')
3 /
1 row created.
SQL> COMMIT
2 /
Commit complete.
SQL>
SQL> select me.manager_entity_id
2 , me.manager_entity_type_id
3 , me.manager_entity_parent_id
4 , me.manager_entity_link_id
5 , level
6 from manager_entity me
7 start with me.manager_entity_id=&p_id
8 connect by prior me.manager_entity_id=me.manager_entity_parent_id
9
SQL> /
Enter value for p_id: 1
old 7: start with me.manager_entity_id=&p_id
new 7: start with me.manager_entity_id=1
MANAGER_ENTITY_ID MANAGER_ENTITY_TYPE_ID MANAGER_ENTITY_PARENT_ID MANAGER_ENTITY_LINK_ID LEVEL
1 1008 14793 1
263 1009 1 19695 2
803 1010 263 7031783 3
804 1010 263 7031782 3
805 1010 263 7031781 3
SQL> SY. -
Get only last level in SQL Hierarchy Query
Hi,
How to get only the last level in Oracle SQL Hierarchy Query?
ThanksHi,
1007372 wrote:
Hi,
How to get only the last level in Oracle SQL Hierarchy Query?Depending on your requirements:
WHERE CONNECT_BY_ISLEAF = 1
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
If you can show what you want to do using commonly available tables (such as scott.emp, which contains a hierarchy), then you don't need to post any sample data; just the results and the explanation.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with CONNECT BY queries, because every version since Oracle 7 has had significant improvements in this area.
See the forum FAQ {message:id=9360002} -
I have one table Prd_mst, I need a query or function where whenever i pass the child_id into query or function i get the Parent_id of that
example Data is below :-
P_ID,P_NAME,C_ID
null,Computer,1
1,KeyBoard,2
1,Mouse,3
1,Mother Board,4
3,Scroll Mouse,5
3,Optical Scroll Mouse,6
3,Fibre Scroll Mouse,7
2,Multimedia Key Board,8
2,Cordless Key Board,10
2,Normal Key Board,9
4,586 Mother Board,13
4,386 Mother Board,11
4,486 Mother Board,12
4,P1 Mother Board,14
4,P2 Mother Board,15
4,P3 Mother Board,16
4,P4 Mother Board,17
14,533 Mhtz P1 CPU,19
14,433 Mhtz P1 CPU,18
19,533 Mhtz P1 CPU With 100Mhtz BUS,20
19,533 Mhtz P1 CPU With 133Mhtz BUS,21
18,433 Mhtz P1 CPU With 100Mhtz BUS,22
So when ever i put the child id as 22 i should get the 14
So when ever i put the child id as 21 i should get the 14
So when ever i put the child id as 9 i should get the 1
So when ever i put the child id as 15 i should get the 1
So when ever i put the child id as 5 i should get the 1
So when ever i put the child id as 3 i should get the null
So when ever i put the child id as 14 i should get the 1.
Please help me......
There is one complex requirement in matrix format.
Need P_ID , P_NAME , Count( child records)
P_(nth), P_NAME(nth), Count(child record) nth times.
Child is again the parent of some child.
Report is needed for audit purpose.
Message was edited by: Sandeep Sharma
Sandeep SharmaSQL> CREATE TABLE SANDEEP(P_ID NUMBER,P_NAME VARCHAR2(100),C_ID NUMBER);
Table created.
SQL> INSERT INTO SANDEEP VALUES(null,'Computer',1);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(1,'KeyBoard',2);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(1,'Mouse',3);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(1,'Mother Board',4);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(3,'Scroll Mouse',5);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(3,'Optical Scroll Mouse',6);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(3,'Fibre Scroll Mouse',7);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(2,'Multimedia Key Board',8);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(2,'Cordless Key Board',10);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(2,'Normal Key Board',9);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'586 Mother Board',13);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'386 Mother Board',11);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'486 Mother Board',12);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'P1 Mother Board',14);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'P2 Mother Board',15);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'P3 Mother Board',16);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(4,'P4 Mother Board',17);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(14,'533 Mhtz P1 CPU',19);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(14,'433 Mhtz P1 CPU',18);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(19,'533 Mhtz P1 CPU With 100Mhtz BUS',20);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(19,'533 Mhtz P1 CPU With 133Mhtz BUS',21);
1 row created.
SQL> INSERT INTO SANDEEP VALUES(18,'433 Mhtz P1 CPU With 100Mhtz BUS',22);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> set null null
SQL> SELECT P_ID
2 FROM SANDEEP
3 WHERE LEVEL = 2
4 START WITH C_ID = &1
5 CONNECT BY C_ID = PRIOR P_ID;
Enter value for 1: 22
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 22
P_ID
14
SQL> /
Enter value for 1: 21
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 21
P_ID
14
SQL> /
Enter value for 1: 9
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 9
P_ID
1
SQL> /
Enter value for 1: 15
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 15
P_ID
1
SQL> /
Enter value for 1: 5
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 5
P_ID
1
SQL> /
Enter value for 1: 3
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 3
P_ID
null
SQL> /
Enter value for 1: 14
old 4: START WITH C_ID = &1
new 4: START WITH C_ID = 14
P_ID
1
SQL> SY. -
Need MDX query to find something like date diff and Date Range for last 10 days
Hi ,
I need two Query .First Query for below;
I have below data in table like.
Cat StartDate EndDate
A 2000-01-01 2000-01-15
B 2000-01-02 2000-01-30
C 2000-01-01 2000-01-31
D 2000-02-01 2000-02-28
A 2000-01-10 2000-01-31
I need if Startdate and Date completes whole one month then set status =1 else 0 using MDX query.
like this ;
Cat StartDate EndDate Status
A 2000-01-01 2000-01-15 1
B 2000-01-02 2000-01-30 0
C 2000-01-01 2000-01-31 1
D 2000-02-01 2000-02-28 1
A 2000-01-10 2000-01-31 1
In second query I need last 10 days from current days like;
Now = 8/20/2014
output will be ;
8/20/2014
8/19/2014
8/18/2014
8/17/2014
8/16/2014
8/15/2014
8/14/2014
8/13/2014
8/12/2014
8/11/2014
8/10/2014
Please help me .
ThanksHi Prajapati,
In your scenario, you can use Properties and Datediff function to achieve your requirement. Since not know the structure of your cube, we cannot give you the esact query.
I have tested it on the AdventureWorks cube, the query below is for you reference.
WITH MEMBER [Measures].[StartDate]
AS
[Employee].[Employee Department].CURRENTMEMBER.PROPERTIES('Start Date')
MEMBER [Measures].[WorkYear]
AS
DATEDIFF('yyyy',[Measures].[StartDate],NOW())
MEMBER [Measures].[Status]
AS
IIF(DATEDIFF('yyyy',[Measures].[StartDate],NOW())>10,1,0)
SELECT {[Measures].[StartDate],[Measures].[WorkYear],[Measures].[Status]} ON 0,
[Employee].[Employee Department].[Employee].MEMBERS ON 1
FROM [Adventure Works]
Results
Reference
http://msdn.microsoft.com/en-us/library/ms144821.aspx
Regards,
Charlie Liao
TechNet Community Support -
I need a query to get all the values of taxes from the year 2008
I have 2 tables in oracle 10.2.0.1
sm_coaster_bills(
id_coaster_bills number, (pk)
id_coaster number, (fk from table sm_coasters)
period varchar2(6), (JANMAR or APRJUN or JULSEP or OCTDEC (months of trimenster))
year varchar2(4), (year when the bill was generated)
value (the value of the debt)
expiration date, (date of expiration of the payment)
paid varchar2(1) (Y or N paid or not)
and
re_interests(
id_interests number, (pk)
value number, (the interest in a specific year)
type varchar2(3), 'specify if the interest is anual or trimestral'
period number, (1 or 2 or 3 or 4 depending of the trimester )
year date, (day of the current interest ))
the expirtation date is the last day when yyou can pay after thar the bill start to charge interests from the first month of the trimester
The value of interests change year by year.
I need a query or a function maybe a procedure that returns the total value of the bill changing the interest charged year after year.
i mean this is a record of table sm_coaster bills
(1, 7, 'OCTDEC', '2011', 321.21, 15/10/2011, N) this is a coaster bill not paid since october 2011 acquired in the period October-December
and this are records from re_interests
1, 12.3, 1, TRI, 2009
2, 12.3, 2, TRI, 2009
3, 12.3, 3, TRI, 2009
4, 12.3, 4, TRI, 2009
5, 23.0 0, ANU, 2009
6, 13.5, 1, TRI, 2010
7, 13.5, 2, TRI, 2010
8, 13.5, 3, TRI, 2010
9, 13.5, 4, TRI, 2010
10, 24, 0, ANU, 2010
11, 14.5, 1,TRI, 2011
12, 14.5, 2, TRI, 2011
13, 14.5, 3, TRI, 2011
14, 14.5, 4, TRI, 2011
15, 25, 0, ANU, 2011
16, 15.5, 1, TRI, 2012
16, 15.5, 2, TRI, 2012
16, 15.5, 3, TRI, 2012
for exaple if the license was bought on period JANMAR(january - march) year 2012 then the result should be
320 multiplied for the interest of that trimester again multiplied for the interest of the next trimester APRJUN and the interest of the actual trimester
value janmar aprjun julsep
320* 1.135 * 1.135 * 1.135
but if the bill was made on any trimester of any other year in the past then
$320 should be multiplied for the anual interest of those years
for exaple if the license was bought on period APRJUN(april - june) year 2009 then the result should be
value 2009 2010 2011 janmar aprjun julsep
320 * 1.23 * 1.24 * 1.25 * 1.135 * 1.135 * 1.135
I want a procedure or a function that takes all values selecting all those interests year by year or trimestral whatever the case
Edited by: mbarquet on 08/08/2012 08:04 PMinsert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (8, 30, 1, 11.97, 11.97, 5.99, '2007', 'JULSEP', to_date('30-09-2007 23:59:59', 'dd-mm-yyyy hh24:mi:ss'), 1, 35.91, 0, 0, 0, 0, 1, 35.91, 0, 0, 0, 0, 0, 0, 71.82, null, 'A', to_date('27-08-2007 08:58:28', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('04-09-2007 12:33:17', 'dd-mm-yyyy hh24:mi:ss'), 'JDELGADO');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2323, 30, 1, 14.04, 14.04, 7.03, '2010', 'ABRJUN', to_date('08-05-2010 14:54:40', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 0, 0, 84.24, null, 'A', to_date('08-04-2010 14:51:25', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('03-05-2010 15:45:30', 'dd-mm-yyyy hh24:mi:ss'), 'LTAPIA');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2467, 394, 0, 14.04, 14.04, 7.03, '2010', 'ABRJUN', to_date('08-05-2010 14:55:19', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 84.24, null, 'A', to_date('08-04-2010 14:52:04', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2541, 30, 1, 14.04, 14.04, 7.03, '2010', 'JULSEP', to_date('15-08-2010 10:06:42', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 0, 0, 84.24, null, 'A', to_date('16-07-2010 10:01:41', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('27-07-2010 11:05:15', 'dd-mm-yyyy hh24:mi:ss'), 'LTAPIA');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2102, 30, 1, 14.04, 14.04, 7.03, '2010', 'ENEMAR', to_date('18-02-2010 10:33:28', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 0, 0, 84.24, null, 'A', to_date('19-01-2010 10:38:53', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('01-02-2010 09:34:43', 'dd-mm-yyyy hh24:mi:ss'), 'LAGARCIA');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2262, 394, 0, 14.04, 14.04, 7.03, '2010', 'ENEMAR', to_date('18-02-2010 10:34:09', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 84.24, null, 'A', to_date('19-01-2010 10:39:33', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2666, 394, 0, 14.04, 14.04, 7.03, '2010', 'JULSEP', to_date('15-08-2010 10:07:20', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 84.24, null, 'A', to_date('16-07-2010 10:02:20', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2726, 30, 1, 14.04, 14.04, 7.03, '2010', 'OCTDIC', to_date('13-11-2010 09:46:45', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 0, 0, 84.24, null, 'A', to_date('14-10-2010 09:40:04', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('04-11-2010 10:28:29', 'dd-mm-yyyy hh24:mi:ss'), 'MSANTOS');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2865, 394, 0, 14.04, 14.04, 7.03, '2010', 'OCTDIC', to_date('13-11-2010 09:47:25', 'dd-mm-yyyy hh24:mi:ss'), 1, 42.12, 0, 0, 0, 0, 0, 0, 1, 42.12, 0, 0, 0, 0, 84.24, null, 'A', to_date('14-10-2010 09:40:44', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (2943, 30, 1, 14.51, 14.51, 7.26, '2011', 'ENEMAR', to_date('18-02-2011 09:35:09', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 0, 0, 87.06, null, 'A', to_date('19-01-2011 09:23:00', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('31-01-2011 15:35:02', 'dd-mm-yyyy hh24:mi:ss'), 'MSANTOS');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3322, 30, 1, 14.51, 14.51, 7.26, '2011', 'JULSEP', to_date('13-08-2011 08:36:38', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 0, 0, 87.06, null, 'A', to_date('14-07-2011 08:31:12', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('21-07-2011 12:02:17', 'dd-mm-yyyy hh24:mi:ss'), 'ASAGASTI');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3431, 394, 0, 14.51, 14.51, 7.26, '2011', 'JULSEP', to_date('13-08-2011 08:37:16', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 87.06, null, 'A', to_date('14-07-2011 08:31:49', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3563, 30, 2, 14.51, 14.51, 7.26, '2011', 'OCTDIC', to_date('02-11-2011 08:31:37', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 0, 0, 87.06, null, 'A', to_date('03-10-2011 08:25:50', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('27-10-2011 11:04:39', 'dd-mm-yyyy hh24:mi:ss'), 'ASAGASTI');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3058, 394, 0, 14.51, 14.51, 7.26, '2011', 'ENEMAR', to_date('18-02-2011 09:35:44', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 87.06, null, 'A', to_date('19-01-2011 09:23:35', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3122, 30, 1, 14.51, 14.51, 7.26, '2011', 'ABRJUN', to_date('21-05-2011 10:31:57', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 0, 0, 87.06, null, 'A', to_date('21-04-2011 10:22:14', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('27-04-2011 12:19:40', 'dd-mm-yyyy hh24:mi:ss'), 'LTAPIA');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3230, 394, 0, 14.51, 14.51, 7.26, '2011', 'ABRJUN', to_date('21-05-2011 10:32:40', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 87.06, null, 'A', to_date('21-04-2011 10:22:56', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3743, 30, 1, 15.3, 15.3, 7.65, '2012', 'ENEMAR', to_date('17-02-2012 10:43:42', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 0, 0, 91.8, null, 'A', to_date('18-01-2012 10:30:30', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('27-02-2012 16:35:35', 'dd-mm-yyyy hh24:mi:ss'), 'MGUERRA');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3853, 394, 0, 15.3, 15.3, 7.65, '2012', 'ENEMAR', to_date('17-02-2012 10:44:15', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 91.8, null, 'A', to_date('18-01-2012 10:31:02', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3942, 30, 1, 15.3, 15.3, 7.65, '2012', 'ABRJUN', to_date('16-05-2012 16:38:19', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 0, 0, 91.8, null, 'A', to_date('16-04-2012 16:31:43', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('16-05-2012 16:06:51', 'dd-mm-yyyy hh24:mi:ss'), 'ASAGASTI');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (4180, 30, 1, 15.3, 15.3, 7.65, '2012', 'JULSEP', to_date('09-08-2012 18:10:47', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 0, 0, 91.8, null, 'A', to_date('10-07-2012 17:55:09', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', to_date('16-07-2012 15:30:30', 'dd-mm-yyyy hh24:mi:ss'), 'NAGUIRRE');
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (4065, 394, 0, 15.3, 15.3, 7.65, '2012', 'ABRJUN', to_date('16-05-2012 16:38:53', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 91.8, null, 'A', to_date('16-04-2012 16:32:17', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (3673, 394, 0, 14.51, 14.51, 7.26, '2011', 'OCTDIC', to_date('02-11-2011 08:32:16', 'dd-mm-yyyy hh24:mi:ss'), 1, 43.53, 0, 0, 0, 0, 0, 0, 1, 43.53, 0, 0, 0, 0, 87.06, null, 'A', to_date('03-10-2011 08:26:29', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
insert into SM_COSTERA_PLANILLAS (ID_ESTACION_COSTERA_PLANILLA, ID_ESTACION_COSTERA, ID_FACTURA, VALOR_VHF, VALOR_HF, VALOR_MF, ANIO_PLANILLA, PERIODO_PLANILLA, FECHA_CADUCIDAD, CANALES_VHF_COSTERA, VALOR_CANALES_VHF_COSTERA, CANALES_HF_COSTERA, VALOR_CANALES_HF_COSTERA, CANALES_MF_COSTERA, VALOR_CANALES_MF_COSTERA, PORTATILES_COSTERA, VALOR_PORTATILES_COSTERA, NAVES_CORRESPONSALES, VALOR_CANAL_VHF_COSTERA_NAVES, VALOR_CANALES_HF_COSTERA_NAVES, VALOR_CANALES_MF_COSTERA_NAVES, PORTATILES_COSTERA_NAVES, VALOR_PORTATILES_COSTERA_NAVES, TOTAL_PLANILLA, OBSERVACIONES, ESTADO, FECHA_INGRESO, ID_USUARIO_INGRESO, FECHA_MODIFICACION, ID_USUARIO_MODIFICACION)
values (4284, 394, 0, 15.3, 15.3, 7.65, '2012', 'JULSEP', to_date('09-08-2012 18:11:21', 'dd-mm-yyyy hh24:mi:ss'), 1, 45.9, 0, 0, 0, 0, 0, 0, 1, 45.9, 0, 0, 0, 0, 91.8, null, 'A', to_date('10-07-2012 17:55:43', 'dd-mm-yyyy hh24:mi:ss'), 'DMENDOZA', null, null);
now for expample the registry from sm_costeras _planillas with id 4284 has a bill on julsep of 2012 that does not need to be charge
the registry 3673 bill is on octdic of 2011 so as it is from the las year it charges the anual income for this year %12.78 plus the income of this year's trimesters
if the registry is from 2009 the charge will be the incom of year 2009 plus 2010 plus2011 and the income of this year's trimesters
the incomes charged on the value of the bill is complete y the expiration date is done then the bill of the trimester is complete also y the bill was on 30 dec of any year the bill is charge with the full year income even if its just for 2 days -
hi,
Need Select Query for this...
12. Check if the document category TVLK-VBTYP = 7 where TVLK-LFART = LIKP-LFART (Delivery Type) then this is and Inbound Delivery for a purchase order.
13. Check the value of field Shipment External ID#1 (VTTK-EXTI1) is not initial then check the BOL Data Format. If not VICSBOL then set the variable LI_INBVICS = N. and assign Shipment External ID#1 to Shipment External ID#2 i. e VTTK-EXTI2 = VTTK-EXTI1. and Check the TMS BOL Format. If VICSBOL then set LI_INBVICS = Y .Hi,
1)
IF TVLK-VBTYP = 7 and TVLK-LFART = LIKP-LFART.
Inbound Is for a Purchase order.
ELSE.
Inbound Is not for a Purchase order.
Endif.
2)
IF not VTTK-EXTI1 is initial.
IF BOL DATA <> VICSBOL.
LI_INBVICS = N.
VTTK-EXTI2 = VTTK-EXTI1
else if BOL DATA <> VICSBOL.
LI_INBVICS = Y
Endif.
endif.
endif. -
Hi
I've a table with 3(THREE)columns like the following structure:
desc acc
Name Null? Type
MCODE NOT NULL NUMBER(2)
TYPE CHAR(1)
BALANCE NUMBER(14,2)
Select * from acc
MCODE TYPE BALANCE
10 I 0
11 L 0
12 E 0
12 L 0
13 L 0
14 L 0
15 L 0
16 E 154689718
16 I 11244750
16 L -11232000
16 R 234178693
17 L 0
18 L 0
13 rows selected.
Pls Look at the above query that each ID(MCODE) may 4(four) TYPE ( E,I,L,R) and no more than these But each ID(MCODE) may have TYPE : 1 ( E or I or L or R) ,2 ( E,I or L,R or E,L or I,R ) ,3 (...., ...., ...,or ...,...,...).
Now I need a query That BALANCE will be group by each MCODE base of clmn TYPE which result will be as follows:
MCODE BALANCE
10 ((I) + (R)) - ((E) + abs(L)) Where I= 11244750, R= 234178693
11 ((I) + (R)) - ((E) + abs(L)) E= 154689718, L= -11232000
12 ((I) + (R)) - ((E) + abs(L))
13 ((I) + (R)) - ((E) + abs(L))
14 ((I) + (R)) - ((E) + abs(L))
15 ((I) + (R)) - ((E) + abs(L))
16 ((I) + (R)) - ((E) + abs(L))
17 ((I) + (R)) - ((E) + abs(L))
18 ((I) + (R)) - ((E) + abs(L))
how can it be done in a single oracle query can anyone help me
Regards
Alamgir Hossain
Message was edited by:
user628107
Message was edited by:
user628107
Message was edited by:
user628107Dear Mr. damorgan
I respect your previous message. what you mean by honest attempt I don't know. As far we know all are respectable IT professionals in this forum. So we couldn’t expect like that answer from you.
If you think, that is school work Pls prove yourself. I again post the problem with script specially for your kind attention.
how can it be done in a single oracle query
Create table acc(
MCODE NUMBER(2) NOT NULL
,TYPE CHAR(1)
,BALANCE NUMBER(14,2)
Insert into acc values(11,'L',0);
Insert into acc values(12,'E',76000);
Insert into acc values(12,'L',-4500);
Insert into acc values(13,'L',0);
Insert into acc values(14,'L',-5000);
Insert into acc values(15,'L',0);
Insert into acc values(16,'I',11244750);
Insert into acc values(16,'E',154689718);
Insert into acc values(16,'L',-11232000);
Insert into acc values(16,'R',234178693);
Insert into acc values(17,'L',0);
Insert into acc values(18,'L',0);
Select * from acc
MCODE TYPE BALANCE
11 L 0
12 E 76000
12 L -4500
13 L 0
14 L -5000
15 L 0
16 I 11244750
16 E 154689718
16 L -11232000
16 R 234178693
17 L 0
18 L 0
Pls Look at the above query that each ID(MCODE) may 4(four) TYPE ( E,I,L,R) and no more than these But each ID(MCODE) may have atleast TYPE : 1 ( E or I or L or R) OR 2 ( E,I or L,R or E,L or I,R ) OR 3 (...., ...., ...,or ...,...,...).
Now I need a query That BALANCE will be group by each MCODE base of clmn TYPE which query result will be as follows :
( balance = ((I) + (R)) - ((E) + abs(L)))
Where I= 11244750, R= 234178693
E= 154689718, L= -11232000
MCODE BALANCE
10 0
11 0
12 -80500
13 0
14 -5000
15 0
16 79501725
17 0
18 0
how can it be done in a single oracle query -
Cosider the following record set from the emp table.
empno ename mgr
7839 KING
7566 SCOTT 7839
7566 BLAKE 7839
7782 CLARK 7839
If I use the following hierarchial query to populate a tree in Oracle forms
I will get the result as shown below.
Query
=====
select -1, level, ename, null, ename
from emp
where empno in (7839,7566,7698,7782)
start with ename = 'KING'
connect by mgr = prior empno;
Result
======
KING
JONES
BLAKE
CLARK
Here is my problem. Though diffrent employees can work under a manager,
we have some internal rules that assigns an order to each employee who
works under a manager. This helps us in identifying who should take
charge in the absence of a manager.
I have added one column to the emp table, in order to store the order in
which the employee reports to the manager.
Now the record set becomes
empno ename mgr emp_order
7839 KING 0
7566 SCOTT 7839 1
7566 BLAKE 7839 3
7782 CLARK 7839 2
Now I want the forms tree to be displayed as shown below.
KING
JONES
CLARK
BLAKE
(In short, I want the records in a particular level to be displayed
according to a pre-defined order, rather than getting them displayed
randomly).
Which query can I use for this purpose ?
Please help....
ShibuHi Guys,
Thanks a lot for your suggestions.
It really works great in SQL Plus.
I am familiar with Oracle Forms and I know how to use it if I want to build a tree in Forms.
Here is my requirement. I want to build the application using Oracle Portal. I know that there is something called 'Hierarchy' available in Portal. I don't know up to what extend it gives flexibility in programatically populating the tree.
Here is the scenario. I will use the hierarchial query with CONNECT SIBLINGS BY clause to populate the a tree which will show me employees in a department hierarchially.
Eg:
KING
SCOTT
BLAKE
SMITH
Now I like to show the projects assigned to each employee, which itself can be considered as another hierarchy.
Eg of Projects hierarchy.
Projects
Development
Oracle Applications
HRMS
Support
Intranet Applications
Suppose SCOTT is working in HRMS project, the tree should show as,
KING
SCOTT
Projects
Development
Oracle Applications
HRMS
BLAKE
SMITH
I can color code the node which will distinguish between an employee and his assignments.
Is there a way to achieve it in Oracle Portal using the 'Hierarchy' or what may be the best way to go (Applet etc...) ???
Thanks in advance for your help.
Shibu -
Hierarchy Query to get parent nodes?
Hi Everyone,
I want to write a hierarchy query which should give me the path starting from given node to its parents(Grand parents). below is the sample data and the output what i am expecting. and also the output what i am getting right now from my query.
CREATE TABLE RELATION (PARENT VARCHAR2(5),CHILD VARCHAR2(5) PRIMARY KEY);
--Data for the tree which starts from the root 'A'
Insert into RELATION (PARENT, CHILD) Values (NULL,'A');
Insert into RELATION (PARENT, CHILD) Values ('A', 'B');
Insert into RELATION (PARENT, CHILD) Values ('A', 'C');
Insert into RELATION (PARENT, CHILD) Values ('B', 'D');
Insert into RELATION (PARENT, CHILD) Values ('B', 'E');
Insert into RELATION (PARENT, CHILD) Values ('D', 'F');
Insert into RELATION (PARENT, CHILD) Values ('C', 'G');
--Data for the tree which starts from the root 'H'
Insert into RELATION (PARENT, CHILD) Values (NULL,'H');
Insert into RELATION (PARENT, CHILD) Values ('H', 'I');
Insert into RELATION (PARENT, CHILD) Values ('H', 'J');
Expected Output by passing values as 'F' which gives the path from bottom to up.
A<-B<-D<-F
My Query:
SELECT substr(sys_connect_by_path(child,'<-'),3)
FROM relation
WHERE connect_by_isleaf = 1
START WITH child = 'F'
CONNECT BY PRIOR parent = child
ORDER BY child;
Output of my query:
F<-D<-B<-A
I am getting the output in reverse order. i can use the reverse string function to reverse the string but the problem is the node can also contain the values like 'AC' 'BA'.. in future.
Can anyone please help me in getting the correct output.
Thank you in advance.I like ListAgg :D
with RELATION(PARENT,CHILD) as(
select NULL,'A' from dual union all
select 'A', 'B' from dual union all
select 'A', 'C' from dual union all
select 'B', 'D' from dual union all
select 'B', 'E' from dual union all
select 'D', 'F' from dual union all
select 'C', 'G' from dual union all
select NULL,'H' from dual union all
select 'H', 'I' from dual union all
select 'H', 'J' from dual)
SELECT ListAgg(child,'<-')
within group(order by Level desc) as revPath
FROM relation
START WITH child = 'F'
CONNECT BY PRIOR parent = child;
revPath
A<-B<-D<-F -
Need sql query to import from excel sheet
Hey , i need sql query to import from excel sheet.
i work in a company where i need to daily update the data from excel sheet.
if i get a shortcut method i ill be very thank full to you guys to reduce my work upto 10 %.any query which can inert from excel file?
Sort of. Certainly not anything as simple as what you seem to hope for. Check out this very good PHP class:
PHPExcel - Home -
Need a query to do row to column transformation
SELECT friday_date FROM t2;Table Data:
1/2/2009
1/9/2009
1/16/2009.......
I need a query to get the output in below fashion
Column
1/2/2009,1/9/2009,1/16/2009
I tried PIVOT and TRANSPOSE, cannot do this. I believe because it is a date,may be.
I tried below code also, but CONNECT_BY_ISLEAF wont work on "ORA-00904: "CONNECT_BY_ISLEAF": invalid identifier"
SELECT ltrim(sys_connect_by_path(FRIDAY_DATE,','),',') FRIDAY_DATE
FROM (
SELECT row_number() OVER(ORDER BY FRIDAY_DATE) rno,
FRIDAY_DATE
FROM t2
WHERE CONNECT_BY_ISLEAF = '1'
start WITH rno = '1'
connect BY rno = PRIOR rno+1;Thank YouSQL> WITH t2 AS ( SELECT TO_CHAR (
NEXT_DAY (
DATE '2009-01-01' + (LEVEL - 1) * 7,
'friday'
'mm/dd/yyyy'
friday_date
FROM DUAL
CONNECT BY LEVEL <= (DATE '2009-12-31' - DATE '2009-01-01') / 7)
SELECT RTRIM (
XMLAGG (XMLELEMENT (
e,
friday_date || ','
)).EXTRACT ('//text()'),
COLUMN_VALUE
FROM t2
COLUMN_VALUE
01/02/2009,01/09/2009,01/16/2009,01/23/2009,01/30/2009,02/06/2009,02/13/2009,02/
20/2009,02/27/2009,03/06/2009,03/13/2009,03/20/2009,03/27/2009,04/03/2009,04/10/
2009,04/17/2009,04/24/2009,05/01/2009,05/08/2009,05/15/2009,05/22/2009,05/29/200
9,06/05/2009,06/12/2009,06/19/2009,06/26/2009,07/03/2009,07/10/2009,07/17/2009,0
7/24/2009,07/31/2009,08/07/2009,08/14/2009,08/21/2009,08/28/2009,09/04/2009,09/1
1/2009,09/18/2009,09/25/2009,10/02/2009,10/09/2009,10/16/2009,10/23/2009,10/30/2
009,11/06/2009,11/13/2009,11/20/2009,11/27/2009,12/04/2009,12/11/2009,12/18/2009
,12/25/2009
1 row selected. -
Need a query to update the inventory item to non inventory item
Dear all,
I need a query which should update the Inventory to Non - Inventory Item.Hi,
You need to freeze the inventory by click inactive tick box. This will prevent users to use the inventory.
The inventory posting lists will still exists as an inventory's transaction history for auditor if the inventory have had transactions.
To empty the warehouse, just perform good issue and use inventory decrease account. After the warehouse has been empty, create similar inventory item by right click --> select duplicate. Create new item code and in the tab remarks, just write this non inventory item was ever inventory item with code e.g. xxxx.
if you want to recover the stock, just create new item and then receive the stock into warehouse using Good receipt. use the same account code with account code used in the good issue.
JimM
PS.
Do not use sql statement to update B1 database. No SAP support provided afterwards.
Maybe you are looking for
-
Fonts for printing - unicode or non-unicode
Hi, How could i find whether the fonts am using for scripts and smartforms are unicode compatible or not. Regards, Vijayalakshmi
-
How to insert photos in a project?
I drag photos from the media browser on the project, inside of a given clip, until it gets blue, and let it fall. I adjust the length of the photo by moving the start or end from the photo. BUT WAIT: Sometimes, the photo is visible as a blue thing ov
-
Fine Tuning Java 1.1 Double Buffering?
Dear Java gurus, Hi, I'm looking for suggestions on improving the performance of my double buffering technique for pure Java 1.1 applets. My current method seems to eat up more CPU & RAM than it should. I fear that real implementations (with far more
-
10.5.2 won't install either
The installer goes almost all the way through installation. Then at the last minute, it "rolls back," and the progress bar actually moves from right to left, indicating that the installation is being "undone." I'm going to revert to an earlier versio
-
Making a component invisible...
Hi, I'm trying to make a component in my movie invisible using the instance._visible = false ActionScript command. It's a button that was converted to a symbol from a series of filled rectangles and ovals. It will not go invisible although I can use