我的一段代码目前使用以下代码将数据提取到对象中:
SELECT ORDR_LIST(ORDER_NUMBER,ORDER_TYPE,ORDER_DATE,CLIENT_ID,CLIENT_NAME) BULK COLLECT INTO P_RESULTSET
FROM
(SELECT ORDER_NUMBER,
ORDER_TYPE,
ORDER_DATE,
CLIENT_ID,
CLIENT_NAME
FROM
(SELECT ORDER_NUMBER,
ORDER_TYPE,
TO_CHAR(ORDER_CREATED_DATE,'YYYY-MM-DD HH:MI:SS am') AS ORDER_DATE,
CUSTOMER_FIRST_NAME
||' '
||CUSTOMER_SURNAME AS C_NAME,
CLIENT_ID,
CLIENT_NAME
FROM CONNECT_CUSTOMER_TRANS
WHERE ORDER_TYPE =P_ORDER_TYPE
AND lower(CUSTOMER_SURNAME) =lower(P_LAST_NAME)
AND lower(CUSTOMER_FIRST_NAME)=lower(P_FIRST_NAME)
AND lower(CLIENT_ID) =lower(P_CLIENT_ID)
AND ORDER_CREATED_DATE BETWEEN P_FROM_DT AND P_TO_DT
)
WHERE C_NAME=I.CUS_NAME);
现在我已将 select 语句动态生成到变量 var1 中。但是我无法在动态部分实现它。
代码应如下所示:
SELECT ORDR_LIST(ORDER_NUMBER,ORDER_TYPE,ORDER_DATE,CLIENT_ID,CLIENT_NAME) BULK COLLECT INTO P_RESULTSET
FROM var1
这将通过立即执行来运行。