Create or replace view into asselect nvl (latency, 1) values, numbers, fdtmdate, flngaudit, flngcustomerid, numbers, fchrphone, flngpositionid, numbers, flng1_mentid, numbers, flngemployeeid, fchremployeecode, fchremployeename, flotquantity, fchrnote, flngreceipttypeid, fchrreceipttypefrom (select mp. flngpurchaseorderid flngsaleorderid, mp. fchrpurchaseorderno fchrsaleorderno, mp. fdtmdate, mp. flngaudit, ----- data to be imported into the database mp. flngsupplyid flngcustomerid, c. strcustomername fchrcustomername, mp. fchrphone, mp. flngpositionid, p. strpositioncode fchrpositioncode, p. strpositionname fchrpositionname, p. strfullname fchrpositionfullname, mp. flng1_mentid, d. strfullname fchrdepartmentfullname, mp. flngemployeeid, e. stremployeecode fchremployeecode, e. stremployeename fchremployeename, mp. flotquantity, mp. fchrnote, mp. flngreceipttypeid, case when type = 1 then 'warehouse receiving wared' when flngreceipttypeid = 2 then 'purchase return' end fchrreceipttypefrom mcerp_purchaseorder mpinner join department d on mp. flng1_mentid = d. lng1_mentidinner join employee e on mp. flngemployeeid = e. lngemployeeidinner join position p on mp. flngpositionid = p. lngpositionidleft join supplypreapp s on mp. flngsupplyid = s. lngsupplypreappidleft join customerex c on mp. flngsupplyid = c. lngcustomeridwhere mp. flngaudit = 1 and (mp. flngstock = 0 or mp. flngstock = 1) and mp. fbitclose = 0 union all ------------- select. flngallocateid flngsaleorderid,. fchrallocateno fchrsaleorderno,. fdtmdate,. flngaudit, ---- Application ID, Application No., document date, audit status, 0 flngcustomerid, ''fchrcustomername, ''fchrphone, ------ customer id, customer name, customer phone. flnginpositionid flngpositionid, pp. strpositioncode fchrpositioncode, pp. strpositionname fchrpositionname, pp. strfullname fchrpositionfullname, ---- warehouse 0 flng1_mentid, ''fchrdepartmentfullname, ----- Department. flngemployeeid, e. stremployeecode fchremployeecode, e. stremployeename fchremployeename, ----- Clerk. flotquantity,. fchrnote, 21 flngreceipttypeid, 'dial request' fchrreceipttype ---- quantity, remarks, document type ID, document type strfrom mcerp_allocate ainner join position pp on pp. lngpositionid =. flnginpositionidleft join employee e on e. lngemployeeid =. flngemployeeidwhere. flnginid <= 0 and. flngoutid> 0 union all ------ other warehouse receiving, other warehouse receiving back select. flngotherinoutid flngsaleorderid,. fchrotherinoutno,. fdtmdate,. flngaudit,. flngcustomerid, c. strcustomername fchrcustomername, c. strmovephone fchrphone,. flngpositionid, pp. strpositioncode fchrpositioncode, pp. strpositionname fchrpositionname, pp. strfullname fchrpositionfullname,. flng1_mentid, d. strfullname fchrdepartmentfullname,. flngemployeeid, e. stremployeecode fchremployeecode, e. stremployeename fchremployeename,. flotquantity,. fchrnote, flngreceipttypeid, case when flngreceipttypeid = 31 then 'other warehouse receiving requests' when accept = 32 then 'other warehouse receiving failed' end fchrreceipttypefrom mcerp_otherinout ainner. flng1_mentid = d. lng1_mentidinner join position pp on pp. lngpositionid =. flngpositionidleft join employee e on e. lngemployeeid =. flngemployeeidleft join customerex c on. flngcustomerid = c. lngcustomeridwhere. flngstock <> 2 and. flngauditid> 0 and (. flngreceipttypeid = 31 or. flngreceipttypeid = 32)
The preceding is a view in Oracle. This view is always not added several times.
The view is not added after vertices.
The reason is that in view SQL, the union all keyword EF cannot infer which is the primary key.
Solution:
First, delete the SQL statements under union all and leave only one table for query. Then update the view.
After updating the view, add union all to the SQL statement and execute the SQL statement. In this way, you can directly query and call this view in the program.