小编psa*_*j12的帖子

在执行任何其他SQL之前先执行子查询重构

我有一个非常复杂的视图,形式如下

create or replace view loan_vw as 
select * from (with loan_info as (select loan_table.*,commission_table.* 
                                   from loan_table,
                                  commission_table where 
                                  contract_id=commission_id)
                select /*complex transformations */ from loan_info
                where type <> 'PRINCIPAL'
                union all 
                select /*complex transformations */ from loan_info
                where type = 'PRINCIPAL')
Run Code Online (Sandbox Code Playgroud)

现在,如果我执行以下操作,则查询挂起

         select * from loan_vw where contract_id='HA001234TY56';
Run Code Online (Sandbox Code Playgroud)

但是,如果我在子查询重构中进行硬编码或在同一会话中使用包级变量,则查询将在第二秒返回

create or replace view loan_vw as 
        select * from (with loan_info as (select loan_table.*,commission_table.* 
                                           from loan_table,
                                          commission_table where 
                                          contract_id=commission_id
                                          and contract_id='HA001234TY56'
                                          )
                        select /*complex transformations */ from loan_info
                        where type …
Run Code Online (Sandbox Code Playgroud)

sql oracle performance subquery query-optimization

8
推荐指数
1
解决办法
208
查看次数

使用oracle DBMS_LDAP验证针对Microsoft Active Directory的用户凭据

我们正在尝试使用dbms_ldap针对Microsoft AD对我们的应用程序用户进行身份验证,我们无法在离岸环境中对其进行测试

我们有三个具体问题

1)如何验证用户是否存在于Microsoft Active Directory中

我们使用以下代码来获取Application用户的专有名称

DBMS_LDAP.USE_EXCEPTION := FALSE;
retval := DBMS_LDAP.search_s(ld       => ldapSession,
                           base     => LDAP_BASE,
                           scope    => DBMS_LDAP.SCOPE_SUBTREE,
                           filter   => '(&(objectclass=USER)(SAMAccountName=' ||
                                       p_username || '))',
                           attrs    => attrList,
                           attronly => 0,
                           res      => ldapMessage);
  -- get the DN
if retval <> DBMS_LDAP_UTL.SUCCESS THEN
RAISE l_ldap_exception;
END IF;
userDN := DBMS_LDAP.get_dn(ldapSession, ldapMessage);
Run Code Online (Sandbox Code Playgroud)

所以第一个问题是什么是价值

 userDN and ldapMessage
Run Code Online (Sandbox Code Playgroud)

如果用户不存在于Microsoft AD中

2)假设用户存在并且在这种情况下输入了错误的密码将是retval的返回值

if p_password is null then
raise_application_error(-20000, 'Invalid Null password');
else
retval := DBMS_LDAP.simple_bind_s(ldapSession,userDN, p_password);
end if;

if retval <> …
Run Code Online (Sandbox Code Playgroud)

oracle ldap oracle10g

3
推荐指数
1
解决办法
2787
查看次数