Home > database >  Oracle view to add a primary key
Oracle view to add a primary key

Time:10-02

SELECT
Tm INVCODE,
Tm BATCH,
Tm. AuxQty - NVL (PE. Qty, 0) AS Aqty
The FROM
(SELECT
INVCODE,
BATCH,
The SUM (QTY) AS AuxQty
The FROM
TAB_INV_STOCK inv
GROUP BY
INVCODE,
BATCH,
ID) tm LEFT OUTER JOIN (SELECT
POE INVCODE,
POE. BATCH,
The SUM (POE) QTY - POE) CHECKQTY) AS QTY
The FROM
TAB_BILL_PLANOUTENTRY POE INNER JOIN TAB_BILL_PLANOUT Po ON the Po. The ID=POE. MASID
WHERE
Po. ISAUDIT='true' AND Po. ISCLOSE='false'
GROUP BY
POE INVCODE,
POE. BATCH) ON PE PE. INVCODE=tm. INVCODE AND PE. The BATCH=tm. The BATCH

CodePudding user response:

What is the purpose?
Corresponding to the base table has a primary key is not OK?

CodePudding user response:

Oracle is vs entity model could not add the view, a 6013 error

CodePudding user response:

- the official website is an example, you consult
Creating a View with Constraints: Example, The following statement creates a
Restricted view of the sample table. Hr employees and defines a unique constraint on
The email view the column and a primary key constraint for the view on the emp_id
The view column:
The CREATE VIEW emp_sal (emp_id, last_name,
Email UNIQUE RELY DISABLE NOVALIDATE,
The CONSTRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE NOVALIDATE)
AS the SELECT employee_id, last_name, email FROM employees.

CodePudding user response:

May be within the view of data, you want to add a primary key field data is not the only condition,

CodePudding user response:

By definition, entity model add view is not the primary key, even if the code above I bring out the ID, but still can not add, or at 6013 errors,
  • Related