24.7 SEARCH Function
The SEARCH function searches the LDAP repository. The result is an object table of (dn, name, val) that can be used in table queries.
                  
Syntax
function search (
   	    p_username          IN VARCHAR2 DEFAULT NULL,
   	    p_pass              IN VARCHAR2 DEFAULT NULL,
   	    p_auth_base         IN VARCHAR2 DEFAULT NULL,
   	    p_host              IN VARCHAR2,
   	    p_port              IN NUMBER DEFAULT 389,
   	    p_use_ssl           IN VARCHAR2 DEFAULT 'N',
   	    p_search_base       IN VARCHAR2,
   	    p_search_filter     IN VARCHAR2,
   	    p_scope             IN BINARY_INTEGER DEFAULT SYS.DBMS_LDAP.SCOPE_SUBTREE,
   	    p_timeout_sec       IN BINARY_INTEGER DEFAULT 3,
   	    p_attribute_names   IN VARCHAR2 )
   	    RETURN APEX_T_LDAP_ATTRIBUTES PIPELINED;Parameters
Table 24-7 Search Parameters
| Parameter | Descriptions | 
|---|---|
| 
 | Login name of the user (can be  | 
| 
 | The password for  | 
| 
 | The authentication base dn for  | 
| 
 | The LDAP server host name. | 
| 
 | The LDAP server port number. | 
| 
 | Set to 'Y' to use SSL in bind to LDAP server. Set to 'A' to use SSL with one way authentication (requires LDAP server certificate configured in an Oracle wallet). Set to 'N' to not use SSL (default). | 
| 
 | dn base for the search. | 
| 
 | LDAP search filter expression. | 
| 
 | Search scope (default descends into subtrees). | 
| 
 | Timeout for the search (default is 3 seconds) | 
| 
 | Comma separated list of return attribute names | 
Example 1
SELECT val group_dns
  FROM table(apex_ldap.search (
           p_host            => 'ldap.example.com',
           p_search_base     => 'dc=example,dc=com',
           p_search_filter   => 'uid='||apex_escape.ldap_search_filter(:APP_USER),
           p_attribute_names => 'memberof' ));Example 2
SELECT dn, mail, dispname, phone
  from ( select dn, name, val
           from table(apex_ldap.search (
                          p_host            => 'ldap.example.com',
                          p_search_base     => 'dc=example,dc=com',
                          p_search_filter   => '&(objectClass=person)(ou=Test)',
                          p_attribute_names => 'mail,displayname,telephonenumber' )))
  pivot (min(val) for name in ( 'mail'            mail,
                                'displayname'     dispname,
                                'telephonenumber' phone ))Parent topic: APEX_LDAP