1

在以下“AND CAST(FLAGS AS BIGINT) & 1 = 1”如何为 Oracle sp 编写此代码时,我们必须允许应用程序也处理 Oracle 用户。

ALTER PROCEDURE [OGEN].[DBD_GET_STOCK_SUMMARY]
@FACILITY_KEY VARCHAR(1000),
@START_DATE DATETIME,
@END_DATE DATETIME
AS
BEGIN
    SELECT COUNT(*) COUNT, OGEN.DATEONLY(CREATED_ON) [DATE]
    FROM OGEN.NDC_M_FORMULARY


    WHERE OGEN.DATEONLY(CREATED_ON) BETWEEN OGEN.DATEONLY(@START_DATE) AND OGEN.DATEONLY(@END_DATE)
    AND FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITY_KEY)) 
    **AND CAST(FLAGS AS BIGINT) & 1 = 1**
    GROUP BY OGEN.DATEONLY(CREATED_ON) 
END 


GO
4

2 回答 2

1

代替BIGINT,您可以通过 NUMBER以下BINARY_INTEGER方式在 oracle 中使用...

CAST (FLAGS  AS NUMBER(19))
于 2012-07-05T19:34:12.440 回答
0
select count(*) count, trunc(CREATED_ON) "DATE"
  from NDC_M_FORMULARY
 where trunc(CREATED_ON) BETWEEN trunc(:startDate) AND trunc(:endDate)
   and FACILITY_KEY IN (select cast (regexp_substr(:facilityKey,'[^,]+', 1, level) as number)
                          from dual
                       connect by regexp_substr(:facilityKey, '[^,]+', 1, level) is not null)
   and bitand(cast (flags as int), 1) = 1
 group by trunc(CREATED_ON)
于 2012-07-07T15:40:20.310 回答