Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UNABLE TO RETRIEVE DATA FROM SQL QUERY

India_vigneshFeb 20 2017 — edited Feb 21 2017

HI I WANT TO BUILT A REPORT IN ORACLE DISCOVERER USING BELOW QUERY BUT I'M FACING ERROR PLEASE HELP

pastedImage_1.png

SQL QUERY:

SELECT OST_COMP_CODE,OST_MAIN_ACNT_CODE,OST_SUB_ACNT_CODE,ost_divn_code,ost_dept_code,OST_TRAN_CODE,OST_DOC_NO,OST_DOC_DT,

NVL(NVL(SUM(DECODE(OST_DRCR_FLAG,'D',NVL(OST_LC_ORG_AMT,0) - (F_GET_BASE_LC_AMT(OST_KEY_NO,'P',to_date**('&da','mm/dd/yyyy'))** +

F_GET_BASE_CROSS_LC_AMT(OST_KEY_NO,'C',to_date('&da','mm/dd/yyyy')) + F_GET_BASE_LC_AMT(OST_KEY_NO,'F',to_date**('&da','mm/dd/yyyy')**)))),0) -

NVL(SUM(DECODE(OST_DRCR_FLAG,'C',NVL(OST_LC_ORG_AMT,0) - (F_GET_BASE_LC_AMT(OST_KEY_NO,'P',to_date**('&da','mm/dd/yyyy')**) +

F_GET_BASE_CROSS_LC_AMT(OST_KEY_NO,'C',to_date('&da','mm/dd/yyyy')) + F_GET_BASE_LC_AMT(OST_KEY_NO,'F',to_date('&da','mm/dd/yyyy'))))),0),0) BALANCE,

to_date('&da','mm/dd/yyyy')-trunc(OST_DOC_DT) "DAYS"

FROM FT_OS

WHERE OST_MAIN_aCNT_CODE='A2501'

and trunc(ost_doc_dt)<= to_date('&da','mm/dd/yyyy')

AND NVL(OST_LC_ORG_AMT,0) - (F_GET_BASE_LC_AMT(OST_KEY_NO,'P',to_date('&da','mm/dd/yyyy')) +

F_GET_BASE_CROSS_LC_AMT(OST_KEY_NO,'C',to_date('&da','mm/dd/yyyy')) +F_GET_BASE_CROSS_LC_AMT(OST_KEY_NO,'D',to_date('&da','mm/dd/yyyy'))+ F_GET_BASE_LC_AMT(OST_KEY_NO,'F',to_date('&da','mm/dd/yyyy')))>0

AND EXISTS (SELECT 'X'

FROM FM_CUSTOMER X

WHERE X.CUST_CODE = OST_SUB_ACNT_CODE

UNION

SELECT 'X'

FROM FM_SUPPLIER Y

WHERE Y.SUPP_CODE = OST_SUB_ACNT_CODE)

GROUP BY ost_comp_code,OST_MAIN_aCNT_CODE,OST_SUB_aCNT_CODE,to_date('&da','mm/dd/yyyy')-trunc(OST_DOC_DT) ,ost_divn_code,ost_dept_code,OST_TRAN_CODE,OST_DOC_NO,OST_DOC_DT

REGARDS

VIGNESH

Comments

sb92075
Please realize that we don't have your tables & we don't have your data.
Therefore only YOU can run bechmark tests to see for yourself what produces the better results.
EdStevens
userPrasad wrote:
I am using oracle 10g. I have a table with huge data. There are 4 indexes on this table with combination of columns. All the indexes are created using the script like -
CREATE INDEX INDX1 ON My_TABLE
(ID, emp_NUMBER, emp_sal, emp_div)
TABLESPACE my_IDX
PCTFREE 10
INITRANS 2
MAXTRANS 255
NOLOGGING
NOPARALLEL;

CREATE INDEX INDX2 ON My_TABLE
(ID, emp_NUMBER, emp_name)
TABLESPACE my_IDX
PCTFREE 10
INITRANS 2
MAXTRANS 255
NOLOGGING
NOPARALLEL;

and so on...
Few columns are always there in every index like Id, emp_number.

Most of the select queries are using the id and emp_number in the where clause criteria's. SQL "select" performance is not very good and need to find some kinda solution to this problem .

Shall I create one index using all the columns present in various indexes instead of various indexes with different combination of the columns ?
CREATE INDEX INDX2 ON My_TABLE
(ID, 
 emp_NUMBER, 
 emp_name)
and

CREATE INDEX INDX2 ON My_TABLE
(emp_name, 
 emp_number,
 ID)
Both have the same collection of columns, but they most defianetly do not serve the same purpose. Once you understand that, you will have your answer.
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 21 2017
Added on Feb 20 2017
1 comment
327 views