PLS-00306: 调用 'select_s' 时参数的数量或类型错误
PLS-00306: wrong number or types of arguments in call to 'select_s'
直接从编辑器 (Toad) 中调用它。不知道为什么反复检查函数定义和变量类型会出现上述错误。在线提供的所有信息似乎都是针对存储过程的——我认为这里没有使用它
DECLARE
TYPE attrs_type is VARRAY(10) of STRING(10);
l_ldap_host VARCHAR(255) := 'SERVERNAME';
l_ldap_port INT := 389;
l_ldap_user VARCHAR(255) := 'USERNAME';
l_ldap_passwd VARCHAR(255) := 'PASSWORD';
l_ldap_base VARCHAR(255) := 'l=something,dc=something';
l_session DBMS_LDAP.session;
l_retval NUMBER;
l_entry VARCHAR(255);
l_attrs attrs_type;
l_message VARCHAR(255) := null;
l_filter VARCHAR(255) := 'objectclass=*';
BEGIN
l_session := DBMS_LDAP.init(hostname => l_ldap_host,
portnum => l_ldap_port);
l_retval := DBMS_LDAP.simple_bind_s(ld => l_session,
dn => l_ldap_user,
passwd => l_ldap_passwd);
l_attrs(1) := '*'; -- retrieve all attributes
l_retval := DBMS_LDAP.search_s(
ld => l_session,
base => l_ldap_base,
scope => DBMS_LDAP.SCOPE_SUBTREE,
filter => l_filter,
attrs => l_attrs,
attronly => 0,
res => l_message);
DBMS_OUTPUT.put_line(l_message);
-- code to do stuff
EXCEPTION
WHEN OTHERS THEN DBMS_OUTPUT.put_line (SQLERRM);
END
您必须将 l_attrs
定义为 dbms_ldap.string_collection
,而不是您自己的类型。即使您的类型以相同的方式定义,它也不能与另一个明显相似的类型互换。对于 Oracle,您的 attrs_type
与 string_collection
不同 。因此你得到的错误 - 你确实为该参数使用了错误的类型。
A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.
直接从编辑器 (Toad) 中调用它。不知道为什么反复检查函数定义和变量类型会出现上述错误。在线提供的所有信息似乎都是针对存储过程的——我认为这里没有使用它
DECLARE
TYPE attrs_type is VARRAY(10) of STRING(10);
l_ldap_host VARCHAR(255) := 'SERVERNAME';
l_ldap_port INT := 389;
l_ldap_user VARCHAR(255) := 'USERNAME';
l_ldap_passwd VARCHAR(255) := 'PASSWORD';
l_ldap_base VARCHAR(255) := 'l=something,dc=something';
l_session DBMS_LDAP.session;
l_retval NUMBER;
l_entry VARCHAR(255);
l_attrs attrs_type;
l_message VARCHAR(255) := null;
l_filter VARCHAR(255) := 'objectclass=*';
BEGIN
l_session := DBMS_LDAP.init(hostname => l_ldap_host,
portnum => l_ldap_port);
l_retval := DBMS_LDAP.simple_bind_s(ld => l_session,
dn => l_ldap_user,
passwd => l_ldap_passwd);
l_attrs(1) := '*'; -- retrieve all attributes
l_retval := DBMS_LDAP.search_s(
ld => l_session,
base => l_ldap_base,
scope => DBMS_LDAP.SCOPE_SUBTREE,
filter => l_filter,
attrs => l_attrs,
attronly => 0,
res => l_message);
DBMS_OUTPUT.put_line(l_message);
-- code to do stuff
EXCEPTION
WHEN OTHERS THEN DBMS_OUTPUT.put_line (SQLERRM);
END
您必须将 l_attrs
定义为 dbms_ldap.string_collection
,而不是您自己的类型。即使您的类型以相同的方式定义,它也不能与另一个明显相似的类型互换。对于 Oracle,您的 attrs_type
与 string_collection
不同 。因此你得到的错误 - 你确实为该参数使用了错误的类型。
A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.