当前位置:网站首页>Query Oracle view creation statement and how to insert data into the view [easy to understand]
Query Oracle view creation statement and how to insert data into the view [easy to understand]
2022-07-28 21:29:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Today, I will test the interface , Need to be in data Insert some test data into the Library . But when I was inserting data into the database , It is found that the interface queries the view, not the table , So the problems encountered are recorded here .
1. There are two situations when inserting data into the view
1.1 For simple views ( The view is built on a table ), Just insert data directly like a table ;
1.2 For complex views ( View creation includes multiple table associations 、 grouping 、 Aggregate functions ), You cannot insert data directly at this time , We should create a INSTEAD Type trigger to operate , Insert the data to be inserted into the tables that make up the view .
Format :
create trigger [ Trigger Name ]
on [ View name ]
instead of insert
as
begin
-- Declare variables ;
-- from inserted Find the data of all columns in the table , Assign to the declared variables respectively ;
-- Insert data into the first table with the above data
-- Use the above data to insert data into the second table
endAnd we need to know whether this view is a simple view or a complex view , You need to look at the view creation statement .
2. View view created sql Statement also has the following two methods
2.1 The first one is ( Be careful The view name needs to be fully capitalized )
select dbms_metadata.get_ddl('VIEW', ' View name ') from dual;After execution, click the button below to see the statement :
2.2 The second kind
select text from user_views where view_name = ' View name ';The same is true after execution. You need to click the button to see it :
Okay , Let's share today , Impropriety , I hope you can give me more suggestions .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/128646.html Link to the original text :https://javaforall.cn
边栏推荐
猜你喜欢

How NPM switches Taobao source images

Moco V2: further upgrade of Moco series

Confession of a graduate student: why am I addicted to opengauss community?

详细讲解C语言12(C语言系列)

Buuctf questions upload labs record pass-11~pass-20

Two excellent software of my love cracking, batch search text, image and video image quality enhancement

CVPR 2022 | 网络中批处理归一化估计偏移的深入研究

Icml2022 | timing self-monitoring video transformer

Redis cache avalanche, cache penetration, cache breakdown

编码用这16个命名规则能让你少写一半以上的注释!
随机推荐
证券企业基于容器化 PaaS 平台的 DevOps 规划建设 29 个典型问题总结
The 35 required questions in MySQL interview are illustrated, which is too easy to understand
针对下一代Chromebook,联发科推出新款芯片组MT8192和MT8195
承载银行关键应用的容器云平台如何选型及建设?
Confession of a graduate student: why am I addicted to opengauss community?
微服务架构下的系统集成
Learning typescript (II)
Bug of Dom4j
(PMIC) full and half bridge drive csd95481rwj PDF specification
Library borrowing system "suggested collection"
【Bluetooth蓝牙开发】八、BLE协议之传输层
[Topic] add two numbers
Link with Bracket Sequence I(状态基多维dp)
Niuke turns on the camera and the picture disappears a few seconds later | the picture flashes when the camera is turned on
How Oracle exports data (how Oracle backs up databases)
35 道 MySQL 面试必问题图解,这样也太好理解了吧
Cloud security core technology
职场高薪 |「中高级测试」面试题
Maintenance of delta hot metal detector principle analysis of v5g-jc-r1 laser measurement sensor / detector
Buuctf questions upload labs record pass-11~pass-20