Help with the query
Hi
I need to execute a select statement base on an input parameter like the following. Please share your thoughts
select (case when param = 1 then
(select * from emp_1 a,dept_1 b
where a.dept_no=b.dept_no)
when param = 2 then
(select * from emp_2 a,dept_2 b
where a.dept_no=b.dept_no)
else
end)
from dual
Thanks
WITH emp_1 AS
(SELECT 1 param, 2 dept_no
FROM DUAL),
dept_1 AS
(SELECT 1 param, 2 dept_no
FROM DUAL)
SELECT (CASE
WHEN a.param = 0
THEN (SELECT b.param
FROM emp_1 b
WHERE a.dept_no = b.dept_no)
ELSE 1
END)
FROM dept_1 a
try something like this
Similar Messages
-
Need urgent help with the query - Beginer
Hello - I need help with a query to populate data in a table.Here is the scenario.
Source1
MnthID BranchCod CustID SegCode FXStatus ProfStatus Profit
200712 B1 C1 20 Y Y 100
Source2
MnthID BranchCod CustID ProdCode ProdIndex
200712 B1 C1 12 1
200712 B1 C2 12 0
Destination
MnthID BranchCod SegCode ProdCode CountSegCust CountProdCust ProfitProdCust
Condition and Calculations:
1)Source1 customer are base customers.If Source2 has customers who is not in source1 then that customer's record should not be fetched.
2)SegCode, FX Status, ProfStatus is one variable in destination table. [ SegCode = SegCode+ FXStatus (if FXStatus = Y)+ ProfStatus (if FXStatus = Y) ]
3)CountSegCust = CountCustID Groupby MnthID,BranchCod,SegCode Only.
4)CountProdCust = CountCustID Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
5)ProfitProdCust = Sum of Profit of Customers Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
Apologies for bad formatting.
Thanks in advance!!A total guess indeed.
It's not clear whether some aggregation can be done (summing counts of grouped data might cause some customers being counted more than once)
insert into destination
select mnthid,branchcod,segcode,prodcode,countsegcust,countprodcust,profitprodcust
from (select s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end segcode,
s2.prodcode,
count(s1.custid) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
order by null
) countsegcust,
count(case proindex when 1
then custid
end
) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) countprodcust,
sum(case proindex when 1
then profit
end
) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) profitprodcust,
row_number() over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) the_row
from source1 s1,source2 s2
where s1.mnthid = s2.mnthid
and s1.branchcod = s2.branchcod
and s1.custid = s2.custid
where the_row = 1Regards
Etbin -
PROCEDURE Mktg_Obj_Cmpgn(p_attr_tbl_nm IN attr.attr_tbl_nm%TYPE,p_actn_cd IN chg_log.actn_cd%TYPE) IS
v_tbl_nm varchar2(100);
v_actn_cd varchar2(4);
BEGIN
v_tbl_nm := p_attr_tbl_nm;
v_actn_cd := p_actn_cd;
--dbms_output.put_line(v_tbl_nm);
IF v_actn_cd = 'CRET' THEN
SELECT to_clob(XMLELEMENT("requestmessage",XMLATTRIBUTES(xmlforest(
seq_pblsh_rqst.nextval AS "publish_id")),
XMLAGG(XMLELEMENT("campaign",XMLATTRIBUTES(XMLFOREST(chg.actn_cd AS "ACTION",
pgm.program_idseq AS "parententityvalue",
ent_sbsrb.ENT_ID AS "entid",
pgm.campaign_idseq AS "campaignid",
bus_unt.portfolio_subtype_id AS "campaignsegment",
pgm_typ.pgm_type_nm AS "campaigntype",
LKP.lookup_key_desc AS "campaignclass",
pgm.editor_userid AS "campaignlastmodifiedby",
pgm.edited_dtm AS "campaignlastmodifieddate",
pgm.mkt_initv_proc_tx AS "campaignlink",
ofr.offer_idseq AS "offerlink")))),
XMLAGG(XMLELEMENT("PROCESSCODE", XMLATTRIBUTES(XMLFOREST(action as "link",PROGRAM.program_idseq AS "parententityvalue",
ENT_SBSRB_ATTR.ent_id AS "entid"))))))AS "v_clob" into v_clob1
FROM dual,
chg_log chg,
program pgm,
ent_sbsrb_attr ent_sbsrb,
business_unit bus_unt,
program_type pgm_typ,
offer ofr,
(SELECT lookup_keyword,lookup_key_desc,lookup_type
FROM lookup_key
WHERE lookup_type = 'PRTFL_CMPGN_ID')LKP
WHERE chg.attr_id = ent_sbsrb.attr_id
and chg.parnt_ent_val_tx = to_char(pgm.program_idseq)
and pgm.business_unit_idseq = bus_unt.business_unit_idseq
and pgm.pgm_type_cd = pgm_typ.pgm_type_cd
and ofr.program_idseq = pgm.program_idseq
and pgm.pgm_cls_cd(+) = LKP.lookup_keyword;
END IF;
end Mktg_Obj_Cmpgn;
I have this procedure within a package. v_clob1 is declared in packagebody as a CLOB variable. when i try to compile it i am getting the below given error.can anyone please help me?
(1): PL/SQL: ORA-19208: parameter 1 of function XMLELEMENT must be aliased
(2): PL/SQL: SQL Statement ignoredhi sir,
wanna ask u guyz one query
let say i have table name account(parent) and service(child)
account
id name status
1 john 0
2 ki 1
3 kdf 2
service
id trans_id name status
1 1 et 9999
1 2 eee 2222
2 3 ere 999
2 4 wew 0
i plan to use something like this
delete account from account t1,service t2 where t1id=t2.id and t1.status<>0;
but sql command not correct so plz help me
now i need a query to delete records from service table only but
account.status <> 0 and accound.id=service.id
i dunt want to delete record from account table
so can u help me with this query
thanks
Message was edited by:
mani_um -
We have these two tables and trying to see if the amount in one table is equal to the sum of the amount fields in another table.
Can someone please help?
SQL> desc test;
Name Null? Type
KEY NUMBER(9)
AMOUNT NUMBER(11,2)
SQL> desc test1;
Name Null? Type
KEY NUMBER(9)
TOTAL_AMOUNT NUMBER(11,2)
SQL> select * from test;
KEY AMOUNT
1 10
1 20
1 70
3 rows selected.
SQL> select * from test1;
KEY TOTAL_AMOUNT
1 100
1 row selected.
SQL> select count(*) from test1 a where exists(select 'x' from test b where
2 a.key=b.key and a.total_amount!=sum(b.amount));
a.key=b.key and a.total_amount!=sum(b.amount))
ERROR at line 2:
ORA-00934: group function is not allowed hereHi,
This would be so easy if there was a table like test that only had one row per key!
You can make such a table, or you can just make a sub-query that has all the same data, and use that sub-query as if it were a table.
For example:
WITH one_row_per_key_test AS
SELECT key
, SUM (amount) AS total_amount
FROM test
GROUP BY key
SELECT COUNT (*)
FROM test1 a
WHERE EXISTS
SELECT 'x'
FROM one_row_per_key_test b
WHERE a.key = b.key
AND a.total_amount = b.total_amount
);There are lots of other ways to solve this particular problem (including HAVING), but this is a very important technique to know. -
Need help with the query to write Cipher?
Hi,
I was assigned a task to write a query to encrypt and decrypt some Cipher. I have figured out to write the procedure to encrypt and decrypt ceasar cipher. I would really appericate if you guys could help me out with this.
.Caesar Cipher
2.Monoalphabetic Cipher
3.Playfair Cipher
4.Vigenère Cipher
5.Transposition Ciphers
6.Rail Fence cipher
7.Row Transposition CipherHi ,
I sorry about just giving the names to when i resarched i saw Rail Fnce Cipher and Ceasar Cipher are the most easier ones.
This is how rail fence cipher works .
Codes and Ciphers :: Rail Fence
In the rail fence cipher, the plaintext is written downwards on successive "rails" of an imaginary fence, starting a new column when the bottom is reached. The message is then read off in rows. For
example, if we have 3 rails and a message of "This is a secret message", you would write out:
T S A C T S G
H I S R M S E
I S E E E A J
The last J is just a random letter to fill in the space. The secret message is then condensed and regrouped.
TSACT SGHIS RMSEI SEEEA JGURL
To decipher a message you must know the number of rails that were used to encipher it. You then break up the letters into equal groups for each rail. For example, if you are using 3 rails, you
would break the secret message into 3 equal groups. Now you stack the groups on top of each other and read off the message vertically. If you get gibberish, then there are probably some extra letters tacked on the end of the message that are throwing off the
grouping. Try removing one letter from the end and try again.
So if the number of rails =3
Plaintext :- "This is a sccerect message"
Cipher Text:-"TSACTSGHISRMEISEEEAJ"
Can we figure out to write a procedure or function for this.
Rail Fence Encoder / Decoder
Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
type="text" value="3" />
Plaintext
<textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
Ciphertext
<textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
<input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
type="submit" value="Decipher" />
Rail Fence Encoder / Decoder
Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
type="text" value="3" />
Plaintext
<textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
Ciphertext
<textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
<input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
type="submit" value="Decipher" /> -
Please help with the query creating Materialized View
Hi,
We are using the below query to create a Materialized View but it has been running since 3 hours. It is an Oracle 9i database running in HP-UX.The quey is as follows,
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
AND B.COMPL_GRP_TXT'Reoperations'
AND D.COMPL_TYPE_TXT'Intra-operative Misadventure'
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
union
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
--AND B.COMPL_GRP_TXT'Reoperations'
AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
AND B.PROC_DAY=C.PROC_DAY
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
union
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
AND B.COMPL_GRP_TXT='Reoperations'
--AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
AND B.PROC_DAY>C.PROC_DAY
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
The explain plan is as follows,
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 46935 | 6716K| | 10648 | | | |
| 1 | SORT UNIQUE | | 46935 | 6716K| 14M| 10648 | 45,14 | P->S | QC (RAND) |
| 2 | UNION-ALL | | | | | | 45,13 | P->P | HASH |
|* 3 | HASH JOIN | | 42801 | 6102K| | 4640 | 45,13 | PCWP | |
|* 4 | TABLE ACCESS FULL | EES_CLINCL_COMPL_ICD | 875 | 18375 | | 2 | 45,02
|* 5 | HASH JOIN | | 41552 | 5072K| 14M| 4638 | 45,13 | PCWP | |
|* 6 | TABLE ACCESS FULL | EES_CLINICAL_DATA | 1430K| 40M| | 2855 | 45,03
|* 7 | HASH JOIN | | 628K| 56M| | 494 | 45,10 | P->P | HASH |
|* 8 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,08
|* 9 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 2090K| 71M| | 49
| 10 | BITMAP CONVERSION TO ROWIDS | | | | | | |
|* 11 | BITMAP INDEX FULL SCAN | INX_COMPL_GRP | | | | | |
|* 12 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_DATA | 1 | 33 | | 1
| 13 | NESTED LOOPS | | 1327 | 196K| | 947 | 45,13 | PCWP | |
|* 14 | HASH JOIN | | 60205 | 6996K| | 495 | 45,13 | PCWP | |
| 15 | TABLE ACCESS BY INDEX ROWID | EES_CLINCL_COMPL_ICD | 36 | 756 | |
|* 16 | INDEX RANGE SCAN | COMPL_TYPE_TXT_3 | 1 | | | 1 |
|* 17 | HASH JOIN | | 1420K| 132M| | 494 | 45,13 | PCWP | |
|* 18 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,11
|* 19 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 4722K| 175M| | 49
| 20 | BITMAP CONVERSION TO ROWIDS| | | | | | | |
| 21 | BITMAP INDEX FULL SCAN | INX_COMPL_GRP | | | | | |
|* 22 | INDEX RANGE SCAN | EES_CLINICAL_DATA_IND1 | 1 | | | 2 | 45,13
|* 23 | HASH JOIN | | 2807 | 416K| | 4695 | 45,13 | PCWP | |
| 24 | TABLE ACCESS FULL | EES_CLINCL_COMPL_ICD | 911 | 19131 | | 2 | 45,06
|* 25 | HASH JOIN | | 2617 | 334K| 15M| 4693 | 45,13 | PCWP | |
|* 26 | TABLE ACCESS FULL | EES_CLINICAL_DATA | 1430K| 45M| | 2855 | 45,07
|* 27 | HASH JOIN | | 791K| 74M| | 305 | 45,12 | P->P | HASH |
|* 28 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,09
|* 29 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 2632K| 97M| | 30
| 30 | BITMAP CONVERSION TO ROWIDS | | | | | | |
|* 31 | BITMAP INDEX SINGLE VALUE | INX_COMPL_GRP | | | | | |
Predicate Information (identified by operation id):
3 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
4 - filter("D"."COMPL_TYPE_TXT"'Intra-operative Misadventure')
5 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
6 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
7 - access("A"."ICD_CODE"="B"."ICD_CODE")
8 - filter("A"."SPECIALTY"='Colo-Rectal')
9 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
11 - filter("B"."COMPL_GRP_TXT"'Reoperations')
12 - filter("B"."ICD_CODE"="C"."ICD_CODE" AND "C"."PROC_TYPE"'L' AND "B"."PROC_DAY"="C"."PROC_DA
14 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
16 - access("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
17 - access("A"."ICD_CODE"="B"."ICD_CODE")
18 - filter("A"."SPECIALTY"='Colo-Rectal')
19 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
22 - access("B"."PAT_KEY"="C"."PAT_KEY")
23 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
25 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
filter("B"."PROC_DAY">"C"."PROC_DAY")
26 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
27 - access("A"."ICD_CODE"="B"."ICD_CODE")
28 - filter("A"."SPECIALTY"='Colo-Rectal')
29 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
31 - access("B"."COMPL_GRP_TXT"='Reoperations')
Note: cpu costing is offPlease help.Try removing the hints.
Is 47,000 a reasonable estimate of how many rows you expect in the results?
See these posts for other information that you should supply.
HOW TO: Post a SQL statement tuning request
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long
When your query takes too long ... -
Please help with the query (INSERT RETURNING BULK COLLECT INTO)
I am trying to write a query inside the C# code where I would insert values into a table in bulk using bind variables. But I also I would like to receive a bulk collection of generated sequence number IDs for the REQUEST_ID. I am trying to use RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs clause where :REQUEST_IDs is another bind variable
Here is a full query that use in the C# code
INSERT INTO REQUESTS_TBL(REQUEST_ID, CID, PROVIDER_ID, PROVIDER_NAME, REQUEST_TYPE_ID, REQUEST_METHOD_ID, SERVICE_START_DT, SERVICE_END_DT, SERVICE_LOCATION_CITY, SERVICE_LOCATION_STATE, BENEFICIARY_FIRST_NAME,
BENEFICIARY_LAST_NAME, BENEFICIARY_DOB, HICNUM, CCN, CLAIM_RECEIPT_DT, ADMISSION_DT, BILL_TYPE,
LANGUAGE_ID, CONTRACTOR_ID, PRIORITY_ID, UNIVERSE_DT, REQUEST_DT, BENEFICIARY_M_INITIAL,
ATTENDING_PROVIDER_NUMBER, BILLING_NPI, BENE_ZIP_CODE, DRG, FINAL_ALLOWED_AMT, STUDY_ID, REFERRING_NPI)
VALUES
(SQ_CDCDATA.NEXTVAL, :CIDs, :PROVIDER_IDs, :PROVIDER_NAMEs, :REQUEST_TYPE_IDs,
:REQUEST_METHOD_IDs, :SERVICE_START_DTs, :SERVICE_END_DTs, :SERVICE_LOCATION_CITYs,
:SERVICE_LOCATION_STATEs, :BENEFICIARY_FIRST_NAMEs, :BENEFICIARY_LAST_NAMEs, :BENEFICIARY_DOBs,
:HICNUMs, :CCNs, :CLAIM_RECEIPT_DTs, :ADMISSION_DTs, :BILL_TYPEs, :LANGUAGE_IDs,
:CONTRACTOR_IDs, :PRIORITY_IDs, :UNIVERSE_DTs, :REQUEST_DTs, :BENEFICIARY_M_INITIALs,
:ATTENDING_PROVIDER_NUMBERs, :BILLING_NPIs, :BENE_ZIP_CODEs, :DRGs, :FINAL_ALLOWED_AMTs,
:STUDY_IDs, :REFERRING_NPIs) RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs
However, when I run this query, it gives me a strange error ORA-00925: missing INTO keyword. I am not sure what that error means since I am not missing any INTOs
Please help me resolve this error or I would appreciate a different solution
Thank youYou cannot use (and do not want to in this case) the BULK COLLECT.
create table for_testing
the_id number not null primary key,
some_data number
declare
l_return_value for_testing.the_id%type;
begin
4
insert into for_testing
the_id,
some_data
values
1,
5
returning the_id into l_return_value;
dbms_output.put_line('the return values is ' || l_return_value);
end;
20 /
the return values is 1
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.02
TUBBY_TUBBZ?Is a simple example. In the future, please use the tags to preserve formatting on your code like i have so it remains readable . -
I need help with the query
Here is what I need
For a particular comm record if there is no Salary record where comm:Date = Salary:Date, then
• Find maximum dated Salary record as of comm:Date.
• Clone this record and set Salary:Date = comm:Date
• Set Salary:rate = comm:rate
Like wise for a particular Salary record If there is no comm record where Salary:Date = comm:Date then
• Find maximum effective dated comm record as of Salary:Date
• Apply Rate 2 amount from this maximum effective dated record to Salary record i.e. Set Salary:rate = comm:rate
Example
Salary Table :
ID Sal_Date Rate Hours
1 07/01/2011 400.00 40
2 02/15/2011 200.00 40
3 01/01/2011 160.00 40
Sal_comm Table:
Sal_Date comm_Rate
1 07/01/2011 10.00
4 03/01/2011 7.50
3 01/01/2011 4.00
I need to merge comm_Rate column in Salary table, since there is no salary record as off 03/01/2011, I need to find the maximum dated salary record as of 03/01/2011
i.e. the record dated 02/15/2011. Now I need to clone that salary record, set the SAL_date as 03/01/2011 and update Rate2 amount. So the record set will be like:
Sal_Date:
id sal_Date Rate Hours comm_Rate
1 07/01/2011 400.00 40 10.00
4 03/01/2011 200.00 40 7.50
2 02/15/2011 200.00 40 4.00
3 01/01/2011 160.00 40 4.00So you need all used dates as the "driving" dataset. And you need the according data for each of these.
WITH salary_table as
(select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,400 rate,40 hours from dual union all
select 2 id,to_date('02/15/2011','MM/DD/YYYY')sal_date,200 rate,40 hours from dual union all
select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,160 rate,40 hours from dual),
sal_comm as
(select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,10 comm_Rate from dual union all
select 4 id,to_date('03/01/2011','MM/DD/YYYY')sal_date,7.5 comm_Rate from dual union all
select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,4 comm_Rate from dual)
select to_char(all_dates.sal_date,'MM/DD/YYYY') sal_date,sal.rate,sal.hours,com.comm_rate
from (select sal_date from salary_table
union
select sal_date from sal_comm) all_dates
inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
from salary_table s1) sal
on (all_dates.sal_date between sal.sal_date and sal.next_sal_date)
inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
from sal_comm s1) com
on (all_dates.sal_date between com.sal_date and com.next_sal_date)
order by all_dates.sal_date desc;
SAL_DATE RATE HOURS COMM_RATE
07/01/2011 400 40 10
03/01/2011 200 40 7.5
02/15/2011 200 40 4
01/01/2011 160 40 4
-
Need some help with the Select query.
Need some help with the Select query.
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
select single vkorg abgru from ZADS into it_rej.
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
This is causing performance issue. They are asking me to include the where condition for this select query.
What should be my select query here?
Please suggest....
Any suggestion will be apprecaiated!
Regards,
DeveloperHello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount
THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??
-
Content Tab: None of the fact tables are compatible with the query request
Hi All,
**One thing I am not clear yet of all my years with OBIEE is working with the content tab in BMM.**
I have made a rpd the joins in physical layer as shown below:
https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056545119428530
And the BMM layer as:
https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056519553812930
Error I am getting when i run a request from the 3 columns from the selected 3 tables is:
Dim - Comment Code Details
Fact - Complaint
Dim - Service Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14020] None of the fact tables are compatible with the query request Sr Num:[DAggr(Fact - Complaint.Sr Num by [ Dim - Service Details.Sr Cat Type Cd, Dim - Comment Code Details.Cmtcode name] )]. (HY000).
I get no error for consistency.. I read everywhere and I know i need to set the appropriate aggregation levels in the various dims and facts LTS properties to help OBIEE understanding our model, but how to do that.. how do i decide... how should I approach, what should be the aggregation level, what details.
When i click More button i see different options: Copy, Copy From, Get Levels, Check Level, what do these mean.
Aggregation Content, group by - Logical Level or Column which one should i choose and how should I decide.
Can anyone explain the Content Tab in details and from scratch with some example and why we get these errors.... I know many people who are well versed with many other things related to RPD but this. A little efforts of explaining from you guys will really be appreciated.
Thanks in advance,
DevHi Deepak,
Option 1:
My tables in physical layer are joined as below:
D1--> F1 <--D2--> F2 <--D3
Same way i model it in BMM
D1--> F1 <-- D2--> F2 <--D3
Here D1 is non Conformed Dimension for F2 and D3 is non Conformed dim for F1. Later create Dimensional hierarchies, I tried setting up the content levels
I go Sources>content tab of Fact F1 I set
Dimensions----------- Logical level
D1---------------------- D1 Detail
D2---------------------- D2 Detail
D3---------------------- D3 Total
then, I go Sources>content tab of Fact F2 I set
Dimensions----------- Logical level
D1---------------------- D1 Total
D2---------------------- D2 Detail
D3---------------------- D3 Detail
Then, I also go in all the dimensions and set their content levels to Details, but it still gives me errors not sure where I am going wrong in setting the content levels.
I need to know whether the way I have modeled it in BMM is right,
Option 2:
I can combine the two facts in a single Logical Fact or the above design should also work.
(F1&F2)<--D1, D2 , D3 joined separately using complex logical joins.
what will be the content tab details?
Thanks,
Dev -
Hi all,
From Page 354 of the the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles (published by apress), I copied the following code (Listing 12-9 Retrieving Job Candidates with the query Method):
--Coles12_9.sql // saved in C:/Documemnts/SQL Server Management Studio
-- Coles Listing 12-9 Retrieving Job Candidates with the query Method
-- Doing XQuery and the xml Data Type in AdvantureWorks
-- 17 March 2015 1105 AM
USE AdventureWorks;
GO
SELECT Resume.query
N'//*:Name.First,
//*:Name.Middle,
//*:Name.Last,
//*:Edu.Level
FROM HumanResources.JobCandidate;
I executed this set of Listing 12-9 code in my SQL Server 2012 Management Studio and I got the following error messages:
Msg 105, Level 15, State 1, Line 4
Unclosed quotation mark after the character string '//*:Name.First,
//*:Name.Middle,
//*:Name.Last,
//*:Edu.Level
FROM HumanResources.JobCandidate;
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '//*:Name.First,
//*:Name.Middle,
//*:Name.Last,
//*:Edu.Level
FROM HumanResources.JobCandidate;
I am not able to figure out why I got the error messages. Please kindly help and advise me how to correct this set of sql codes.
Thanks in advance,
Scott ChangHi Scott,
I don't have that book at hand, but your problem is the "Unclosed quotationmark after the character string",as the error message shows. You have to enclose the 'XQUERY' string quotation in the
query().
SELECT jobcandidateid, Resume.query
N'//*:resume,
//*:Name.Middle,
//*:Name.Last,
//*:Edu.Level' --enclose the quotation here
FROM HumanResources.JobCandidate;
For XQUERY learning, here is a good
link.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
select * from testme;
NAME VAL
A 1
A 2
A 3
B 1
B 2
B 3
C 1
C 2
I want to get the maximum of name and the maximum of corresponding name's value.
ie., the answer should be
Name VAL
C 2
Please help me with the query.
ThnxSQL> create table testme
2 as
3 select 'A' name, 1 val from dual union all
4 select 'A', 2 from dual union all
5 select 'A', 3 from dual union all
6 select 'B', 1 from dual union all
7 select 'B', 2 from dual union all
8 select 'B', 3 from dual union all
9 select 'C', 1 from dual union all
10 select 'C', 2 from dual
11 /
Tabel is aangemaakt.
SQL> select max(name) name
2 , max(val) keep (dense_rank last order by name) val
3 from testme
4 /
NAME VAL
C 2Regards,
Rob. -
Hi,
I need help with the following query. I want the balance (bal) with the latest exchange rate available.
Sample table & data
with
FX_RATE as
select 11 as id_date, 1 as id_curr, 47 as EXCH_rate from dual union
select 12, 1, 48 from dual union
select 13, 2, 54 from dual union
select 14, 2, 55 from dual union
select 15, 3, 56 from dual union
select 15, 2, 49 from dual),
TBL_NM as
select 13 as p_date, 2 as p_curr, 200 as bal from dual union
select 14, 2, 200 from dual union
select 15, 2, 200 from dual union
select 16, 2, 200 from dual union
select 17, 2, 200 from dual union
select 11, 5, 100 from dual
select p_date, p_curr, bal * nvl(exch_rate,1) from TBL_NM T LEFT OUTER JOIN FX_RATE F1 on (id_curr = p_curr and F1.id_date = T.p_Date)In the above query for p_date 16 & 17 and p_curr 2 it returns just balance multiplied by exchange rate 1"default". But i want the balance to have data as per latest exchange rate which is of exchange rate 15.
I tried this but returns error ORA-01799: a column may not be outer joined to a subquery ..
with
FX_RATE as
select 11 as id_date, 1 as id_curr, 47 as EXCH_rate from dual union
select 12, 1, 48 from dual union
select 13, 2, 54 from dual union
select 14, 2, 55 from dual union
select 15, 3, 56 from dual union
select 15, 2, 49 from dual),
TBL_NM as
select 13 as p_date, 2 as p_curr, 200 as bal from dual union
select 14, 2, 200 from dual union
select 15, 2, 200 from dual union
select 16, 2, 200 from dual union
select 17, 2, 200 from dual union
select 11, 5, 100 from dual
select p_date, p_curr, bal * nvl(exch_rate,1) from TBL_NM T LEFT OUTER JOIN FX_RATE F1
on (id_curr = p_curr and F1.id_date = (select max(F2.id_date) from FX_RATE F2 where F2.id_curr = T.p_curr and F2.id_Date <= T.p_date))Please advice on how i can achieve this ..The entire query wud be like this .. I've to incorporate in here
CREATE MATERIALIZED VIEW MV_DUMMY
BUILD IMMEDIATE
REFRESH FORCE ON DEMAND
AS
SELECT T.ID_TSACTION_RELEASED
BAL.ID_CONTRACT_BALANCE AS ID_CONTRACT_BALANCE,
T.N_REFERENCE_NUMBER
T.INSTRUMENT_N_REFERENCE
T.ITEM_NUMBER
T.EXTERNAL_SYSTEM_ID
T.SEQUENCE_NUMBER
T.ID_RELEASED_DATE
ROUND(BAL.LC_AVAILABLE_BALANCE * NVL(FX1.EXCHANGE_RATE,1) / NVL(FX2.EXCHANGE_RATE,1) , 4)
BAL.LIABILITY_BALANCE
BAL.LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)
BAL.LIABILITY_CHANGE_USD
BAL.MEMO_LIABILITY_BALANCE
BAL.MEMO_LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)
BAL.MEMO_LIABILITY_CHANGE_USD
BAL.ORIGINAL_FACE_AMOUNT
decode(T.TENOR_CODE,'Time','T','Sight','S','Split Sight Time','SST','Split Multiple Time','SMT',T.TENOR_CODE)
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN T.ID_LIABILITY_CIF
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN T.Id_Beneficiary
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN T.ID_Applicant
END PRIMARY_CUSTOMER_ID,
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN plbcif.EXTERNAL_SYSTEM_ID
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN PBCIF.EXTERNAL_SYSTEM_ID
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN pappcif.EXTERNAL_SYSTEM_ID
END PRIMARY_CUSTOMER_EXT_SYS_ID,
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN plbcif.CIF_NAME
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN PBCIF.CIF_NAME
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN pappcif.CIF_NAME
END PRIMARY_CUSTOMER_NAME,
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN plbbac.BAC
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN pbbac.BAC
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN pappbac.BAC
END PRIMARY_CUST_BAC_CODE,
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN nvl(plbmg.MARKET,'NOT APPLICABLE')
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN nvl(pbmg.MARKET,'NOT APPLICABLE')
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN nvl(pappmg.MARKET,'NOT APPLICABLE')
END PRIMARY_CUST_MARKET,
CASE
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
THEN nvl(plbmg.SUB_MARKET,'NOT APPLICABLE')
WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
THEN nvl(pbmg.SUB_MARKET,'NOT APPLICABLE')
WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
THEN nvl(pappmg.SUB_MARKET,'NOT APPLICABLE')
END PRIMARY_CUST_SUB_MARKET
FROM F_TSACTION_RELEASED T
LEFT OUTER JOIN D_BAC_CODE BAC
ON (T.BAC_CODE_LIABILITY = BAC.BAC_CODE)
LEFT OUTER JOIN REF_BAC_SORT_CODE REF_BAC
ON (T.BAC_CODE_LIABILITY = REF_BAC.BAC)
LEFT OUTER JOIN F_CONTRACT_BALANCE BAL
ON (T.ID_TSACTION_RELEASED = BAL.ID_TSACTION_RELEASED)
LEFT OUTER JOIN D_MARKET_SEGMENT MG
ON (T.ID_MARKET_SEGMENT = MG.ID_MARKET_SEGMENT)
LEFT OUTER JOIN D_DATE DT
ON (DT.ID_DATE = T.ID_RELEASED_DATE)
LEFT OUTER JOIN D_DATE DB
ON (DB.ID_DATE = BAL.ID_RELEASED_DATE)
LEFT OUTER JOIN D_PROCESSING_UNIT PU
ON (PU.ID_PROCESSING_UNIT = T.ID_PROCESSING_UNIT)
LEFT OUTER JOIN D_BIR_PRODUCT BIRPROD
ON (BIRPROD.ID_BIR_PRODUCT=T.ID_BIR_PRODUCT)
LEFT OUTER JOIN D_GTS_PRODUCT_TYPE GTSPROD
ON (GTSPROD.ID_GTS_PRODUCT_TYPE= T.ID_GTS_PRODUCT_TYPE)
LEFT OUTER JOIN D_GTS_TSACTION_TYPE GTST
ON (GTST.ID_GTS_TSACTION_TYPE = T.ID_GTS_TSACTION_TYPE)
LEFT OUTER JOIN D_CURRENCY CCYT
ON (CCYT.ID_CURRENCY = T.ID_TSACTION_CURRENCY)
LEFT OUTER JOIN d_cif lcif
ON (lcif.id_cif = T.id_liability_cif)
LEFT OUTER JOIN d_cif lbcif
ON (lbcif.id_cif = bal.id_liability_cif)
LEFT OUTER JOIN d_cif bcif
ON (bcif.id_cif = T.id_BENEFICIARY)
LEFT OUTER JOIN d_cif icif
ON (icif.id_cif = T.id_ISSUING_BANK)
LEFT OUTER JOIN d_cif acif
ON (acif.id_cif = T.id_ADVISING_BANK)
LEFT OUTER JOIN d_cif appcif
ON (appcif.id_cif = T.id_applicant)
LEFT OUTER JOIN d_state astate
ON (astate.id_state = acif.id_state)
LEFT OUTER JOIN d_state bstate
ON (bstate.id_state = bcif.id_state)
LEFT OUTER JOIN d_state lstate
ON (lstate.id_state = lcif.id_state)
LEFT OUTER JOIN d_state lbstate
ON (lbstate.id_state = lbcif.id_state)
LEFT OUTER JOIN d_state istate
ON (istate.id_state = icif.id_state)
LEFT OUTER JOIN d_state appstate
ON (appstate.id_state = appcif.id_state)
LEFT OUTER JOIN D_TSACTION_SOURCE TSrc
ON (T.ID_TSACTION_SOURCE = TSrc.ID_TSACTION_SOURCE)
LEFT OUTER JOIN D_COUNTRY LCTRY
ON (LCTRY.ID_COUNTRY = lcif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY LBCTRY
ON (LBCTRY.ID_COUNTRY = lbcif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY BCTRY
ON (BCTRY.ID_COUNTRY = bcif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY ICTRY
ON (ICTRY.ID_COUNTRY = icif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY ACTRY
ON (ACTRY.ID_COUNTRY = acif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY APPCTRY
ON (APPCTRY.ID_COUNTRY = appcif.ID_COUNTRY)
LEFT OUTER JOIN D_COUNTRY PCTRY
ON (PCTRY.ID_COUNTRY = T.ID_PRESENTER_COUNTRY)
LEFT OUTER JOIN D_LOCATION LOC
ON (LOC.ID_LOCATION = T.ID_PROCESSING_LOCATION)
LEFT OUTER JOIN D_CURRENCY BCCYT
ON (BCCYT.ID_CURRENCY = BAL.ID_LIABILITY_CURRENCY)
LEFT OUTER JOIN D_CURRENCY BALCYT
ON (BALCYT.ID_CURRENCY = BAL.ID_BALANCE_CURRENCY)
LEFT OUTER JOIN d_liability_type li
ON (li.id_liability_type = BAL.id_liability_type)
LEFT OUTER JOIN d_cif plbcif
ON (plbcif.id_cif = T.id_liability_cif)
LEFT OUTER JOIN REF_BAC_SORT_CODE plbbac
ON (plbcif.bac_code=plbbac.bac)
LEFT OUTER JOIN D_MARKET_SEGMENT plbmg
ON (plbbac.SORT_CODE=plbmg.MARKET_SEGMENT)
LEFT OUTER JOIN d_cif pbcif
ON (pbcif.id_cif = T.id_BENEFICIARY)
LEFT OUTER JOIN REF_BAC_SORT_CODE pbbac
ON (pbcif.bac_code=pbbac.bac)
LEFT OUTER JOIN D_MARKET_SEGMENT pbmg
ON (pbbac.SORT_CODE=pbmg.MARKET_SEGMENT)
LEFT OUTER JOIN d_cif pappcif
ON (pappcif.id_cif = T.id_applicant)
LEFT OUTER JOIN REF_BAC_SORT_CODE pappbac
ON (pappcif.bac_code=pappbac.bac)
LEFT OUTER JOIN D_MARKET_SEGMENT pappmg
ON (pappbac.SORT_CODE=pappmg.MARKET_SEGMENT)
LEFT OUTER JOIN D_CURRENCY LOCALCYT
ON (LOCALCYT.alpha_code = PU.local_ccy)
LEFT OUTER JOIN D_BRANCH Branch
ON (T.ID_BRANCH = Branch.ID_BRANCH )
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX1
ON (BAL.ID_BALANCE_CURRENCY = FX1.ID_CURRENCY and FX1.ID_DATE = (select max(FX11.ID_DATE) from F_USD_FX_RATE_HISTORY FX11 where BAL.ID_BALANCE_CURRENCY = FX11.ID_CURRENCY and FX11.ID_DATE <= BAL.id_released_date))
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX2
ON (LOCALCYT.ID_CURRENCY = FX2.ID_CURRENCY and FX2.ID_DATE = (select max(FX22.ID_DATE) from F_USD_FX_RATE_HISTORY FX22 where LOCALCYT.ID_CURRENCY = FX22.ID_CURRENCY and FX22.ID_DATE <= BAL.id_released_date))
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX3
ON (BAL.ID_LIABILITY_CURRENCY = FX3.ID_CURRENCY and FX3.ID_DATE = (select max(FX33.ID_DATE) from F_USD_FX_RATE_HISTORY FX33 where BAL.ID_LIABILITY_CURRENCY = FX33.ID_CURRENCY and FX33.ID_DATE <= BAL.id_released_date))Note the lines
ROUND(BAL.MN_AVAILABLE_BALANCE * NVL(FX1.EXCHANGE_RATE,1) / NVL(FX2.EXCHANGE_RATE,1) , 4)
BAL.LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)
BAL.MEMO_LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)
And
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX1
ON (BAL.ID_BALANCE_CURRENCY = FX1.ID_CURRENCY and FX1.ID_DATE = (select max(FX11.ID_DATE) from F_USD_FX_RATE_HISTORY FX11 where BAL.ID_BALANCE_CURRENCY = FX11.ID_CURRENCY and FX11.ID_DATE <= BAL.id_released_date))
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX2
ON (LOCAMNYT.ID_CURRENCY = FX2.ID_CURRENCY and FX2.ID_DATE = (select max(FX22.ID_DATE) from F_USD_FX_RATE_HISTORY FX22 where LOCAMNYT.ID_CURRENCY = FX22.ID_CURRENCY and FX22.ID_DATE <= BAL.id_released_date))
LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX3
ON (BAL.ID_LIABILITY_CURRENCY = FX3.ID_CURRENCY and FX3.ID_DATE = (select max(FX33.ID_DATE) from F_USD_FX_RATE_HISTORY FX33 where BAL.ID_LIABILITY_CURRENCY = FX33.ID_CURRENCY and FX33.ID_DATE <= BAL.id_released_date))Thsi is where I need to incorporate the change -
Need help with the session state value items.
I need help with the session state value items.
Trigger is created (on After delete, insert action) on table A.
When insert in table B at least one row, then trigger update value to 'Y'
in table A.
When delete all rows from a table B,, then trigger update value to 'N'
in table A.
In detail report changes are visible, but the trigger replacement value is not set in session value.
How can I implement this?You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
For example
SELECT YN_COLUMN
FROM My_TABLE
INTO My_Page_Item
WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
If the value is showing in a report, make sure the report refreshes on reload of the page.
Edited by: Bob37 on Dec 6, 2011 10:36 AM
Maybe you are looking for
-
Asset retirement error while posting
When am retireing asset through Tcode F-92, this error mesg is popping "Transaction type 210 not possible ( Posting to affiliated Company ) "
-
Itunes will no longer accept any of my credit cards. It says vcode doesn't match when it does. Customer service is no help. I have re-inputted the info in the account section of the apple store and in itunes--still says vcode doesn't match.
-
Web Server 6.0sp9 - Reliable shutdown and restart
We have set the internal cron to rotate the logs nightly at 11:30pm. When tries to restart, there is a stray process left behind and we get this in the errors log. This happens 85% of the time: [11/Oct/2005:23:30:21] info ( 7689): successful server s
-
How do I get my music in FCE?
I'm sure this is really simple, and I've probably just missed a step but I have converted my songs to AIFF and I tried importing, I tried dragging and dropping... How do I get them in FCE?
-
Will Lion run on macbook pro 1.1 2006 running snow leopard
Trying to find out if lion will run on 2006 macbook pro 1.1 running snow leopard , trying to sync my i5 to itunes 10.7 as i get an error message when i plug i5 in saying i need version 10.7 . laptop recognises i5 as camera Anu ideas