1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Procedure SearchCursor (
pd_DateFrom IN Date ,
pd_DateTo IN Date ,
pn_BillType IN Number ,
pn_BillStatus IN Number ,
pn_PeriodMaster IN Number ,
RetCursor OUT sys_refcursor
)
Is
vSQL Long ;
Begin
vSQL := 'Select '
|| 'VDBillHeader_i '
|| ', VDBillTypologyClassItem.FGetTypologyClassItemCode(T_BillType_i) as BILLTYPE '
|| ', VDBillTypologyClassItem.FGetTypologyClassItemCode(T_BillStatus_i) as BILLSTATUS '
|| ', DateFrom '
|| ', DateTo '
|| ', decode(IsPeriodMaster '
|| ', 0 '
|| ', ''Non'' '
|| ', 1 '
|| ', ''Oui'' '
|| ') as LASTBILL '
|| ', BillComment '
|| 'From VDBillHeader '
|| 'Where 1 = 1 ' ;
If pd_DateFrom is not Null
Then
vSQL := vSQL
|| 'And DateFrom = '''|| pd_DateFrom ||''' ' ;
End If ;
If pd_DateTo is not Null
Then
vSQL := vSQL
|| 'And DateTo = '''|| pd_DateTo ||''' ' ;
End If ;
If pn_BillType is not Null
Then
vSQL := vSQL
|| 'And T_BillType_i = '|| pn_BillType ||' ' ;
End If ;
If pn_BillStatus is not Null
Then
vSQL := vSQL
|| 'And T_BillStatus_i = '|| pn_BillStatus ||' ' ;
End If ;
If pn_PeriodMaster is not Null
Then
vSQL := vSQL
|| 'And IsPeriodMaster = '|| pn_PeriodMaster ||' ' ;
End If ;
Open RetCursor for vSQL ;
End SearchCursor ; |
Partager