怎样给oracle视图加一个主键

2025-04-02 12:17:06
推荐回答(1个)
回答1:

oracle是可以为视图加主键,写法: create or replace view mylist(myid,insize,outsize,statrtime,endtime,jobid,imeiid,ip,useragent UNIQUE RELY DISABLE NOVALIDATE,CONSTRAINT id_pk PRIMARY KEY (myid) RELY DISABLE NOVALIDATE)
as

select job.dm_session_id as myid,
http.dm_request_size as insize,
http.dm_response_size as outsize,
job.begin_time_stamp as statrtime,
job.end_time_stamp as endtime,
job.job_id as jobid,
job.device_external_id as imeiid,
http.client_ip as ip,
http.user_agent as useragent
from V_DM_TRACKING_LOG_JOB_SUM job,DM_TRACKING_LOG_HTTP http where job.Dm_Session_Id=http.dm_session_id