If A=B & B=C, need a query which says A=C
Hi All,
My requirement is something like: I have a table with two Columns:
COLA COLB
A B
B C
Now i need to analyse these records and understand that If A=B & B=C, then I need to insert the third record in the table like below:
A C
I was trying Hierarchical queries, but unable to reach the requirement. Any help is much appreciated.
Thanks in Advance,
Ram Mohan T
Hi Ram,
Sorry, I did not analyze the Question and Posted the previous result.
Please Try, this it is done using the analytical function LEAD.
SELECT col1, LEAD
FROM (SELECT col1, ASCII (col2)
- ASCII (LEAD (col1) OVER (ORDER BY col1)) val,
LEAD (col2) OVER (ORDER BY col2) LEAD
FROM test_val)
WHERE val = 0;
Thanks,
Shankar
Edited by: Shankar Viji on May 24, 2012 11:59 PM
Similar Messages
-
Need SQL Query which saves query results to an excel file
Hi,
I am looking for a sql query which saves/ export results of an query to a excel file
Thanks,
ChetanI am looking for a sql query which saves/ export results of an query to a excel file
Thanks,
Chetan
Options:
1) You can use
BCP command to export result to excel
2) Insert into excel by using OPENROWSET
3) Use Import and Export Wizard and provide SQL query as source and Excel as destination
Please refer:
http://stackoverflow.com/questions/87735/how-do-you-transfer-or-export-sql-server-2005-data-to-excel
http://www.codeproject.com/Questions/617527/Export-sql-query-result-in-excel-file
Cheers,
Vaibhav Chaudhari
[MCTS],
[MCP] -
I have a Table called Test_ X in which there are two fields:
1) date_value
2)Application_Name
requirement: we have to calculate the number of days ramaining through date_value field and compare it to with n days.
if it is less than n days it should raise an error through raiserror statement.
I get the below logic to get the no of days before expiry:
select GETDATE() 'Today Date',
date_value 'expiry date',
abs(DATEDIFF(dd,date_value,getdate()))'No of days before expiry'
from dbo.Test_X
where Application_Name='xyz'
With above satatement am able to get the Number of days before expiry .
my question is how to comare it with a variable say n days and if is less than n days it should raise an by using raiserror statement .
Please help or advice.You can use variables in the RAISERROR, but not expressions, e.g.
DECLARE @Days INT;
SET @Days = ABS(datediff(day, '19000101', CURRENT_TIMESTAMP));
RAISERROR (
N'This is message %s %d.'
,-- Message text.
10
,-- Severity,
1
,-- State,
N'number'
,-- First argument.
@Days
);-- Second argument
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
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. -
Need a Query to update....below are requirements
Hi,
I need a query to update table xx_cc_audit. below are requirements.
In xx_cc_audit I have more than 1000 rows. In this table Column - contract_number is inserted as null for some rows.
I need a query to update this xx_cc_audit table which will replace null contract numbers with correct ones.
In table xx_cc_audit I have column - instance_id which is not null and not unique.(duplicate instance id's can be there).
With this instance_id i can get the contract_number from other table okc_k_headers_b .
I need a query to update xx_cc_audit table.
Presently what I'm doing :
Select XS.instance_id
FROM cs_incidents_all_b CS,xx_cc_audit XS
where XS.contract_number is null
AND XS.SR_NUMBER = CS.incident_number
AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING';
Note : The above query can give duplicate instance_id.
Say, above query results in 100rows.
I will copy any 1 instance_id in a paper and then pass it to below query.
SELECT contract_number
FROM okc_k_headers_b
WHERE id = (SELECT MAX(dnz_chr_id)
FROM okc_k_items
WHERE object1_id1 = TO_CHAR(144849056) --instance_id
AND jtot_object1_code = 'OKX_CUSTPROD'
AND object1_id2 = '#'
AND chr_id IS NOT NULL);
I'll get contract_number.
then i'll update xx_cc_audit table as below.
update xx_cc_audit set contract_number = 1223464789 -- which i got as a result of above query
where contract_number is null
and instance_id = 144849056 --this i copied from paper, as mentioned above ;
this will update my table.
I have more than 1000rows, so i need a query which will update 1000rows in 1 shot.
Please help me.
Thanks!...
Edited by: Kiran Sanga on Jul 20, 2009 2:15 AMOK, so that means a maximum of 10 distinct IDs in okc_k_headers_b can be matched with xx_cc_audit xca.
That's a data issue for yourself that you'll need to work out, i.e, are you being too restrictive in any of the subqueries, particularly this one:
WHERE id = (
SELECT MAX(dnz_chr_id)
FROM okc_k_items
WHERE object1_id1 IN (
Select XS.instance_id
FROM cs_incidents_all_b CS,xx_cc_audit XS
where XS.contract_number is null
AND XS.SR_NUMBER = CS.incident_number
AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING')
AND jtot_object1_code = 'OKX_CUSTPROD'
AND object1_id2 = '#'
AND chr_id IS NOT NULL)Edited by: SeánMacGC on Jul 20, 2009 3:37 AM
And here is a slight different version of the update that should perform a little better:
update xx_cc_audit xca set contract_number = (
SELECT contract_number
FROM okc_k_headers_b okhb
WHERE id IN (
SELECT dnz_chr_id
FROM okc_k_items
WHERE object1_id1 IN (
Select XS.instance_id
FROM cs_incidents_all_b CS,xx_cc_audit XS
where XS.contract_number is null
AND XS.SR_NUMBER = CS.incident_number
AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING')
AND jtot_object1_code = 'OKX_CUSTPROD'
AND object1_id2 = '#'
AND chr_id IS NOT NULL)
AND xca.instance_id = okhb.object1_id1
where contract_number is null; -
Need a Query to find Unassigned Price Lists
Hi
I need a query which will show any Price List NOT assigned to a Business Partner. I have the following:
SELECT T0.[ListNum], T0.{ListName] From OPLN T0
WHERE T0.[ListNum} NOT IN T1.[ListNum[ from OCRD T1
Haven't worked that much with NOT IN statement.
Thank you!Hi Daniel,
Please check below Query.
SELECT T0.[ListNum], T0.[ListName] From OPLN T0 WHERE T0.[ListNum] NOT IN ( SELECT DISTINCT T1.[ListNum] FROM OCRD T1 )
Hope this help
Regards::::
Atul Chakraborty -
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 HELP IN REDUCING THE LENGTH OF QUERY WHICH IS ATTACHED IN A FILE PL_SQ
Hi Everyone,
THANKS FOR POSTING THE REPLIES FOR MY LAST THREAD. THAT REALLY HELPED. I CAME BACK AGAIN BECAUSE I NEED HELP FROM THIS FORUM IN REDUING THE LENGTH OF MY QUERY WHICH I HAD GIVEN BELOW. i DIDN'T HAD THE CHOICE OF ATTACHING A FILE OF MY DATA HERE.ITS VERY HUGE DATA SO I AM NOT ABLE TO PROVIDE ATLEAST SAMPLE DATA BECAUSE THE COLUMNS ARE OVERLAPPING IF I AM PASTING THE DATA HERE. I HOPE IT WILL BE UNDERSTANDABLE. THE QUERY WHICH I WROTE IS TOO LONG AND TAKING HOURS TOGETHER TO RUN AND DISPLAY RESULT. IT WOULD BE A GREAT FAVOUR TO ME IF ANYONE CAN REDUCE THE LINES IN MY QUERY AND MAKE IT RUN FAST....PLEASE I WAS NOT KNOWING THE WAY HOW TO MAKE IT SHORT. IT HAS MANY LOGICS IN IT... :? PLEASE SUGGEST ME IF THERE IS ANY OPTION FOR ATTACHING A FILE SO THAT I CAN SEND MY SAMPLE DATA...
select pt.product code,
pt.product status,
pt.store code,
pt.store status,
pr.scheduled date,
pr.actual date,
pl.scheduled date,
pl.actual date,
ps.scheduled date,
ps.actual date,
fo.scheduled date,
fo.actual date,
fb.scheduled date,
fb.actual date,
fod.scheduled date,
fod.actual date,
lo.scheduled date,
lo.actual date,
lom.scheduled date,
lom.actual date,
lod.scheduled date,
lod.actual date,
/*pr*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(pr.scheduled date,
cast(pr.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'Planned' THEN
NVL2(pr.scheduled date,
cast(pr.scheduled date AS nvarchar2(30)),
'Null')
end as DER_pr_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pr.scheduled date is null THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pr.scheduled date < CURRENT_DATE THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pr.scheduled date >= CURRENT_DATE THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'Planned' and
pr.scheduled date is null THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'Planned' and
pr.scheduled date < CURRENT_DATE THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Planned' and
pr.scheduled date >= CURRENT_DATE THEN
NVL2(pr.actual date,
cast(pr.actual date AS nvarchar2(30)),
'N/A')
end as DER_pr_ACT,
/*pl*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(pl.scheduled date,
cast(pl.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'Planned' THEN
NVL2(pl.scheduled date,
cast(pl.scheduled date AS nvarchar2(30)),
'Null')
end as DER_pl_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pl.scheduled date is null THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pl.scheduled date < CURRENT_DATE THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
pl.scheduled date >= CURRENT_DATE THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'Planned' and
pl.scheduled date is null THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'Planned' and
pl.scheduled date < CURRENT_DATE THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Planned' and
pl.scheduled date >= CURRENT_DATE THEN
NVL2(pl.actual date,
cast(pl.actual date AS nvarchar2(30)),
'N/A')
end as DER_pl_ACT,
/*ps*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(ps.scheduled date,
cast(ps.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(ps.scheduled date,
cast(ps.scheduled date AS nvarchar2(30)),
'Null')
end as DER_ps_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
ps.scheduled date is null THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
ps.scheduled date < CURRENT_DATE THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
ps.scheduled date >= CURRENT_DATE THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
ps.scheduled date is null THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
ps.scheduled date < CURRENT_DATE THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
ps.scheduled date >= CURRENT_DATE THEN
NVL2(ps.actual date,
cast(ps.actual date AS nvarchar2(30)),
'N/A')
end as DER_ps_ACT,
/*fo*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(fo.scheduled date,
cast(fo.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(fo.scheduled date,
cast(fo.scheduled date AS nvarchar2(30)),
'Null')
end as DER_fo_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fo.scheduled date is null THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fo.scheduled date < CURRENT_DATE THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fo.scheduled date >= CURRENT_DATE THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fo.scheduled date is null THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fo.scheduled date < CURRENT_DATE THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
fo.scheduled date >= CURRENT_DATE THEN
NVL2(fo.actual date,
cast(fo.actual date AS nvarchar2(30)),
'N/A')
end as DER_fo_ACT,
/*fb*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(fb.scheduled date,
cast(fb.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(fb.scheduled date,
cast(fb.scheduled date AS nvarchar2(30)),
'Null')
end as DER_fb_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fb.scheduled date is null THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fb.scheduled date < CURRENT_DATE THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fb.scheduled date >= CURRENT_DATE THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fb.scheduled date is null THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fb.scheduled date < CURRENT_DATE THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
fb.scheduled date >= CURRENT_DATE THEN
NVL2(fb.actual date,
cast(fb.actual date AS nvarchar2(30)),
'N/A')
end as DER_fb_ACT,
/*fod*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Compldeted' OR
pt.store status = 'Active' THEN
NVL2(fod.scheduled date,
cast(fod.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'pldanned' THEN
NVL2(fod.scheduled date,
cast(fod.scheduled date AS nvarchar2(30)),
'Null')
end as DER_fod_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fod.scheduled date is null THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fod.scheduled date < CURRENT_DATE THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
fod.scheduled date >= CURRENT_DATE THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fod.scheduled date is null THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
fod.scheduled date < CURRENT_DATE THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
fod.scheduled date >= CURRENT_DATE THEN
NVL2(fod.actual date,
cast(fod.actual date AS nvarchar2(30)),
'N/A')
end as DER_fod_ACT,
/*lo*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(lo.scheduled date,
cast(lo.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(lo.scheduled date,
cast(lo.scheduled date AS nvarchar2(30)),
'Null')
end as DER_lo_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lo.scheduled date is null THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lo.scheduled date < CURRENT_DATE THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lo.scheduled date >= CURRENT_DATE THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lo.scheduled date is null THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lo.scheduled date < CURRENT_DATE THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
lo.scheduled date >= CURRENT_DATE THEN
NVL2(lo.actual date,
cast(lo.actual date AS nvarchar2(30)),
'N/A')
end as DER_lo_ACT,
/*lom*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(lom.scheduled date,
cast(lom.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(lom.scheduled date,
cast(lom.scheduled date AS nvarchar2(30)),
'Null')
end as DER_lom_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lom.scheduled date is null THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lom.scheduled date < CURRENT_DATE THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lom.scheduled date >= CURRENT_DATE THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lom.scheduled date is null THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lom.scheduled date < CURRENT_DATE THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
lom.scheduled date >= CURRENT_DATE THEN
NVL2(lom.actual date,
cast(lom.actual date AS nvarchar2(30)),
'N/A')
end as DER_lom_ACT,
/*lod*/
case
WHEN pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' OR
pt.store status = 'Active' THEN
NVL2(lod.scheduled date,
cast(lod.scheduled date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' THEN
NVL2(lod.scheduled date,
cast(lod.scheduled date AS nvarchar2(30)),
'Null')
end as DER_lod_SHC,
case
when pt.store status = 'Cancelled' OR
pt.store status = 'Stopped' THEN
cast('N/A' AS nvarchar2(30))
WHEN pt.store status = 'Completed' THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lod.scheduled date is null THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lod.scheduled date < CURRENT_DATE THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'Active' and
lod.scheduled date >= CURRENT_DATE THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lod.scheduled date is null THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'N/A')
when pt.store status = 'planned' and
lod.scheduled date < CURRENT_DATE THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'Null')
when pt.store status = 'planned' and
lod.scheduled date >= CURRENT_DATE THEN
NVL2(lod.actual date,
cast(lod.actual date AS nvarchar2(30)),
'N/A')
end as DER_lod_ACT
from
product table pt,
event table pr,
event table pl,
event table ps,
event table fo,
event table fb,
event table fod,
event table lo,
event table lom,
event table lod
where
pt.product code = pr.product code
and pt.store code = pr.store code
and pt.product code = pl.product code
and pt.store code = pl.store code
and pt.product code = fo.product code
and pt.store code = fo.store code
and pt.product code = fb.product code
and pt.store code = fb.store code
and pt.product code = fod.product code
and pt.store code = fod.store code
and pt.product code = lo.product code
and pt.store code = lo.store code
and pt.product code = lom.product code
and pt.store code = lom.store code
and pt.product code = lod.product code
and pt.store code = lod.store code
and pr.product code=pl.product code
and pl.store code=ps.store code
and ps.product code=fo.product code
and fo.store code=fb.store code
and fb.product code=fod.product code
and fod.store code=lo.store code
and lo.product code=lom.product code
and lom.store code=lod.store code
and pr.event code=1001
and pl.event code=1002
and ps.event code=1003
and fo.event code=1004
and fb.event code=1005
and fod.event code=1006
and lo.event code=1007
and lom.event code=1008
and lod.event code=1009
order by product code,store code;
THANKS IN ADVANCE FOR SPARING YOUR TIME IN UNDERSTANDING MY PROVLEM....
REGARDS,
MYTHRI.986300 wrote:
from
product table pt,
event table pr,
event table pl,
event table ps,
event table fo,
event table fb,
event table fod,
event table lo,
event table lom,
event table lodabove is NOT valid SQL syntax -
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. -
Need a record from second query which is not a part of main query.
I have this Query which Leads me to two Rwos of Data
select papf.employee_number E_CODE
,to_char(paaf1.effective_start_date,'DD-MON-RRRR') EFFECTIVE_START_DATE
,DECODE(to_char(paaf1.effective_end_date,'DD-MON-RRRR'),'31-DEC-4712',NULL,to_char(paaf1.effective_end_date,'DD-MON-RRRR')) EFFECTIVE_END_DATE
,TRIM(SUBSTR(PAAF1.ASS_ATTRIBUTE21,INSTR(PAAF1.ASS_ATTRIBUTE21,'-')+1)) PREVIOUS_CO
from apps.per_all_assignments_f paaf
,apps.per_all_people_f papf
,apps.per_grades pg
,apps.per_jobs pj
,apps.per_person_types ppt
,apps.per_person_type_usages_f pptuf
,apps.per_all_assignments_f paaf1
where 1=1
and papf.person_id = paaf.person_id
and pptuf.person_id = papf.person_id
and pptuf.person_type_id = ppt.person_type_id
and ppt.user_person_type = 'Employee'
and papf.current_employee_flag ='Y'
and paaf.primary_flag = 'Y'
and paaf1.primary_flag = 'Y'
and paaf1.grade_id = pg.grade_id
and paaf1.job_id = pj.job_id
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between pptuf.effective_start_date and pptuf.effective_end_date
and papf.person_id = paaf1.person_id
and (TRIM(UPPER(paaf1.ass_attribute24)) <> TRIM(UPPER(paaf.ass_attribute24))
OR TRIM(UPPER(paaf1.ass_attribute21)) <> TRIM(UPPER(paaf.ass_attribute21))
OR TRIM(UPPER(paaf1.ass_attribute22)) <> TRIM(UPPER(paaf.ass_attribute22))
OR TRIM(UPPER(paaf1.ass_attribute25)) <> TRIM(UPPER(paaf.ass_attribute25))
OR TRIM(UPPER(paaf1.ass_attribute23)) <> TRIM(UPPER(paaf.ass_attribute23))
OR paaf1.grade_id <> paaf.grade_id)
and paaf1.effective_end_date = paaf.effective_start_date - 1
and papf.employee_number in ('10620')
and paaf1.effective_start_date >= '01-JAN-1950'
---------------------------OUT PUT-----------------------------
E_CODE EFFECTIVE_START_DATE EFFECTIVE_END_DATE PREVIOUS_CO
Row1 10620 17-SEP-2009 30-NOV-2009 CORPORATE
Row2 10620 19-NOV-2007 31-JAN-2008 CORPORATE
Problem is enire output of the query is perfectly fine but in the second row at column effective_start_date insted of 19-NOV-2007 in need a value from another query. there must not be any change in rest of the columns data including first row.
i.e select ORIGINAL_DATE_OF_HIRE from per_all_people_f
where employee_number = '10620'
and rownum < 2
---------------------------OUT PUT----------------------------
15-MAY-2006
Is there is any approach to get this thing.
Thanks in advance
Bachan.
Edited by: Bachan on Sep 20, 2010 8:17 PMmaybe a union for your second row.
select E_CODE,
EFFECTIVE_START_DATE,
EFFECTIVE_END_DATE,
PREVIOUS_CO
from (select rownum rn,
papf.employee_number E_CODE
,to_char(paaf1.effective_start_date,'DD-MON-RRRR') EFFECTIVE_START_DATE
,DECODE(to_char(paaf1.effective_end_date,'DD-MON-RRRR'),'31-DEC-4712',NULL,to_char(paaf1.effective_end_date,'DD-MON-RRRR')) EFFECTIVE_END_DATE
,TRIM(SUBSTR(PAAF1.***_ATTRIBUTE21,INSTR(PAAF1.***_ATTRIBUTE21,'-')+1)) PREVIOUS_CO
from apps.per_all_assignments_f paaf
,apps.per_all_people_f papf
,apps.per_grades pg
,apps.per_jobs pj
,apps.per_person_types ppt
,apps.per_person_type_usages_f pptuf
,apps.per_all_assignments_f paaf1
where 1=1
and papf.person_id = paaf.person_id
and pptuf.person_id = papf.person_id
and pptuf.person_type_id = ppt.person_type_id
and ppt.user_person_type = 'Employee'
and papf.current_employee_flag ='Y'
and paaf.primary_flag = 'Y'
and paaf1.primary_flag = 'Y'
and paaf1.grade_id = pg.grade_id
and paaf1.job_id = pj.job_id
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between pptuf.effective_start_date and pptuf.effective_end_date
and papf.person_id = paaf1.person_id
and (TRIM(UPPER(paaf1.***_attribute24)) TRIM(UPPER(paaf.***_attribute24))
OR TRIM(UPPER(paaf1.***_attribute21)) TRIM(UPPER(paaf.***_attribute21))
OR TRIM(UPPER(paaf1.***_attribute22)) TRIM(UPPER(paaf.***_attribute22))
OR TRIM(UPPER(paaf1.***_attribute25)) TRIM(UPPER(paaf.***_attribute25))
OR TRIM(UPPER(paaf1.***_attribute23)) TRIM(UPPER(paaf.***_attribute23))
OR paaf1.grade_id paaf.grade_id)
and paaf1.effective_end_date = paaf.effective_start_date - 1
and papf.employee_number in ('10620')
and paaf1.effective_start_date >= '01-JAN-1950'0
where rn = 1
union all
select employee_number E_CODE,
ORIGINAL_DATE_OF_HIRE,
EFFECTIVE_END_DATE,
TRIM(SUBSTR(PAAF1.***_ATTRIBUTE21,INSTR(PAAF1.***_ATTRIBUTE21,'-')+1)) PREVIOUS_CO
from per_all_people_f
where employee_number = '10620'
and rownum < 2note: untested -
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 -
Need sql query to remove duplicates using UNION ALL clause
Hi,
I have a sql query which has UNION clause.But the UNION clause is causing some performance issues.
To overcome that I have used UNION ALL to improve performance but its returning duplicates.
Kindly anyone send a sample SQL query where my primary objective is used to use UNION ALL clause and to consider unique rows (elimating duplicate
ones)
Any help will be needful for me
Thanks and Regardswhy not UNION? :(
another way also use MINUS
SQL>
SQL> with t as
2 (
3 select 1 if from dual union all
4 select 2 if from dual union all
5 select 1 if from dual union all
6 select 3 if from dual union all
7 select 3 if from dual
8 )
9 ,t2 as
10 (
11 select 1 if from dual union all
12 select 2 if from dual union all
13 select 3 if from dual union all
14 select 4 if from dual union all
15 select 5 if from dual
16 )
17 (select if from t
18 union all
19 select if from t2)
20 /
IF
1
2
1
3
3
1
2
3
4
5
10 rows selected
SQL> so
SQL>
SQL> with t as
2 (
3 select 1 if from dual union all
4 select 2 if from dual union all
5 select 1 if from dual union all
6 select 3 if from dual union all
7 select 3 if from dual
8 )
9 ,t2 as
10 (
11 select 1 if from dual union all
12 select 2 if from dual union all
13 select 3 if from dual union all
14 select 4 if from dual union all
15 select 5 if from dual
16 )
17 (select if from t
18 union all
19 select if from t2)
20 minus
21 select -99 from dual
22 /
IF
1
2
3
4
5
SQL> -
Need sql query to find out Joins attached with folders in Discoverer
Hi,
Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
Actually we have to identify all the joins conditions from folders those are migrated from one instance to others.
Thanks
abhishekI recommend that you implement the admin EUL supplied by oracle, you can get there a lot of repository information (metalink note: 556932.1).
Try to use this (maybe you will need some pkg's):
SELECT
DECODE(KEYS.FK_MANDATORY,
1,
'Always exist in master folder',
'Might not exist in master folder') "Detail Item values",
EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID, 'N') "Join Master --> Detail",
KEYS.KEY_DESCRIPTION JOIN_DESCRIPTION,
KEYS.KEY_DEVELOPER_KEY JOIN_IDENTIFIER,
KEYS.KEY_NAME JOIN_NAME,
DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
'AUTO_GENERATED_NAME',
'Yes',
'No') "AutoGen",
DECODE(DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
'AUTO_GENERATED_NAME',
'Yes',
'No') ,
'Yes',
EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID),
KEYS.KEY_NAME) "Actual Join Name",
KEYS.KEY_UPDATED_DATE JOIN_LAST_UPDATE,
DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "One to One join",
DECODE(KEYS.FK_MSTR_NO_DETAIL,
1,
'Outer join on detail' || CHR(10),
NULL) "Outer Join on Detail",
DECODE(KEYS.FK_DTL_NO_MASTER,
1,
'Outer join on master' || CHR(10),
NULL) "Outer Join on Master",
DECODE(KEYS.FK_MSTR_NO_DETAIL,
1,
'Outer join on detail' || CHR(10),
NULL) || DECODE(KEYS.FK_DTL_NO_MASTER,
1,
'Outer join on master' || CHR(10),
NULL) ||
DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "Optional Join Configurations",
OBJ.OBJ_NAME "MASTER_FOLDER",
OBJ_DETAIL.OBJ_NAME "DETAIL_FOLDER"
FROM EUL10G_US.EUL5_OBJS OBJ,
EUL10G_US.EUL5_EXPRESSIONS EXP,
EUL10G_US.EUL5_KEY_CONS KEYS,
EUL10G_US.EUL5_OBJS OBJ_DETAIL
WHERE ((KEYS.KEY_ID = EXP.JP_KEY_ID) AND
(OBJ.OBJ_ID = KEYS.FK_OBJ_ID_REMOTE) AND
(OBJ_DETAIL.OBJ_ID = keys.KEY_OBJ_ID));
Maybe you are looking for
-
I'm wondering where to go after 2 weeks playing CS phone tag, started with a tech call reguarding Iphone 5, battery issue, tech ran test, batt is consumed, went thru warranty talk then to Apple, as to our surprise once the serial number was ran , I p
-
hi, while doing stock transfer from one plant to anoather(same company code), if the spit valuation is active for the material, system is throwing the error that u cant use 303 and 304 mvt type, and insist to use 301 or STO. ours both plant are situa
-
How do I transfer my contracts from a basic phone to a iphone ?
How do I transfer my contracts from a basic phone to a iphone ?
-
How to Deinstall Oracle 11 G R 2
I have deinstalled oracle 11gR2 from my system still cant delete database folder and all the services of are still found in services and I cant install fresh copy of oracle.
-
Message/iMessage in different discussion
Hello everybody, I'm using an iPhone 3GS, running on 6.1.3. - when I sent a message to a friend (iPhone), with SMS or with iMessage, the message appears in the same discussion on is iPhone. - but, when he answers, there's two different discussions on