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
Similar Messages
-
need help regarding may ipad, i cant access my ipad, need help regarding may ipad, i cant access my ipad
Can you be little more specific?
-
I have been having this problem for few weeks I tried to unistall it and reinstall it still didn't work I also tried to delet the shortcut by draging it to Recyle bin and find the iTunes through the c drive and send the icon or even open it from there still didn't work so I really need help here.
Thank youOk. seems like I am in bigger problem than what i thought..So i did what you asked me and here is the log from the scan
Malwarebytes Anti-Malware (Trial) 1.62.0.1300
www.malwarebytes.org
Database version: v2012.07.25.04
Windows 7 Service Pack 1 x64 NTFS
Internet Explorer 9.0.8112.16421
[administrator
Protection: Enabled
7/25/2012 8:34:03 PM
mbam-log-2012-07-25 (20-42-53).txt
Scan type: Quick scan
Scan options enabled: Memory | Startup | Registry | File System | Heuristics/Extra | Heuristics/Shuriken | PUP | PUM
Scan options disabled: P2P
Objects scanned: 239337
Time elapsed: 7 minute(s), 52 second(s)
Memory Processes Detected: 0
(No malicious items detected)
Memory Modules Detected: 0
(No malicious items detected)
Registry Keys Detected: 1
HKLM\SOFTWARE\Google\chrome\Extensions\fdloijijlkoblmigdofommgnheckmaki (PUP.Funmoods) -> No action taken.
Registry Values Detected: 0
(No malicious items detected)
Registry Data Items Detected: 0
(No malicious items detected)
Folders Detected: 0
(No malicious items detected)
Files Detected: 3
C:\Users\mer\Downloads\7zip_Setup.exe (PUP.Bundle.Installer.OI) -> No action taken.
C:\Users\mer\Downloads\Setup.exe (PUP.Bundle.Installer.OI) -> No action taken.
C:\Users\mer\Downloads\SoftonicDownloader_for_mkv-player.exe (PUP.ToolbarDownloader) -> No action taken.
So I removed everything and did the restart but still didn't work, the I used Microsoft Security Essentials and find this one: TrojanDownloader:ASX/Wimad.DS and the alert level was severe so I removed too and the problem was still there even after restarting the computer, Now I am kinda lost and I dont Know what to do. -
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. -
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 -
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... -
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 -
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> -
Access SQL Query - INSERT Help!
Hi,
I'm trying to do a simple INSERT statement in an Access Database.
My code is:
public SQLConnect() {
// SQL Connection Part
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //have tried with .newInstance() as well but same effect
String filename = "C://Maxi//maxi.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection(database, "", "");
PreparedStatement ps = con.prepareStatement("INSERT INTO Student (ID,FamilyName,FirstName,OtherName,Email,Phone,DOB,CourseType,Sex) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setString(1, "071111114");
ps.setString(2, "Crane");
ps.setString(3, "Frasier");
ps.setString(4, "Winslow");
ps.setString(5, "[email protected]");
ps.setString(6, "012345");
ps.setString(7, "01/01/2008");
ps.setString(8, "M");
ps.setString(9, "M");
ps.executeUpdate();
//Statement t = con.createStatement();
//t.execute("SELECT * FROM STUDENT");
//con.close();
} catch (Exception e) {
System.out.println("ERROR!");
e.printStackTrace();
}I am experiencing weird behaviour with the INSERT command being carried out successfully.
The code as above will not INSERT the data in the PreparedStatement.
However if I use any of the two methods in the commented out code, the INSERT will be carried out. Why is this happening? Surely it should just INSERT the data with the line ps.executeUpdate() without having to wait for any further commands.
The reason I don't want to close the connection is that I am attempting to make a class so I can do simple INSERT, UPDATE and SELECT queries without having to go through the initial connection steps each time. I have read that opening and closing a connection for each query takes a lot of overhead, but it seems to be the only way this will properly execute.
I am welcome to any suggestions.
Cheers.Ha it always seems to fix itself as soon as you post about it.
It would look as if when creating the connection if you do:
con.setAutoCommit(false);and then after the ps.executeUpdate(); if you commit with:
con.commit();this actually works.
If you omit to set the AutoCommit then this does not work. I am still stumped as to why I have to do this. Any explanations?
Edited by: adamuk on Mar 15, 2008 10:19 PM -
Wrong forum, but can't access correct one - need help with Safari
I'm sorry to post this here, but the link to the Safari discussion forum is broken - I've tried it about 10 times!
I've been having trouble with Safari 1.3, which quit every time I navigated to a page using a certain type of code (I don't know what it was, maybe Java or Flash?) Anyway, I downloaded the Safari 3 Universal version in the hope of improving it, but unfortunately that has completely killed off both Safari itself and Mail. I couldn't even use Firefox or Internet Explorer, although other programs such as Word and Photoshop were working fine. Trashing Safari and everything I could find related to it meant that Firefox would work (I'm using that now), but I still can't start Mail. I assume Mail needs Safari to be installled in order to work?
I've tried to download Safari 1 again, but can only find links to download the 1.3 Updater, not the program itself. Of course, the Updater won't install because there's no previous version to load it onto. Can anyone help me with a suggestion as to where I go from here, please? I'd be hugely grateful, I don't mind not having Safari but I do really need to use Mail.
Thank you!
- KittyThere are many, many millions of defective, nonstandard web sites, as a brody points out. You could, if you wished, make a crusade of asking their developers to make them accessible in every antique web browser: a crusade for which you would be rewarded with a brody's undying admiration, most of those incompetent website developers' annoyance, and nothing else.
If instead you would rather just visit the sites and see what you can see of them, use Camino or Opera — the only up-to-date browsers that will run in OS X 10.3.9. Mozilla FireFox 2.0.20 will indeed run in your OS version, but it "is no longer supported and contains known security vulnerabilities" according to the Mozilla website. The more recent updates of FireFox (3.0 through 3.0.10) require OS X 10.4 or better. -
Page Access Not working - Need help immediately
Hey,
I am having a major problem. All of a sudden One of my pages (accessible from the NavBar) will not allow anyone to access it, unless they have a role granted to them of administration. It gives a page not found error. This started for no reason and I am unsure as to why this is happening. Can someone please help me out?
Thanks,
ScottNevermind..... I thought it was an htmldb problem. Apparently, we had a session going on that was blocking all non-admins. Problem fixed.
-
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.
Maybe you are looking for
-
Hello all, Can anyone please tell me in this? the problem is, Vendor has two bank accounts, one is maintained in USD and another one is in EUR. Whenever we do payments through APP, the payment has to go USD account but it is going to EUR account. Whe
-
PDF Form Emaling.... Sometimes
We have set up a form using LiveCycle ES 8. The form is a PDF and "sends" via email. The email does send out automatically (in Outlook) I wish the email would open and then I could write a note in the body. But instead the dialogue box comes up and t
-
Photoshop Album mini 3.0のインストーラーが見つからない
会社でPhotoshop Album mini 3.0を使用しており使いやすいため.自宅のパソコンにもインストールしようとしたら.インストーラーが見つかりません.OSがwindows2000であるためmini 3.2は使用できず.mini 3.0に慣れているため2.0では物足りない感じです.一応.adobeのサイトはくまなく調べたのですが.インストーラーをダウンロードできるところがわかる方がいましたら教えてください .
-
I recently purchased a new Macbook Pro. I used the migration assistant and transferred all data from a Time Machine backup. Everything seems to be working just fine except for Aperture. It wants a serial number. I still have my old computer so
-
how do i report my device lost? And how to track it down?