Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1851286
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: Oracle

2009-08-07 09:08:22


SELECT   (SELECT sob.NAME
            FROM gl.gl_sets_of_books sob
           WHERE sob.set_of_books_id = a.set_of_books_id) "SOB_Name",
         a.period_name "Period_Name", a.period_num "Period_Num",
         a.gl_status "GL_Status", b.po_status "PO_Status",
         c.ap_status "AP_Status", d.ar_status "AR_Status",
         e.fa_status "FA_Status"
    FROM (SELECT period_name, period_num,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status
                        ) gl_status,
                 set_of_books_id
            FROM gl.gl_period_statuses
           WHERE application_id = 101
             AND UPPER (period_name) = UPPER ('&period_name')
             AND set_of_books_id ='&sob' ) a,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status
                        ) po_status,set_of_books_id
            FROM gl.gl_period_statuses
           WHERE application_id = 201
             AND UPPER (period_name) = UPPER ('&period_name')
             AND set_of_books_id ='&sob' ) b,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status
                        ) ap_status,set_of_books_id
            FROM gl.gl_period_statuses
           WHERE application_id = 200
             AND UPPER (period_name) = UPPER ('&period_name')
             AND set_of_books_id ='&sob' ) c,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status
                        ) ar_status,set_of_books_id
            FROM gl.gl_period_statuses
           WHERE application_id = 222
             AND UPPER (period_name) = UPPER ('&period_name')
             AND set_of_books_id ='&sob') d,
         (SELECT fdp.period_name,
                 DECODE (fdp.period_close_date,
                         NULL, 'Open',
                         'Closed'
                        ) fa_status,fbc.set_of_books_id
            FROM fa.fa_book_controls fbc, fa.fa_deprn_periods fdp
           WHERE fbc.set_of_books_id ='&sob'
             AND fbc.book_type_code = fdp.book_type_code
             AND UPPER (fdp.period_name) = UPPER ('&period_name')) e
   WHERE a.period_name = b.period_name(+)
     AND a.period_name = c.period_name(+)
     AND a.period_name = d.period_name(+)
     AND a.period_name = e.period_name(+)
     AND a.set_of_books_id=b.set_of_books_id(+)
     and a.set_of_books_id=c.set_of_books_id(+)
     and a.set_of_books_id=d.set_of_books_id(+)
     and a.set_of_books_id=e.set_of_books_id(+)
ORDER BY 1
阅读(1628) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~