Execute Procedure In Toad (PLSQL)

DECLARE
 P_SUBE_KOD            VARCHAR2(8);
 P_BOLGE_KOD           VARCHAR2(6);
 P_CURSOR              SYS_REFCURSOR;
BEGIN
  OPEN P_CURSOR FOR
  SELECT
  DISTINCT S.CH_SUBE_AD,B.CH_BOLGE_AD, CH_PLAKA,
  DECODE(NVL( (SELECT 1 FROM RGO.SUBE_VE_ARAC_FOTO_ARSIV FA WHERE ROWNUM=1 AND FA.CH_ARAC_PLAKA = A.CH_PLAKA AND FA.RF_SUBE_KOD = A.RF_SUBE_KOD AND FA.FL_DURUM=1) , 0) , 1, ‘EVET’,’HAYIR’) FOTOGRAF_VARMI
,NVL( (SELECT COUNT(1) FROM RGO.SUBE_VE_ARAC_FOTO_ARSIV FA WHERE FA.CH_ARAC_PLAKA = A.CH_PLAKA AND FA.RF_SUBE_KOD = A.RF_SUBE_KOD AND FA.FL_DURUM=1) , 0) FOTOGRAF_SAYISI,S.RF_AKTARMA_KOD ,S.CD_SUBE_KOD
FROM
   RACTAKIP.ARAC A RGO.SUBE S , RGO.BOLGE B
    WHERE
    A.RF_SUBE_KOD = S.CD_SUBE_KOD
    AND S.RF_BOLGE_KOD = B.CD_BOLGE_KOD
    AND A.FL_DURUM=1
    AND S.FL_DURUM=1
    AND S.RF_BOLGE_KOD = ‘0950’
    AND S.CD_SUBE_KOD =  ‘03401700’
    AND NOT EXISTS (SELECT 1 FROM RACTAKIP.ARAC A2 WHERE  A2.CH_PLAKA =       A.CH_PLAKA AND A2.LG_TARIH > A.LG_TARIH AND A2.FL_DURUM=1)
    ORDER BY B.CH_BOLGE_AD,CH_SUBE_AD;
    :P_CURSOR := P_CURSOR;
      
END PRC_GET_RAC_SUBE_FOTOGRAF;  
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: