Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Oracle Internet Directory: DBMS_LDAP.GET_VALUES(..) does not return values
When calling DBMS_LDAP.GET_VALUES(..) for an attribute with 1 string
value, the returned STRING_COLLECTION is always empty (but NOT NULL)
-see code and output attached.
Could anyone tell me what's going wrong?
Thanks,
Philippe
VERSION INFORMATION
CODE SNIPPET
ldap_session DBMS_LDAP.SESSION; ldap_search DBMS_LDAP.MESSAGE; ldap_attrs DBMS_LDAP.string_collection; ldap_entry DBMS_LDAP.message; ldap_entries NUMBER; ldap_values DBMS_LDAP.string_collection; ldap_values_bin DBMS_LDAP.binval_collection; ldap_ber_element DBMS_LDAP.ber_element; ldap_attr_name VARCHAR2(32000); ldap_dn VARCHAR2(256);
ldap_entries := DBMS_LDAP.count_entries(ldap_session, ldap_search); DBMS_OUTPUT.PUT_LINE('Number of Entries : '
|| TO_CHAR(ldap_entries));
IF (ldap_entries > 0) THEN
ldap_entry := DBMS_LDAP.FIRST_ENTRY(ldap_session, ldap_search); ldap_dn := DBMS_LDAP.GET_DN(ldap_session,ldap_entry); DBMS_OUTPUT.PUT_LINE('DN = ' || ldap_dn);
ldap_attr_name := DBMS_LDAP.first_attribute(ldap_session,ldap_entry,ldap_ber_element);
WHILE ldap_attr_name IS NOT NULL LOOP
DBMS_OUTPUT.PUT_LINE(ldap_attr_name);
ldap_values := DBMS_LDAP.GET_VALUES(ldap_session,ldap_entry,ldap_attr_name); DBMS_OUTPUT.PUT_LINE('Number of values : '
|| TO_CHAR(DBMS_LDAP.count_values(ldap_values)));
DBMS_OUTPUT.PUT_LINE('Number of values : '
|| TO_CHAR(ldap_values.count()));
IF ldap_values IS NULL THEN
DBMS_OUTPUT.PUT_LINE('ldap_values is NULL');
END IF;
ldap_values_bin := DBMS_LDAP.GET_VALUES_LEN(ldap_session,ldap_entry,ldap_attr_name);
DBMS_OUTPUT.PUT_LINE('Number of values bin: '
|| TO_CHAR(DBMS_LDAP.count_values_len(ldap_values_bin)));
IF (DBMS_LDAP.count_values(ldap_values) > 0 AND ldap_values IS NOT NULL)THEN
FOR inx in ldap_values.first .. ldap_values.last LOOP DBMS_OUTPUT.PUT_LINE(ldap_attr_name || ' : '
|| TO_CHAR(ldap_values(inx)));
END LOOP;