Advertisements

Thursday, March 28, 2013

How to get parameters from WF_BPEL_QTAB?

Con este query podemos obtener el valor del parametro deseado a partir del event_key que normalmente nos da una ejecución de un "Evento de Negocio".


SELECT   q.q_name
,        q.msgid
,        q.state
,        TO_CHAR(q.enq_time,'DD-MON-YYYY HH24:MI:SS') "ENQ_TIME"
,        q.user_data.event_name "EVENT_NAME"
,        (select value from table(q.user_data.getParameterList()) where name='CUSTOMER_PRODUCT_ID') instance_id
FROM     WF_BPEL_QTAB q
WHERE   1=1
and q.user_data.event_key = 'oracle.apps.csi.instance.update3451'

En este escenario estamos probando el busines event de ""Install Base" de update en el cual obtenemos el instance_ide (id del item) el cual nos va a permitir poder acceder a su información completa.

Wednesday, March 6, 2013

How to query collections types in PL SQL

Tenemos definido los siguientes objetos type:


 CREATE OR REPLACE TYPE "SOAADM"."AP_INVOICES_IF_T" AS OBJECT (
 INVOICE_ID NUMBER,
 INVOICE_NUM VARCHAR2(50 BYTE),
 INVOICE_TYPE_LOOKUP_CODE VARCHAR2(25 BYTE),
 INVOICE_DATE DATE,
 VENDOR_ID NUMBER
 )

 CREATE OR REPLACE TYPE "SOAADM"."AP_INVOICES_IF_TBL_T" AS TABLE OF AP_INVOICES_IF_T;


Ahora probamos con el siguiente script como saber si se pobló de manera correcta:
declare
  v_ap_if_tbl AP_INVOICES_IF_TBL_T;
  v_ap_if_t AP_INVOICES_IF_T;
  v_count number;
begin
  v_ap_if_t.INVOICE_ID:=1;
  v_ap_if_tbl := AP_INVOICES_IF_TBL_T(v_ap_if_t);
  select count(*) into v_count from table(cast(v_ap_if_tbl as AP_INVOICES_IF_TBL_T);
  dbms_output.put_line('length: '||v_count);
end;