Deletion query need help
Prg
CASE SY-UCOMM .
WHEN 'SAVE'.
REFRESH IT_CURR.
LOOP AT G_TC_VALUE_ITAB INTO G_TC_VALUE_WA .
MOVE-CORRESPONDING G_TC_VALUE_WA TO IT_CURR .
IT_CURR-POSNR = GV_POSNR .
IT_CURR-VBELN = GV_VBELN .
APPEND IT_CURR .
ENDLOOP .
DELETE IT_CURR WHERE ZWMENG_CPD EQ 0.
LOOP AT IT_CURR .
TOTAL = IT_CURR-ZWMENG_CPD + TOTAL.
ENDLOOP.
IF TOTAL > GV_KWMENG.
IF SY-SUBRC EQ 0.
MESSAGE ID 'Z1' TYPE 'I' NUMBER '222' WITH 'Order Qty > CPD Qty'.
LEAVE TO SCREEN 100.
ENDIF.
ENDIF.
CLEAR G_TC_VALUE_COPIED.
LEAVE TO SCREEN 0 .
WHEN 'CANC'.
CLEAR G_TC_VALUE_COPIED.
LEAVE TO SCREEN 0 .
ENDCASE .
1)it_curr which contain the dynamical inputted values
eg 1000
1000
total 2000 over
if i input 500 and 1000 after saving button on the top
now total contents is
1000
1000<----
after this delete val
500 <--- delete all consc val
1000 <---
2)GV_KWMENG contain 2000 value
3) from it_curr i calculate
TOTAL = IT_CURR-ZWMENG_CPD + TOTAL.
4)
againing loop with condition total > than gv_kwmeng
5) delete the concecutive value after condition is true
If I use following query
SELECT DISTINCT STAGE_1_MG_CLIENT.CLIENT_ID, STAGE_1_MG_CLIENT.BIRTH_DT, STAGE_1_MG_CLIENT.ETHNIC_CD, STAGE_1_MG_CLIENT.GENDER_CD, STAGE_1_MG_CLIENT.MEDICARE_NUMBER, STAGE_1_MG_CLIENT.MEDICARE_YN, STAGE_1_MG_CLIENT.ALIAS_YN, ltrim(rtrim(STAGE_1_MG_CLIENT.SAVERR_NAME)), STAGE_1_MG_CLIENT.SSN, STAGE_1_MG_CLIENT.TERMINATION_CD, STAGE_1_MG_CLIENT.TPL, STAGE_1_MG_ENROLLMENT.CLIENT_ID, STAGE_1_MG_ENROLLMENT.SERVICE_GROUP_CD, STAGE_1_SAVERR.CLIENT_ID, STAGE_1_SAVERR.SSN, STAGE_1_SAVERR.STAT_2, STAGE_1_SAVERR.STAT_3, STAGE_1_SAVERR.STAT_4, STAGE_1_SAVERR.STAT_5, STAGE_1_SAVERR.STAT_6, STAGE_1_SAVERR.MEDICAID_BENEFITS_close_DT, STAGE_1_SAVERR.ACTION FROM STAGE_1_SAVERR, STAGE_1_MG_ENROLLMENT, STAGE_1_MG_CLIENT where STAGE_1_MG_CLIENT.CLIENT_ID = STAGE_1_SAVERR.CLIENT_ID (+) and STAGE_1_MG_CLIENT.CLIENT_ID = STAGE_1_MG_ENROLLMENT.CLIENT_ID (+) and STAGE_1_MG_ENROLLMENT.SERVICE_GROUP_CD(+) in ('2','3','12','13','14','15','16','17','18')
I get the following error message
Error at Command Line:1 Column:892
Error report:
SQL Error: ORA-01719: outer join operator (+) not allowed in operand of OR or IN
Thanks,
Jay
Similar Messages
-
Hi i need help installing micrsoft silverlight it just wont install because of errors
Removing Silverlight - MAC | Microsoft Silverlight
-
What's wrong with this query--need help
Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
select ename
from emp
where to_char(hiredate,'day')='tuesday';
when i execute the query
o/p is no rows selected
please help.
thanks in advance.Hi,
861173 wrote:
Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
select ename
from emp
where to_char(hiredate,'day')='tuesday';
when i execute the query
o/p is no rows selected Try:
WHERE TO_CHAR (hiredate, 'fmday') = 'tuesday'Without 'FM" in the 2nd argument, TO_CHAR pads the results to make it a consistent length. If your NLS_DATE_LANGUAGE=ENGLISH, that means it will always return a 9-character string, since the longest name in English ('Wednesday') has 9 letters. 'FM' (case-insernsitive) tells TO_CHAR not to add that kind of padding. -
Row_number query - need help ASAP
Hi ,
Need some help bout query
I need a query for display output like below
DATE CODE MAC_NO BATCH_NO
01-OCT-07 1119 02 1
20-OCT-07 1210 01 2
01-NOV-07 1209 01 3
01-NOV-07 1510 01 4
01-NOV-07 4025 01 5
01-NOV-07 4025 01 5
01-NOV-07 4051 03 6
02-NOV-07 1209 01 7
i hv no idea how to do it. My query doesn't work for tat requirement.Tis is my query
SELECT date
,code
,mac_no
,ROW_NUMBER()
OVER (PARTITION by date,code,mac_no
ORDER by date,code,mac_no)
as batch_no
FROM PAYMENT
WHERE npcs_cycle_num = 27
AND txn_insert_seq_num > 0;
The output juz like below.I need everybody help ASAP.
DATE CODE MAC_NO BATCH_NO
01-OCT-07 1119 02 1
20-OCT-07 1210 01 1
01-NOV-07 1209 01 1
01-NOV-07 1510 01 1
01-NOV-07 4025 01 1
01-NOV-07 4025 01 2
01-NOV-07 4051 03 1
02-NOV-07 1209 01 1
Thanks
CTI'm sorry..Maybe my words it not that clear enough. You were right about how ROW_NUMBER works (it
assigns a numeric value and resets based on the grouping you specify in the PARTITION clause).
What I want actually is the row number increment based on the txn_date,poc_code and machine_no.
I'm not sure whether using the row_number() can solve my solutions. I really hope that you could help me.
I thought of using row_number() may help. Do you have any other solution?
Here is my table description.
DESC PAYMENT;
Name Null? Type
TXN_ID_NUM NOT NULL NUMBER(12)
ACCT_NO NOT NULL VARCHAR2(14)
CANCEL_CODE VARCHAR2(5)
ADJ_TYPE_NO VARCHAR2(2)
REASON_CODE VARCHAR2(5)
CASHIER_ID_NO VARCHAR2(10)
SUPERVISOR_ID_NO VARCHAR2(10)
REV_CODE VARCHAR2(5)
TXN_DATE DATE
PAY_ADJ_DATE DATE
POC_CODE VARCHAR2(10)
MACHINE_NO VARCHAR2(3)
PAY_MODE_CODE VARCHAR2(5)
ORIG_ACCT_NO VARCHAR2(14)
PAY_AMT NUMBER(12,2)
INVOICE_NO VARCHAR2(20)
PAY_RECEIPT_NO VARCHAR2(24)
PAY_BATCH_NO VARCHAR2(20)
NPCS_CYCLE_NUM NUMBER(4)
TXN_INSERT_SEQ_NUM NOT NULL NUMBER(12)
2) Below is the query before assigning the row number:
SQL> SELECT TXN_DATE,POC_CODE,MACHINE_NO,PAY_BATCH_NO,PAY_AMT,REV_CODE,ADJ_TYPE_NO,PAY_MODE_CODE
2 FROM PAYMENT
3 WHERE NPCS_CYCLE_NUM=27
4 AND REV_CODE IN (SELECT rev_code
5 FROM OUTBND_REV_CODE
6 WHERE outbnd_agen_file_code = 'TMB'
7 AND sys_appl_id ='CCC')
8 ORDER BY TXN_DATE,POC_CODE,MACHINE_NO;
TXN_DATE POC_CODE MAC PAY_BATCH_NO PAY_AMT REV_C AD PAY_M
01-OCT-07 1119 02 20071101120900000000 154.25 017 85 1
20-OCT-07 1210 01 20071101402501400000 444.02 017 00 5
01-NOV-07 1209 01 20071101120901100000 585.32 017 85 1
01-NOV-07 1510 01 20071101402501100000 493 014 00 1
01-NOV-07 4025 01 20071101402501100000 203.85 016 00 3
01-NOV-07 4025 01 20071101402501100000 487.96 017 00 1
01-NOV-07 4051 03 20071101402501100000 109.26 016 00 3
02-NOV-07 1209 01 20071102120900000000 105.76 014 00 1
3)This is my query and the result:
SQL> SELECT /* SQL_ID 2703 */
2 txn_date
3 ,poc_code
4 ,machine_no
5 ,pay_batch_no
6 ,pay_amt
7 ,rev_code
8 ,adj_type_no
9 ,pay_mode_code
10 ,ROW_NUMBER()
11 OVER (PARTITION by txn_date,poc_code,machine_no
12 ORDER by txn_date,poc_code,machine_no)
13 as row_number
14 FROM PAYMENT
15 WHERE npcs_cycle_num = 27
16 AND txn_insert_seq_num > 0
17 AND rev_code IN (SELECT rev_code
18 FROM OUTBND_REV_CODE
19 WHERE outbnd_agen_file_code = 'TMB'
20 AND sys_appl_id ='CCC');
TXN_DATE POC_CODE MAC PAY_BATCH_NO PAY_AMT REV_C AD PAY_M ROW_NUMBER
01-OCT-07 1119 02 20071101120900000000 154.25 017 85 1 1 (1)
20-OCT-07 1210 01 20071101402501400000 444.02 017 00 5 1 (2)
01-NOV-07 1209 01 20071101120901100000 585.32 017 85 1 1 (3)
01-NOV-07 1510 01 20071101402501100000 493 014 00 1 1 (4)
01-NOV-07 4025 01 20071101402501100000 203.85 016 00 3 1 (5)
01-NOV-07 4025 01 20071101402501100000 487.96 017 00 1 2 (5)
01-NOV-07 4051 03 20071101402501100000 109.26 016 00 3 1 (6)
02-NOV-07 1209 01 20071102120900000000 105.76 014 00 1 1 (7)
8 rows selected.
What I want actually as in the bracket (group by three fields which are txn_date,poc_code and machine_no)
.I hope this is clearer. -
Heterogeneous Query, need help ASAP!
Post Author: zen69
CA Forum: Data Connectivity and SQL
Hi all! I'm trying to make a report that uses a view with linked table (tables from a linked server).I tested my view in SQL Server and it's working but when I try to use it in my report I get these two error messages:Error #1: Failed to retrieve data from the databaseError #2:
Failed to retrieve data from the database. Details:
42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Heterogeneous queries
require the ANSI_NULLS and ANSI_WARNINGS options to be set for the
connection. This ensures cosistent query semantics. Enable these options and
then reissue your query. [Database Vendor Code: 7405 ]I'm using
Crystal Reports CR Professional; Product Type: FullVersion : 11.0.0.895. Please help me ASAP, I really need it to be done! Thanks,J.B.Post Author: zen69
CA Forum: Data Connectivity and SQL
I forgot to say that I'm using MS SQL Server 2005... -
Ok I just got a new I Mac this weekend (Firsst Mac ever :D) and I deleted bootcamp but now I need it back but I emptyed my Trash and now can't find it so I need to get an installer for bootcamp. I can't find it on OS X's disk 1 or 2 so I need an installer. If anyone could help it would be great
Welcome to Apple Discussions:
I believe it's on disk 1, under optional bundles or packages.
You can also use Pacifist to recover it
http://www.versiontracker.com/dyn/moreinfo/macosx/12743
Or use the information on the following page
http://support.apple.com/kb/TS1889?viewlocale=en_US
Message was edited by: nerowolfe -
Trying to form complex query - need help
I have a fairly complex query that I need to join the results of to show actual and goal by day. The actuals are an aggregation of records that get put in every day, while the targets are a single entry in range format indicating an active range for which the target applies. I'm working on a query that will put things together by month and I'm running into a snag. Can someone please point out where appropriate naming needs to go to get this to come together?
This one works:
(select DATE_INDEX, SUM(LDS) as TTLLDS, SUM(TONS) as TTLTONS from
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC)
group by DATE_INDEX)Now I need to add in the following query:
select (u.MACH_TPH_D+u.MACH_TPH_N)/2 as MTPH_TGT, (u.LABOR_TPH_D+u.LABOR_TPH_N)/2 as LTPH_TGT
from UTIL_TARGET_LOADERS u
where u.ORG_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)The join needs to be based on VEH_LOC and DAY in the form:
... WHERE u.ORG_ID = x.VEH_LOC
AND x.DATE_INDEX between u.START_DATE and NVL(u.END_DATE,sysdate)I had one that worked just fine when only one entity was involved; the complication arises in that this is a division-level report so I have to individually resolve the subordinates and their goals before I can aggregate. This is one of two queries I need to tie together using a WITH clause so I can pivot the whole thing and present it in month-by-month fashion. When I try to tie it together like the query below, I get: invalid relational operator.
select ttls.DATE_INDEX, SUM(ttls.LDS) as TTLLDS, SUM(ttls.TONS) as TTLTONS, u.TARGET_LTPH, u.TARGET_MTPH
from UTIL_TARGET_LOADERS u,
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC) ttls
where ttls.DATE_INDEX beween u.START_DATE and NVL(u.END_DATE,sysdate)
and ttls.VEH_LOC = u.ORG_ID
group by ttls.DATE_INDEXI know this is a nested mess, as it has to grab the production from two tables for a range of VEH_LOC values and sum and aggregate by day and VEH_LOC, then I have to try and match that to the targets based on VEH_LOC and day. My final query is to aggregate the whole mess of sums and averages by month.
I'd appreciate it if someone can point me in the right direction.Figured it out.
select ttl.DATE_INDEX, SUM(ttl.LDS) as TTLLDS, SUM(ttl.TONS) as TTLTONS,
AVG((u.MACH_TPH_D+u.MACH_TPH_N)/2) as MTPH_TGT,
AVG((u.LABOR_TPH_D+u.LABOR_TPH_N)/2) as LTPH_TGT
from
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC) ttl, UTIL_TARGET_LOADERS u
where u.ORG_ID = ttl.VEH_LOC
and ttl.DATE_INDEX between u.START_DATE and NVL(U.END_DATE,sysdate)
group by ttl.DATE_INDEX, (u.LABOR_TPH_D+u.LABOR_TPH_N)/2 -
IPad2 memory full of photos, can't delete. Need help, please!
My iPad2 memory is full of photos because of the mistakes I made when downloading pictures from my camera. Pictures have been downloaded multiple times, plus video from my camera and I videoed a recent family reunion for my dad, who is no longer able to travel and see his family. When I tried to sync my iPad through my pc on iTunes it had errors and did not update. Then I started getting messages on my iPad that my memory was full and I needed to delete photos and videos.
I was able to go to photos, select the arrow on the top right, which gave me the delete option and could select pictures which were downloaded on my iPad and delete them. After deleting about 40 pictures, the delete button no longer worked and I can't get it to work again. I have turned off the iPad, selected one pic at a time, several pics, everything I can think of, but no luck. Does anyone have any advice for me? I would be very grateful for your input.If the Reset doesn't work, try a Restore. Note that it's nowhere near as quick as a Reset. From iTunes, select the iPad/iPod and then select the Summary tab. Follow directions for Restore and be sure to say "yes" to the backup. You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod. Again, say "yes."
-
Hi All,
We have a native SQL query accessing Oracle database(given below).
Can anyone please let me know what this query is about and how can we fine tune the query?
SELECT O.OBJECT_NAME ,
H.SID,
HS.MACHINE,
HS.PROCESS,
W.SID,
WS.MACHINE,
WS.PROCESS,
H.CTIME,
W.CTIME,
WS.ROW_WAIT_OBJ#,
WS.ROW_WAIT_FILE#,
WS.ROW_WAIT_BLOCK#,
WS.ROW_WAIT_ROW#,
HP.SPID,
WP.SPID
FROM V$LOCK H, V$LOCK W, V$LOCK I, V$LOCK I2, ALL_OBJECTS O,
V$SESSION HS, V$SESSION WS, V$PROCESS HP, V$PROCESS WP
WHERE H.ID1 = W.ID1
AND H.SID <> W.SID
AND H.TYPE IN ('TX','DL')
AND H.REQUEST = 0
AND H.SID = I.SID
AND I.TYPE = 'TM'
AND I.ID1 = O.OBJECT_ID
AND I.ID1 = I2.ID1
AND W.SID = I2.SID
AND I2.TYPE = 'TM'
AND H.SID = HS.SID
AND W.SID = WS.SID
AND HS.PADDR = HP.ADDR
AND WS.PADDR = WP.ADDR
INTO :EXCL_LOCK_WAITERS-OBJ_NAME ,
:EXCL_LOCK_WAITERS-HOLDER_SID ,
:EXCL_LOCK_WAITERS-H_HOSTNAME ,
:EXCL_LOCK_WAITERS-HOLDER_PID ,
:HOLDER_PID ,
:EXCL_LOCK_WAITERS-WAITER_SID ,
:EXCL_LOCK_WAITERS-W_HOSTNAME ,
:EXCL_LOCK_WAITERS-WAITER_PID ,
:WAITER_PID ,
:EXCL_LOCK_WAITERS-HELD_SINCE ,
:EXCL_LOCK_WAITERS-WAITSSINCE,
:ROW_WAIT_OBJ,
:ROW_WAIT_FILE,
:ROW_WAIT_BLOCK,
:ROW_WAIT_ROW,
:H_PROCESS,
:W_PROCESS
ENDEXEC
Thanks in advance.
Neethu MohanHi Neethu,
It gives you an overwiew of blocking Oracle sessions.
1. In general, the SQL checks Oracle sessions (SID's) that were requirering a DML lock ('TM') and now holding row locks (TX) to prevent destructive interference of simultaneous conflicting DML or DDL operations. DML statements automatically acquire both table-level locks and row-level locks ('TX') => holders
It joins these with the sessions that are waiting of releasing the lock by the holders => waiters.
2. it retrieves the detail information wich Oracle process , the object (table) , it's row , block and file
are affected by the locks.
3. Normally, the locks are only hold for a short period of time. If you have blocking sessions it may be of a log running task (i.e. mass data update of a table) ; but it could also be a application bug due to improper handling of concurrent updates of the same object.
4. Tuning
V$tables are expensive to query: Why?
v$ tables are generally Oracle memory structures.
v$ tables are not read consistent.
v$ tables require latches to access -- cannot modify and read memory at the same
time.
heavy access to v$ tables like this may cause some serious heavy duty contention.
Especially if you self join V$lock several times.
So the best would be to save the contents of V$LOCK in some table:
Create table mylocks as select * from v$lock;
Use that table for self-joining and joins to the other tables.
You can also CTAS the other v$ tables to bypass the performance bottleneck while retrieving
v$ directly.
You can empty or drop the created tables any time for new data.
Because you want to investigate only lock hold for a longert time to copy the v$ memory structures into
physical tables is not a disadvantage. You certainly will wait longer on finishing your query
instead of copy them into the tables.
Hope this helped
yk -
Hi Experts,
I've gone through so many mpls documents and I believe i have a decent grasp of how it works but applying those principles i appear to be stuck in a setup that just won't work.
The setup is pretty straigh forward: R1 is connected to R2 and R2 is connected to R3.
R1 has ospf peering with R2 and R2 has ospf peering with R3.
OSPF working fine and connectivity via Lo on all routers working.
R1 has MP-BGP bgp peering with R3 where R1 and R3 is advertising its Lo100 interface to each other.
BGP working fine and I can see from R1 the Lo100 ip of R3 on the vrf myvrf routing table of R1.
When I do a show ip route vrf myvrf on R1, route to Lo100 of R3 (99.1.1.3) has an egress of 5.1.1.3 (default global table).
But when i try to ping from R1, 'ping vrf myvrf 99.1.1.3 source 99.1.1.1' , ping fails.
Documentation says that this should work but apparently it doesn't for me; am not sure what i am missing here.
I even tried to leak the route on both R1 and R3. But still no go.
R1:
ip route vrf myvrf 5.1.1.3 255.255.255.255 f0/0 1.1.1.2
R3:
ip route vrf myvrf 5.1.1.1 255.255.255.255 f0/0 2.1.1.1
Don't know what i am doing wrong here. And to be honest am getting confused. Please help.
Setup is as follows:
R1:
int f0/0
ip 1.1.1.1 255.255.255.0
mpls ip
int Lo0
ip add 5.1.1.1
int Lo100
ip vrf forwarding myvrf
ip add 99.1.1.1 255.255.255.255
ip vrf myvrf
rd 10:20
route-target both 10:20
router ospf 1
router-id 5.1.1.1
network 1.1.1.0 0.0.0.255 area 0
network 5.1.1.3 0.0.0.0.0 area 0
router bgp 10
neighbor 5.1.1.3 remote-as 10
no neighbor 5.1.1.3 active
neighbor 5.1.1.3 update-source Lo0
address-family vpnv4
neighbor 5.1.1.3 activate
neighbor 5.1.1.3 send-community both
address-family ipv4 vrf myvrf
network 99.1.1.1 mask 255.255.255.255
R2:
int f0/0
ip add 1.1.1.2 255.255.255.0
mpls ip
int f1/0
ip add 2.1.1.1 255.255.255.0
mpls ip
int Lo0
ip add 5.1.1.2 255.255.255.0
router ospf 1
router-id 5.1.1.2
network 1.1.1.0 0.0.0.255 area 0
network 2.1.1.0 0.0.0.255 area 0
network 5.1.1.2 0.0.0.0 area 0
R3:
int f0/0
ip add 2.1.1.2 255.255.255.0
mpls ip
int Lo0
ip add 5.1.1.3 255.255.255.0
int Lo100
ip vrf forwarding myvrf
ip add 99.1.1.3 255.255.255.255
router ospf 1
network 2.1.1.0 0.0.0.255 area 0
network 5.1.1.2 0.0.0.0 area 0
router bgp 10
neighbor 5.1.1.1 remote-as 10
no neighbor 5.1.1.1 activate
neighbor 5.1.1.1 update-source Lo0
address-family vpnv4
neighbor 5.1.1.3 activate
neighbor 5.1.1.3 send-community both
address-family ipv4 vrf myvrf
network 99.1.1.3 mask 255.255.255.255Hello Marcusbrutus,
blau grana is right you have an issue with loopback addresses subnet masks.
Your control plane looks like fine because you have all the expected MP BGP VPNv4 routes in place, but the forwarding plane is broken.
MPLS L3 VPN packets are sent within the LSP with destination the remote PE loopback address so from R1 point of view is R3's L0.
If you go on R2 device and you check the state of MPLS forwarding for R3 L0 IP address you will see that instead of seeing a POP TAG action you will see an untagged action.
The reason for the wrong LSP binding is the subnet mask on R3 loopback address: OSPF advertises all loopback addresses with a /32 mask by default, but the subnet mask is different. LDP carries the configured subnet mask. But installation of labels is made after check with IGP (OSPF in this case).
As a result of this the R2 router cannot install the correct POP TAG = implicit null label as action to do to reach R3 L0.
With POP TAG action the R2 router removes the external label (POP a label) and sends a packet (with MPLS ethertype on ethernet) with a single label MPLS stack to the egress PE R3. R3 sees a label associated to the VRF and it is able to route the packet to the appropriate interface.
With untagged action R2 removes a label take all the packet content and sends it as it was an IP packet to the downstream device. (with ethertype 0x800 on ethernet) The downstream device finds a packet that is supposed to be an IP packet but it isn't (for the inner label still there) and silently drops it.
This is what we had seen in lab tests.
To solve this issue you should:
use /32 loopback addresses this the recommended best practice
or you can still use non overlapping non /32 loopback addresses but you need to add the command ip ospf network point-to-point under loopback configuration as this makes OSPF to advertise the true IP subnet mask
Hope to help
Giuseppe -
Heirarchy query - Need help please!
DB ver: Oracle DB 10g Rel2
I have data as follows
LAST_NAME EMPLOYEE_ID MANAGER_ID
King 100 null
Cambrault 148 100
Bates 172 148
Bloom 169 148
Fox 170 148
Ozer 168 172
Smith 171 172
De Haan 102 169
Hunold 103 169
Austin 105 169
Ernst 104 170
When Cambrault(emp.id:148) logs in he should see the reporting structure as follows
- Cambrault
-- Bates
--- Ozer
--- Smith
-- Bloom
--- De Haan
--- Hunold
--- Austin
-- Fox
--- Ernst
Similerly when Bates(Emp.Id:172) logs in he should see as follows
- Bates
-- Ozer
-- Smith
How to write a query to get output of records as above?
I could write it as follows but getting all the records.
SELECT e1.ename||' works for Supervisor '||e2.ename
FROM emp e1, emp e2
WHERE e1.mgr = e2.empno;
Any help is highly appreciated. Thanks in advance.
movva
Edited by: cmovva on 27-Oct-2011 12:07 PMmaybe this example might help.
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7902 FORD ANALYST 7782 03-Dec-81 3000.00 20
7839 KING PRESIDENT 17-Nov-81 5000.00 10
7698 BLAKE MANAGER 7839 01-May-81 2850.00 30
7782 CLARK MANAGER 7839 09-Jun-81 2450.00 10
7788 SCOTT ANALYST 7782 09-Dec-82 3000.00 20
7844 TURNER SALESMAN 7698 08-Sep-81 1500.00 0.00 30
7876 ADAMS CLERK 7782 12-Jan-83 1100.00 20
7900 JAMES CLERK 7698 03-Dec-81 950.00 30
7934 MILLER CLERK 7782 23-Jan-82 1300.00 10
7945 CINDY SALESMAN 7698 16-Jan-83 1800.00 30
7950 TINA SALESMAN 7698 18-Jan-83 1850.00 30
11 rows selected
SQL>
SQL> select substr(lpad(' ',2*(level-1)) || ename,1,40) employee_name, job, hiredate, sal
2 from emp
3 start with mgr is null
4 connect by prior empno = mgr;
EMPLOYEE_NAME JOB HIREDATE SAL
KING PRESIDENT 17-Nov-81 5000.00
BLAKE MANAGER 01-May-81 2850.00
TURNER SALESMAN 08-Sep-81 1500.00
JAMES CLERK 03-Dec-81 950.00
CINDY SALESMAN 16-Jan-83 1800.00
TINA SALESMAN 18-Jan-83 1850.00
CLARK MANAGER 09-Jun-81 2450.00
SCOTT ANALYST 09-Dec-82 3000.00
ADAMS CLERK 12-Jan-83 1100.00
FORD ANALYST 03-Dec-81 3000.00
MILLER CLERK 23-Jan-82 1300.00
11 rows selected
SQL> using your sample data something like this:
SQL> select *
2 from (select 'King' last_name, 100 employee_id, null manager_id from dual union all
3 select 'Cambrault' last_name, 148 employee_id, 100 manager_id from dual union all
4 select 'Bates' last_name, 172 employee_id, 148 manager_id from dual union all
5 select 'Bloom' last_name, 169 employee_id, 148 manager_id from dual union all
6 select 'Fox' last_name, 170 employee_id, 148 manager_id from dual union all
7 select 'Ozer' last_name, 168 employee_id, 172 manager_id from dual union all
8 select 'Smith' last_name, 171 employee_id, 172 manager_id from dual union all
9 select 'De,Haan' last_name, 102 employee_id, 169 manager_id from dual union all
10 select 'Hunold' last_name, 103 employee_id, 169 manager_id from dual union all
11 select 'Austin' last_name, 105 employee_id, 169 manager_id from dual union all
12 select 'Ernst' last_name, 104 employee_id, 170 manager_id from dual) e;
LAST_NAME EMPLOYEE_ID MANAGER_ID
King 100
Cambrault 148 100
Bates 172 148
Bloom 169 148
Fox 170 148
Ozer 168 172
Smith 171 172
De,Haan 102 169
Hunold 103 169
Austin 105 169
Ernst 104 170
11 rows selected
SQL>
SQL> select substr(lpad(' ',2*(level-1)) || e.last_name,1,40) last_name,
2 e.employee_id,
3 e.manager_id
4 from (select 'King' last_name, 100 employee_id, null manager_id from dual union all
5 select 'Cambrault' last_name, 148 employee_id, 100 manager_id from dual union all
6 select 'Bates' last_name, 172 employee_id, 148 manager_id from dual union all
7 select 'Bloom' last_name, 169 employee_id, 148 manager_id from dual union all
8 select 'Fox' last_name, 170 employee_id, 148 manager_id from dual union all
9 select 'Ozer' last_name, 168 employee_id, 172 manager_id from dual union all
10 select 'Smith' last_name, 171 employee_id, 172 manager_id from dual union all
11 select 'De,Haan' last_name, 102 employee_id, 169 manager_id from dual union all
12 select 'Hunold' last_name, 103 employee_id, 169 manager_id from dual union all
13 select 'Austin' last_name, 105 employee_id, 169 manager_id from dual union all
14 select 'Ernst' last_name, 104 employee_id, 170 manager_id from dual) e
15 start with e.manager_id is null
16 connect by prior e.employee_id = e.manager_id;
LAST_NAME EMPLOYEE_ID MANAGER_ID
King 100
Cambrault 148 100
Bloom 169 148
De,Haan 102 169
Hunold 103 169
Austin 105 169
Fox 170 148
Ernst 104 170
Bates 172 148
Ozer 168 172
Smith 171 172
11 rows selected
SQL> -
Almost there; keyword search query need help
I will want to eventually add more columns to search but
wanted to get it working with story only for now. I think I am very
close. I have a very simple form with a textfield and submit
button. the search field has a binding Request.search variable
assigned to it. My query works in the Recordset Dialog box, can
enter a test value in simple mode and it works. I entered
construction and get three stories containing construction.
Main problem is that no matter what I search when testing
through my browser using my pc's Inetpub/wwwroot I get all news
stories. I can even type in a weird search word like zebra and
still get all records.
here is my simple form code
<form id="form1" name="form1" method="get"
action="keywordjimresults.asp">
<input name="search" type="text" id="search"
value="<%= Request("search") %>" />
<br />
<input type="submit" value="Search" />
</form>
Here is my results page code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rsKeyword_numRows = rsKeyword_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="650" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td><form id="form1" name="form1" method="get"
action="keywordjimresults.asp">
<input name="search" type="text" id="search"
value="<%= Request("search") %>" />
<br />
<input type="submit" value="Search" />
</form> </td>
<td rowspan="6"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
THANK YOU JimI don't see anything at the bottom.
Suggest that you open the blank file to the size that you want, and the resolution the same as that of the picture.
Bring both of these into view - tile view is good
Drag picture to blank file. Do not drag from the project bin for this purpose
You could also open the picture, go to Select>all, then Edit>copy. This will put it on the clipboard. Then in your destination, go to Edit>paste
Resizing can be done in several ways. The least complicated way, in my opinion, is to use the crop tool, where you can enter the width and height in inches, and the resolution as well. The aspect ratio of the original picture may not conform to what you want. For example, a 4x6" picture has to be cropped in order to arrive at 1x1" - something has to go. -
Hi all,
i have solution i got earlier form this forum.
CREATE TABLE LHEADER
(HDT DATE,
HSR NUMBER,
HCODE VARCHAR2(6),
HAMOUNT NUMBER);
INSERT INTO LHEADER VALUES (TO_DATE('01012009','DD/MM/YYYY'),1,101,5000);
INSERT INTO LHEADER VALUES (TO_DATE('01022009','DD/MM/YYYY'),2,102,3000);
INSERT INTO LHEADER VALUES (TO_DATE('01012009','DD/MM/YYYY'),3,103,6000);
CREATE TABLE DDETAIL
(DDT DATE,
DHSR NUMBER,
DHCODE VARCHAR2(6),
DAMOUNT NUMBER,
D1 NUMBER,
D2 NUMBER,
D3 NUMBER);
INSERT INTO DDETAIL VALUES (TO_DATE('31012009','DD/MM/YYYY'),1,101,1500,NULL,NULL,10);
INSERT INTO DDETAIL VALUES (TO_DATE('31012009','DD/MM/YYYY'),1,101,NULL,20,15,20);
INSERT INTO DDETAIL VALUES (TO_DATE('28022009','DD/MM/YYYY'),1,101,NULL,20,12,20);
INSERT INTO DDETAIL VALUES (TO_DATE('31032009','DD/MM/YYYY'),1,101,NULL,20,16,20);
INSERT INTO DDETAIL VALUES (TO_DATE('30042009','DD/MM/YYYY'),1,101,NULL,20,20,20);
INSERT INTO DDETAIL VALUES (TO_DATE('28022009','DD/MM/YYYY'),2,102,2000,15,NULL,15);
INSERT INTO DDETAIL VALUES (TO_DATE('28022009','DD/MM/YYYY'),2,102,NULL,12,10,15);
INSERT INTO DDETAIL VALUES (TO_DATE('31032009','DD/MM/YYYY'),2,102,NULL,12,15,8);
INSERT INTO DDETAIL VALUES (TO_DATE('30042009','DD/MM/YYYY'),2,102,NULL,12,12,15);
INSERT INTO DDETAIL VALUES (TO_DATE('31012009','DD/MM/YYYY'),3,103,NULL,30,20,25);
INSERT INTO DDETAIL VALUES (TO_DATE('28022009','DD/MM/YYYY'),3,103,NULL,30,20,25);
INSERT INTO DDETAIL VALUES (TO_DATE('31032009','DD/MM/YYYY'),3,103,NULL,30,20,25);
INSERT INTO DDETAIL VALUES (TO_DATE('30042009','DD/MM/YYYY'),3,103,3000,NULL,30,25);
INSERT INTO DDETAIL VALUES (TO_DATE('30042009','DD/MM/YYYY'),3,103,NULL,30,20,25);
SELECT ddt
, dhsr
, dhcode
, NVL ( CASE
WHEN d1 + d2 + d3 IS NULL
THEN LAG (run_tot) OVER ( PARTITION BY dhcode
, dhsr
ORDER BY ddt
END
, amount
) AS amount
, d1
, d2
, d3
, run_tot
FROM (
SELECT d.ddt
, d.dhsr
, d.dhcode
, NVL ( d.damount
, h.hamount
) AS amount
, d.d1
, d.d2
, d.d3
, h.hamount - CASE
WHEN d1 + d2 + d3 IS NULL
THEN NULL
ELSE SUM ( d.d1
+ d.d2
+ d.d3
) OVER ( PARTITION BY d.dhcode
, d.dhsr
ORDER BY d.ddt
END AS run_tot
FROM ddetail d
, lheader h where d.dhcode = h.hcode
AND d.dhsr = h.hsr
ORDER BY ddt
, dhcode
, d1 + d2 + d3 NULLS FIRST
DDT DHSR DHCODE AMOUNT D1 D2 D3 RUN_TOT
31/01/2009 1.000 101 1500.000 10.000
31/01/2009 1.000 101 5000.000 20.000 15.000 20.000 4945.000
31/01/2009 3.000 103 6000.000 30.000 20.000 25.000 5925.000
28/02/2009 1.000 101 5000.000 20.000 12.000 20.000 4893.000
28/02/2009 2.000 102 2000.000 15.000 15.000
28/02/2009 2.000 102 3000.000 12.000 10.000 15.000 2963.000
28/02/2009 3.000 103 6000.000 30.000 20.000 25.000 5850.000
31/03/2009 1.000 101 5000.000 20.000 16.000 20.000 4837.000
31/03/2009 2.000 102 3000.000 12.000 15.000 8.000 2928.000
31/03/2009 3.000 103 6000.000 30.000 20.000 25.000 5775.000
30/04/2009 1.000 101 5000.000 20.000 20.000 20.000 4777.000
30/04/2009 2.000 102 3000.000 12.000 12.000 15.000 2889.000
30/04/2009 3.000 103 5775.000 30.000 25.000
30/04/2009 3.000 103 6000.000 30.000 20.000 25.000 5700.000
14 rows selected.i want to the output to be like this now;
the query should SUM d1,d2 & d3 where RUN_TOT is NULL.
Rows with Null RUN_TOT should not be shown.
DDT DHSR DHCODE AMOUNT D1 D2 D3 RUN_TOT
31/01/2009 1.000 101 5000.000 20.000 15.000 *30.000* 4945.000
31/01/2009 3.000 103 6000.000 30.000 20.000 25.000 5925.000
28/02/2009 1.000 101 5000.000 20.000 12.000 20.000 4893.000
28/02/2009 2.000 102 3000.000 *27.000* 10.000 *30.000* 2963.000
28/02/2009 3.000 103 6000.000 30.000 20.000 25.000 5850.000
31/03/2009 1.000 101 5000.000 20.000 16.000 20.000 4837.000
31/03/2009 2.000 102 3000.000 12.000 15.000 8.000 2928.000
31/03/2009 3.000 103 6000.000 30.000 20.000 25.000 5775.000
30/04/2009 1.000 101 5000.000 20.000 20.000 20.000 4777.000
30/04/2009 2.000 102 3000.000 12.000 12.000 15.000 2889.000
30/04/2009 3.000 103 6000.000 30.000 *50.000 50.000* 5700.000
14 rows selected.Hello Mr. Frank..
I designed a report based on your solution, but when executed with the actual data, with what the user have entered,
the report didn't returned the expected result. Yes, your logic with the earlier data provided by me was correct.
but now the data has appeared in different manner.
i tried to modify your query but didn't exactly succeed.
for this data;
CREATE TABLE LHEADER
(HDT DATE,
HSR NUMBER,
HCODE VARCHAR2(6),
HAMOUNT NUMBER);
INSERT INTO LHEADER VALUES (TO_DATE('10/03/2010','DD/MM/YYYY'),12,1392,48571.1);
INSERT INTO LHEADER VALUES (TO_DATE('16/03/2010','DD/MM/YYYY'),14,1526,40732);
INSERT INTO LHEADER VALUES (TO_DATE('08/01/2010','DD/MM/YYYY'),9,1835,31600);
CREATE TABLE DDETAIL
(DDT DATE,
DHSR NUMBER,
DHCODE VARCHAR2(6),
DAMOUNT NUMBER,
D1 NUMBER,
D2 NUMBER,
D3 NUMBER);
INSERT INTO DDETAIL VALUES (TO_DATE('01/10/2009','DD/MM/YYYY'),12,1392,37103,NULL,12.986,217.434);
INSERT INTO DDETAIL VALUES (TO_DATE('01/11/2009','DD/MM/YYYY'),12,1392,37103,NULL,12.986,210.420);
INSERT INTO DDETAIL VALUES (TO_DATE('01/09/2009','DD/MM/YYYY'),12,1392,37103,NULL,12.986,210.420);
INSERT INTO DDETAIL VALUES (TO_DATE('01/12/2009','DD/MM/YYYY'),12,1392,2470,NULL,0,2.335);
INSERT INTO DDETAIL VALUES (TO_DATE('01/12/2009','DD/MM/YYYY'),12,1392,39573,NULL,13.851,231.909);
INSERT INTO DDETAIL VALUES (TO_DATE('01/01/2010','DD/MM/YYYY'),12,1392,39573,NULL,13.851,231.909);
INSERT INTO DDETAIL VALUES (TO_DATE('01/02/2010','DD/MM/YYYY'),12,1392,39573,NULL,13.850,209.466);
INSERT INTO DDETAIL VALUES (TO_DATE('01/02/2010','DD/MM/YYYY'),12,1392,4489.7,NULL,5.836,23.765);
INSERT INTO DDETAIL VALUES (TO_DATE('01/03/2010','DD/MM/YYYY'),12,1392,4489.7,NULL,2.918,26.311);
INSERT INTO DDETAIL VALUES (TO_DATE('01/03/2010','DD/MM/YYYY'),12,1392,39573,0,13.855,231.909);
INSERT INTO DDETAIL VALUES (TO_DATE('01/12/2008','DD/MM/YYYY'),14,1526,11620,NULL,0,50.046);
INSERT INTO DDETAIL VALUES (TO_DATE('01/01/2009','DD/MM/YYYY'),14,1526,11620,NULL,4.066,64.642);
INSERT INTO DDETAIL VALUES (TO_DATE('01/02/2009','DD/MM/YYYY'),14,1526,11620,NULL,4.066,58.387);
INSERT INTO DDETAIL VALUES (TO_DATE('01/03/2009','DD/MM/YYYY'),14,1526,11620,NULL,4.066,64.642);
INSERT INTO DDETAIL VALUES (TO_DATE('01/04/2009','DD/MM/YYYY'),14,1526,19220,NULL,6.726,103.472);
INSERT INTO DDETAIL VALUES (TO_DATE('01/05/2009','DD/MM/YYYY'),14,1526,19220,NULL,6.726,106.921);
INSERT INTO DDETAIL VALUES (TO_DATE('01/05/2009','DD/MM/YYYY'),14,1526,7600,NULL,NULL,17.73);
INSERT INTO DDETAIL VALUES (TO_DATE('01/06/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.386,144.387);
INSERT INTO DDETAIL VALUES (TO_DATE('01/07/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.386,149.200);
INSERT INTO DDETAIL VALUES (TO_DATE('01/08/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.387,48.129);
INSERT INTO DDETAIL VALUES (TO_DATE('01/08/2009','DD/MM/YYYY'),14,1526,26820,NULL,NULL,106.472);
INSERT INTO DDETAIL VALUES (TO_DATE('01/09/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.387,152.102);
INSERT INTO DDETAIL VALUES (TO_DATE('01/10/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.387,157.173);
INSERT INTO DDETAIL VALUES (TO_DATE('01/11/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.387,152.102);
INSERT INTO DDETAIL VALUES (TO_DATE('01/12/2009','DD/MM/YYYY'),14,1526,26820,NULL,9.387,157.173);
INSERT INTO DDETAIL VALUES (TO_DATE('01/01/2010','DD/MM/YYYY'),14,1526,5700,NULL,NULL,8.620);
INSERT INTO DDETAIL VALUES (TO_DATE('01/01/2010','DD/MM/YYYY'),14,1526,32520,NULL,11.382,190.576);
INSERT INTO DDETAIL VALUES (TO_DATE('01/02/2010','DD/MM/YYYY'),14,1526,32520,NULL,11.382,172.133);
INSERT INTO DDETAIL VALUES (TO_DATE('01/03/2010','DD/MM/YYYY'),14,1526,37745,NULL,13.21,221.196);
INSERT INTO DDETAIL VALUES (TO_DATE('01/03/2010','DD/MM/YYYY'),14,1526,5225,NULL,NULL,4.939);
INSERT INTO DDETAIL VALUES (TO_DATE('04/01/2010','DD/MM/YYYY'),9,1835,31600,131.667,11.06,185.185);
INSERT INTO DDETAIL VALUES (TO_DATE('05/02/2010','DD/MM/YYYY'),9,1835,31468.333,131.667,11.014,166.567);
INSERT INTO DDETAIL VALUES (TO_DATE('08/03/2010','DD/MM/YYYY'),9,1835,31336.666,131.667,10.968,183.641);
INSERT INTO DDETAIL VALUES (TO_DATE('10/04/2010','DD/MM/YYYY'),9,1835,31204.999,131.667,10.922,176.971);
i modified your query like this;
SELECT ddt
, dhsr
, dhcode
, amount
, d1
, d2
, d3
, run_tot
FROM (
SELECT ddt
, dhsr
, dhcode
, NVL ( CASE
WHEN NVL(d1 + d2 + d3,0) = 0
THEN LAG (run_tot) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
ORDER BY ddt
END
, amount
) AS amount
, SUM (NVL(d1,0)) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
, a_cnt
) AS d1
, SUM (NVL(d2,0)) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
, a_cnt
) AS d2
, SUM (NVL(d3,0)) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
, a_cnt
) AS d3
, run_tot
FROM (
SELECT d.ddt
, d.dhsr
, d.dhcode
, NVL ( d.damount
, h.hamount
) AS amount
, d.d1
, d.d2
, d.d3
, h.hamount - CASE
WHEN NVL(d1 + d2 + d3,0) = 0
THEN NULL
ELSE SUM ( NVL(d.d1
+ d.d2
+ d.d3,0)
) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
ORDER BY d.ddt
END AS run_tot
, COUNT (d1 + d2 + d3) OVER ( PARTITION BY dhcode,to_char(ddt,'yyyymm')
ORDER BY d.ddt DESC
) AS a_cnt
FROM ddetail d
, lheader h where d.dhcode = h.hcode
AND d.dhsr = h.hsr
--WHERE run_tot IS NOT NULL
WHERE to_char(ddt,'yyyymm') = '201003'
ORDER BY ddt
, dhcode
, d1 + d2 + d3
i got this output;
DDT DHSR DHCODE AMOUNT D1 D2 D3 RUN_TOT
01/03/2010 12 1392 4489.7 0 16.773 258.22
01/03/2010 12 1392 39573 0 16.773 258.22 48325.336
01/03/2010 14 1526 37745 0 13.21 226.135
01/03/2010 14 1526 5225 0 13.21 226.135
08/03/2010 9 1835 31336.666 131.667 10.968 183.641 31273.724
but the expected result should be like this;
DDT DHSR DHCODE AMOUNT D1 D2 D3 RUN_TOT
01/03/2010 12 1392 39573 0 16.773 258.220 39573.000
01/03/2010 14 1526 37745 13.210 226.135 37745.000
08/03/2010 9 1835 31336.666 131.667 10.968 183.641 31204.999
and when i change the last condition part...to
WHERE run_tot IS NOT NULL
AND to_char(ddt,'yyyymm') = '201003'
ORDER BY ddt
, dhcode
, d1 + d2 + d3 ...
DDT DHSR DHCODE AMOUNT D1 D2 D3 RUN_TOT
01/03/2010 12 1392 39573 0 16.773 258.22 48325.336
08/03/2010 9 1835 31336.666 131.667 10.968 183.641 31273.724
1. The row for dhcode 1526 does not appear and
2. The runtot for 1835 gets wrongly calculated (it should be 31336.666-131.667=31204.999)Please suggest .
TYVM. -
Access permission query - need help
Hi ,
I want to produce the following scenario:-
1. I created a new portal user called neerajs/pass123.
2. Created a new page group.
3. Created a new page into the page group created in step 2.
4. created a new tab inside the page created in step 3.
5. added a portlet into the tab created in step 4.
Now i want that when user neerajs will log in he must see only the portlet added in step 5.
The user neerajs will find only the links Home,Help and Logout.
I have done the following:
1. Grant access to user neerajs for the page group created in step 2.
2. default page group for user neerajs is set to the one created in step2.
Could any one suggest some way to do this or suggest the documentation which i can refer.
Thnx
<Neeraj Sidhaye/>Hi ,
Thanks for you reply.
I will try this out and will let you know the results.
Are you talking about "setting default home page" for the user ,in your last line of reply ?
I think , this is the case when user clicks on Home link then this default page will be rendered. Am i right ?
Is there any docs which can tell all about the Access Privileges and also tells about how to play with Role Based Security in Oracle Portal Server ?
Thanks Again
<Neeraj Sidhaye/>
Try_Catch_Finally AT YAHOO DOT COM
http://ExtremePortal.blog.co.uk -
How Can I Restore Deleted Query?
Hi, gurus.
Can anybody tell me How Can I Restore Deleted Query?
Help me plz.If it has only been deleted from the role and not the object completely then it could still be found within infoareas in Bex, if the object has been deleted completely you could re-transport the query from the development system assuming it was created her in the first instance.
I'm not sure if you can retrieve the query any other way, i do know there are procedures for workbook retrieval but for querys im not certain.
Maybe you are looking for
-
Need help with my serial ata drive
Ok. I have has a series of issues and am now just back online. Here is my main problem at this point. I have a dual boot running on a wd raptor 36gig. I updated my bios to 2.30 from 1.0 and this drive disapeared. I managed to get it back by c
-
How to delete the approvals routing (All, Serial)?
I´m using Oracle Portal 9i, defining the approvals to manage portal´s content, and have some problem: When i´m choosing the specific routing method (All.serial), which the corect procedure for delete this step? Im asking this reason because this step
-
Graph data at a certain sampling rate
I am acquiring data at a sampling rate of 50kHz and I want to plot it on a graph or a chart continuously. The data is in an array which is connected to the graph/chart. I can see the signal (sine wave) but the time scales are not right. I have set "m
-
Why two paths for backend xml files?
Hi All, I have a doubt on the back-end configuration(XML) files.. The BI maintains the config files in two paths.. OracleBI_HOME\web\app\res <Oc4j_bi or OAS>\j2ee\home\applications\analytics\analytics\res When we require to modify any file/content, w
-
My iPod Touch 4S is no longer able to update applications (They just sit and wait forever). How do I fix this?