Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Query improvement to reduce duplicate binds #579

Description

@MikeNeilson

By using a Common Table expression we can reduce the number of binds to 2.

with inputs as (select ? as username, ? as office_id from dual)
select avsu.user_group_id 
from cwms_20.av_sec_users avsu, inputs
where avsu.db_office_code = cwms_20.cwms_util.get_db_office_code(inputs.office_id) 
  and upper(avsu.username) = case 
     when instr(inputs.username, '.', -1) > 0 then 
        (select userid 
           from cwms_20.at_sec_cwms_users 
           where edipi = substr(inputs.username, instr(inputs.username, '.', -1) + 1)) 
         else 
            upper(inputs.username) 
      end 
  and avsu.is_member = 'T'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions