Don't know how to test the output of the PL/SQL function

I have a function in the package '. " XCCC_PO_APPROVALLIST_S1' called 'does_cpa_exist ':
   FUNCTION does_cpa_exist(
      p_document_id              IN       NUMBER
   )
      RETURN BOOLEAN
   IS
      l_cpa_exists VARCHAR2(100);
   BEGIN
      SELECT 'Y'
        INTO l_cpa_exists
        FROM po.po_requisition_lines_all prla
           , ap.ap_suppliers pv
           , ap.ap_supplier_sites_all pvsa
       WHERE prla.vendor_id = pv.vendor_id
         AND prla.vendor_site_id = pvsa.vendor_site_id
         AND pv.vendor_id = pvsa.vendor_id
         AND prla.requisition_header_id = p_document_id
         AND EXISTS(
                SELECT pha.vendor_id
                  FROM po.po_headers_all pha
                 WHERE pv.vendor_id = pha.vendor_id
                   AND pvsa.vendor_site_id = pha.vendor_site_id
                   AND pha.org_id = fnd_profile.VALUE('ORG_ID')
                   AND pha.type_lookup_code = 'CONTRACT'
                   AND pha.authorization_status = 'APPROVED');

      RETURN TRUE;

      IF (p_document_id IS NULL)
      THEN
         RETURN FALSE;
      END IF;
   EXCEPTION
      WHEN OTHERS
      THEN
         RETURN FALSE;
   END does_cpa_exist;
The pl/sql valid and commits OK in TOAD.

I ran the sql in the EBS, and took the path of the workflow looks like that function returned a value of false.

I pass to the function a document_id.

I was wondering how I might test the output of the function from TOAD?

I tried:
select XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934) from dual;
But get errors:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
I do probably bad 101 things here, but I would still ask thinking and risk of being shouted at.

Any advice appreciated,

Thank you

I was wondering how I might test the output of the function from TOAD?

Try

begin
  if xccc_po_approvallist_s1.does_cpa_exist (1017934)
  then
    dbms_output.put_line ('True');
  else
    dbms_output.put_line ('False');
  end if;
end;
/

Tags: Database

Similar Questions

Maybe you are looking for