# SQL Objects

> Browse PeopleSoft SQL Object definitions — views, synonyms, and indexes — with source SQL and project membership.

---

Site [llms.txt](/llms.txt)

---

<div id="pslens-context-panel" class="card border-info mb-4 d-none">
  <div class="card-header bg-light text-info py-2 fw-bold d-flex align-items-center border-bottom border-info-subtle">
    <i class="bi bi-info-circle-fill me-2"></i>
    <span>Tailored Operational Context</span>
  </div>
  <div class="card-body p-0">
    <ul class="list-group list-group-flush">
      <li id="row-db" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Target Database:</strong>
        <span id="ctx-db" class="badge bg-secondary font-monospace">&mdash;</span>
      </li>
      <li id="row-type" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Context Type:</strong>
        <span id="ctx-type" class="badge bg-light text-dark border font-monospace text-uppercase">&mdash;</span>
      </li>
      <li id="row-severity" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Alert Severity:</strong>
        <span id="ctx-severity" class="badge">&mdash;</span>
      </li>
      <li id="row-time" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Triggered Time:</strong>
        <span id="ctx-time" class="text-muted small">&mdash;</span>
      </li>
      <li id="row-details" class="list-group-item py-2 d-none">
        <strong id="label-details" class="d-block mb-1">Firing Context:</strong>
        <code id="ctx-details" class="d-block p-2 bg-light border rounded small"
          style="white-space: pre-wrap; word-break: break-all;">&mdash;</code>
      </li>
      <li id="row-sql" class="list-group-item py-2 d-none">
        <div class="d-flex justify-content-between align-items-center mb-1">
          <strong id="label-sql">Contextual SQL:</strong>
          <button id="btn-copy-sql" type="button" class="btn btn-sm btn-outline-secondary py-0 px-2 small">
            <i class="bi bi-clipboard me-1"></i>Copy SQL
          </button>
        </div>
        <pre class="mb-0 p-2 bg-light border rounded small"><code id="ctx-sql" style="white-space: pre-wrap; word-break: break-word;">&mdash;</code></pre>
      </li>
    </ul>
  </div>
</div>

<script>
  (function () {
    const params = new URLSearchParams(window.location.search);
    const metadata = params.get('metadata');
    if (!metadata) return;

    try {
      
      const base64 = metadata.replace(/-/g, '+').replace(/_/g, '/');
      const jsonStr = decodeURIComponent(escape(window.atob(base64)));
      const data = JSON.parse(jsonStr);

      if (data) {
        let hasData = false;

        if (data.db) {
          document.getElementById('ctx-db').textContent = data.db;
          document.getElementById('row-db').classList.remove('d-none');
          hasData = true;
        }

        if (data.type) {
          document.getElementById('ctx-type').textContent = data.type;
          document.getElementById('row-type').classList.remove('d-none');
          hasData = true;
        }

        if (data.severity) {
          const severityBadge = document.getElementById('ctx-severity');
          const severity = data.severity.toLowerCase();
          severityBadge.textContent = severity.toUpperCase();
          if (severity === 'critical') {
            severityBadge.className = 'badge bg-danger';
          } else if (severity === 'warning') {
            severityBadge.className = 'badge bg-warning text-dark';
          } else {
            severityBadge.className = 'badge bg-info';
          }
          document.getElementById('row-severity').classList.remove('d-none');
          hasData = true;
        }

        if (data.t) {
          const date = new Date(data.t * 1000);
          document.getElementById('ctx-time').textContent = date.toLocaleString();
          document.getElementById('row-time').classList.remove('d-none');
          hasData = true;
        }

        if (data.details) {
          document.getElementById('ctx-details').textContent = data.details;

          
          const labelDetails = document.getElementById('label-details');
          if (data.type === 'object') {
            labelDetails.textContent = 'Object Metadata Details:';
          } else if (data.type === 'report') {
            labelDetails.textContent = 'Report Description:';
          } else {
            labelDetails.textContent = 'Firing Context:';
          }

          document.getElementById('row-details').classList.remove('d-none');
          hasData = true;
        }

        if (data.sql) {
          document.getElementById('ctx-sql').textContent = data.sql;
          document.getElementById('row-sql').classList.remove('d-none');
          const copyBtn = document.getElementById('btn-copy-sql');
          if (copyBtn && navigator.clipboard) {
            copyBtn.addEventListener('click', function () {
              navigator.clipboard.writeText(data.sql).then(function () {
                copyBtn.innerHTML = '<i class="bi bi-check2 me-1"></i>Copied';
                setTimeout(function () {
                  copyBtn.innerHTML = '<i class="bi bi-clipboard me-1"></i>Copy SQL';
                }, 2000);
              });
            });
          }
          hasData = true;
        }

        if (hasData) {
          document.getElementById('pslens-context-panel').classList.remove('d-none');
        }
      }
    } catch (e) {
      console.error('Failed to parse operational context metadata:', e);
    }
  })();
</script>

SQL Objects are the PeopleSoft application's standalone SQL artifacts — view definitions and other named SQL fragments stored in `PSSQLDEFN` / `PSSQLTEXTDEFN`. Unlike a record's automatically-generated DDL, these are SQL bodies the developer hand-wrote and PeopleSoft keeps versioned with the rest of the metadata. psLens pulls the source SQL plus the related record (when the SQL object is a view tied to a record definition) so you don't switch into App Designer to read the SQL.

## Object Relationships

SQL Objects define custom SQL statements for database views and code modules:

- **Defines Record Views**: SQL Objects (`PSSQLDEFN`) contain the underlying SELECT statements that define SQL view records (`RECTYPE = 1`).
- **Called by PeopleCode & App Engines**: Standalone SQL objects are executed in code via `FetchSQL()` or Application Engine SQL actions.

## How psLens Improves SQL Object Inspection

Reading SQL Objects in Application Designer requires searching SQL definitions, opening the object editor, right-clicking to find backing records, and checking projects individually for migration history.

psLens presents syntax-highlighted SQL source code inline, with direct links to backing record definitions and project membership.

## Search Page

URL: `/sqlobjects?db={database}`

<figure><img src="/images/screenshots/metadata/sql-objects-search.png"
			alt="SQL Object search results for PT% showing PTACEPRBMDL_DVW, PTACESRCHDVW, and others"><figcaption>
			<p>SQL Object search results for <code>PT%</code></p>
		</figcaption>
</figure>


Search auto-matches as *starts with*. Typing `PT` finds every SQL object whose ID begins with `PT`. Include `%` yourself for ends-with (`%VW`) or contains (`%AUDIT%`) patterns, or use `%` alone to list every row. Each result shows the object name, type, and last-updated info, useful when you're tracing where a view body is defined or hunting for a delivered SQL fragment.

## Detail Page

URL: `/sqlobjects/{NAME}?db={database}`

<figure><img src="/images/screenshots/metadata/sql-objects-detail.png"
			alt="Detail page for PTACESRCHDVW showing the SQL view properties and full source SQL"><figcaption>
			<p>SQL Object detail page for <code>PTACESRCHDVW</code></p>
		</figcaption>
</figure>


The main pane shows the object's properties and the full **Source SQL** body, syntax-highlighted and copyable, so you can see what the view SELECTs without an App Designer round-trip. The sidebar provides related-data toggles and a direct link to the **Code & SQL Text Search** report.

<figure><img src="/images/screenshots/metadata/sql-objects-detail-expanded.png"
			alt="SQL Object detail page with all panels expanded"><figcaption>
			<p>All panels expanded: Source Record and Project membership</p>
		</figcaption>
</figure>


## Related Data Panels

### Source Record

<figure><img src="/images/screenshots/metadata/sql-objects-panel-source-record.png"
			alt="Source Record panel linking to PTACESRCHDVW"><figcaption>
			<p>Direct link into the matching record detail page</p>
		</figcaption>
</figure>


When the SQL object is the body of a view-type record, this panel links into the parent record's detail page so you can see the field list and the rest of the record metadata in one click.

### PeopleCode References

Lists every PeopleCode program that references this SQL object via a compiled `SQL.<SQLID>` token (such as `GetSQL(SQL.MY_SQL, ...)` or `SQLExec(SQL.MY_SQL, ...)`), queried from `PSPCMNAME` (`RECNAME = 'SQL'`). Includes a one-click Markdown export of all referencing PeopleCode programs and their source code.

### Code & SQL Text Search

Because the PeopleCode compiler only indexes direct `SQL.<SQLID>` object tokens in `PSPCMNAME`, SQL objects referenced inside string literals (for example `SQLExec("%SQL(MY_SQL)")`) or nested via `%SQL(MY_SQL)` inside other SQL objects or Application Engine SQL actions do not appear in the cross-reference table. The **Search in Code & SQL** button in the sidebar (and **Full Text Search** button in the PeopleCode References card) deep-links to the [Code & SQL Text Search](/docs/reports/objects/code-sql-search/) report with the SQL ID and database pre-filled.

### Included in Projects

<figure><img src="/images/screenshots/metadata/sql-objects-panel-projects.png"
			alt="Included in Projects panel for the SQL object"><figcaption>
			<p>App Designer projects that include this SQL object</p>
		</figcaption>
</figure>


Lists projects that contain this SQL object as a project item. Useful for tracing migration history of view DDL changes.
