Search Results lead_source_code




Overview

AS_OPPORTUNITIES is a multi-organization view within the Oracle E-Business Suite Sales Foundation (AS) module. It exposes sales opportunity records — the qualified sales leads that a sales organization is actively pursuing — in a form that respects the Oracle Multi-Org access model. From a functional standpoint, an opportunity is a lead that has progressed beyond initial qualification and is now tracked through a sales pipeline, with attributes such as sales stage, win probability, decision date, and expected revenue.

Because the view is defined over AS_LEADS_ALL and applies an ORG_ID predicate driven by the session's client information, it presents only the opportunities visible to the current operating unit. This makes it the appropriate read layer for reports, concurrent programs, and integrations that must respect multi-org security. It is important to note that the view is documented as not implemented in the reference database, so it should not be assumed to exist in every environment; it is a metadata definition available for report and integration design.

Underlying Base Objects

The view text documents a single source object: AS_LEADS_ALL. Despite the "LEADS" naming, AS_LEADS_ALL stores both leads and opportunities, distinguished by attributes such as STATUS and SALES_STAGE_ID. The SELECT list of AS_OPPORTUNITIES projects a curated subset of columns from that table.

The multi-org filter is applied through the standard Oracle Multi-Org mechanism. The WHERE clause evaluates the ORG_ID column against the client information stored in the session via USERENV('CLIENT_INFO'), extracting the first ten characters to derive the operating unit. When the client information is blank, the expression resolves to -99, meaning rows whose ORG_ID is null or -99 are visible; otherwise only rows matching the current operating unit are returned. No additional documented base objects are referenced, and the view itself exposes no joins in its definition.

Key Columns

Common Use Cases and Queries

The view is typically used to report on pipeline activity by operating unit, to reconcile opportunity values against forecast, and to supply opportunity data to external CRM or analytics systems. A recurring scenario is locating an opportunity by its number, which is exactly the "lead_number" search pattern.

Locate an opportunity by number:

SELECT lead_id, lead_number, status, customer_id,
       total_amount, currency_code, win_probability
FROM   as_opportunities
WHERE  lead_number = :lead_number;

List open opportunities for the current operating unit with their expected value:

SELECT lead_number, sales_stage_id, decision_date,
       win_probability, total_amount, currency_code
FROM   as_opportunities
WHERE  status = 'OPEN'
ORDER  BY decision_date;

Summarize pipeline value excluding closed-won and closed-lost records:

SELECT currency_code,
       COUNT(*)          AS opportunity_count,
       SUM(total_amount) AS pipeline_value
FROM   as_opportunities
WHERE  status NOT IN ('WON','LOST')
GROUP  BY currency_code;

Because the view enforces the multi-org predicate automatically, these queries return only the opportunities for the operating unit in the current session context, provided ORG_ID is set appropriately before execution.