Quantcast
Channel: SCN : All Content - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 4013

Need help in correlated sub query logic

$
0
0

Hi ,

I have one procedure with cursor. I have given small part of the cursor as shown below .

SELECT

  A.DAY_DATE,

  A.COUNTRY_CODE,

  A.INST_CODE,

  a.bra_code,

  a.cus_num,

  a.cur_code,

  a.led_code,

  a.sub_acct_code,

  (tra_amt * SPOT_RATE) pre_day_crnt_bal,

  t.mat_date,

  t.NEW_INT_RATE int_rate,

  t.DEB_CRE_IND int_chg_pai_ind,

  a.ACCT_TYPE,

  (SELECT COUNT (

  DISTINCT TO_CHAR (day_date, 'mm')

  )

  FROM PIO_TIMES

  WHERE day_date BETWEEN a.day_date

  AND NVL ( T.MAT_DATE,A.DAY_DATE) 

  AND TO_CHAR (day_date, 'dd') = '31') Test




----

-----

)

Here how can I build the logic for inside select statement.

I tried to build the separate stream for the inside select statement but I am confusing how to handle the count in the inside the query.

Please help me how to build the logic for the inside query statement .

Thanks & Regards,

Ramana.


Viewing all articles
Browse latest Browse all 4013

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>